e.stopPropagation()}>
diff --git a/application/src/components/services/AddServiceDialog.tsx b/application/src/components/services/AddServiceDialog.tsx
index 13e5947..af1cb5d 100644
--- a/application/src/components/services/AddServiceDialog.tsx
+++ b/application/src/components/services/AddServiceDialog.tsx
@@ -9,6 +9,7 @@ import {
import { ServiceForm } from "./ServiceForm";
import { ScrollArea } from "@/components/ui/scroll-area";
import { useQueryClient } from "@tanstack/react-query";
+import { useLanguage } from "@/contexts/LanguageContext";
interface AddServiceDialogProps {
open: boolean;
@@ -16,6 +17,7 @@ interface AddServiceDialogProps {
}
export function AddServiceDialog({ open, onOpenChange }: AddServiceDialogProps) {
+ const { t } = useLanguage();
const queryClient = useQueryClient();
const handleSuccess = async () => {
// Immediately invalidate and refetch services data
@@ -32,9 +34,9 @@ export function AddServiceDialog({ open, onOpenChange }: AddServiceDialogProps)
)}
{isCustomInterval
- ? "Enter custom interval in seconds (minimum 10 seconds)"
- : "How often to check the service status"
+ ? t("checkIntervalDescCustom")
+ : t("checkIntervalDesc")
}
@@ -92,22 +94,22 @@ export function ServiceConfigFields({ form }: ServiceConfigFieldsProps) {
name="retries"
render={({ field }) => (
- Retry Attempts
+ {t("retryAttempts")}
-
- Number of retry attempts before marking as down
+ {t("retryAttemptsDesc")}
diff --git a/application/src/components/services/add-service/ServiceForm.tsx b/application/src/components/services/add-service/ServiceForm.tsx
index a888b11..3023ff6 100644
--- a/application/src/components/services/add-service/ServiceForm.tsx
+++ b/application/src/components/services/add-service/ServiceForm.tsx
@@ -3,7 +3,7 @@ import { useForm } from "react-hook-form";
import { zodResolver } from "@hookform/resolvers/zod";
import { useState, useEffect } from "react";
import { useToast } from "@/hooks/use-toast";
-import { serviceSchema, ServiceFormData } from "./types";
+import { useServiceSchema, ServiceFormData } from "./types";
import { ServiceBasicFields } from "./ServiceBasicFields";
import { ServiceTypeField } from "./ServiceTypeField";
import { ServiceConfigFields } from "./ServiceConfigFields";
@@ -14,6 +14,7 @@ import { Service } from "@/types/service.types";
import { ServiceRegionalFields } from "./ServiceRegionalFields";
import { getServiceFormDefaults, mapServiceToFormData, mapFormDataToServiceData } from "./serviceFormUtils";
import { useQueryClient } from "@tanstack/react-query";
+import {useLanguage} from "@/contexts/LanguageContext.tsx";
interface ServiceFormProps {
onSuccess: () => void;
@@ -30,10 +31,13 @@ export function ServiceForm({
isEdit = false,
onSubmitStart
}: ServiceFormProps) {
+ const { t } = useLanguage();
const { toast } = useToast();
const [isSubmitting, setIsSubmitting] = useState(false);
const queryClient = useQueryClient();
+ const serviceSchema = useServiceSchema();
+
// Initialize form with default values
const form = useForm({
resolver: zodResolver(serviceSchema),
@@ -124,23 +128,23 @@ export function ServiceForm({
diff --git a/application/src/components/services/add-service/ServiceNotificationFields.tsx b/application/src/components/services/add-service/ServiceNotificationFields.tsx
index 075b253..32da21f 100644
--- a/application/src/components/services/add-service/ServiceNotificationFields.tsx
+++ b/application/src/components/services/add-service/ServiceNotificationFields.tsx
@@ -9,12 +9,14 @@ import { useQuery } from "@tanstack/react-query";
import { alertConfigService, AlertConfiguration } from "@/services/alertConfigService";
import { serviceNotificationTemplateService, ServiceNotificationTemplate } from "@/services/serviceNotificationTemplateService";
import { useState, useEffect } from "react";
+import { useLanguage } from "@/contexts/LanguageContext.tsx";
interface ServiceNotificationFieldsProps {
form: UseFormReturn;
}
export function ServiceNotificationFields({ form }: ServiceNotificationFieldsProps) {
+ const { t } = useLanguage();
const [alertConfigs, setAlertConfigs] = useState([]);
// Get the current form values for debugging
@@ -88,10 +90,10 @@ export function ServiceNotificationFields({ form }: ServiceNotificationFieldsPro
- Enable Notifications
+ {t("enableNotifications")}
- Enable or disable notifications for this service
+ {t("enableNotificationsDesc")}
@@ -115,11 +117,11 @@ export function ServiceNotificationFields({ form }: ServiceNotificationFieldsPro
name="notificationChannels"
render={({ field }) => (
- Notification Channels
+ {t("notificationChannels")}
{notificationStatus === "enabled"
- ? "Select notification channels for this service"
- : "Enable notifications first to select channels"}
+ ? t("notificationChannelsEnabledDesc")
+ : t("notificationChannelsDesc")}
{/* Display selected channels as badges */}
@@ -144,7 +146,7 @@ export function ServiceNotificationFields({ form }: ServiceNotificationFieldsPro
value="" // Always reset to empty after selection
>
-
+
{alertConfigs
@@ -169,7 +171,7 @@ export function ServiceNotificationFields({ form }: ServiceNotificationFieldsPro
return (
- Alert Template
+ {t("alertTemplate")}
{
@@ -179,7 +181,7 @@ export function ServiceNotificationFields({ form }: ServiceNotificationFieldsPro
disabled={notificationStatus !== "enabled" || isLoadingTemplates}
>
-
+
{serviceTemplates?.map((template) => (
@@ -192,8 +194,8 @@ export function ServiceNotificationFields({ form }: ServiceNotificationFieldsPro
{notificationStatus === "enabled"
- ? "Choose a template for alert messages"
- : "Enable notifications first to select template"}
+ ? t("alertTemplateEnabledDesc")
+ : t("alertTemplateDesc")}
);
diff --git a/application/src/components/services/add-service/ServiceRegionalFields.tsx b/application/src/components/services/add-service/ServiceRegionalFields.tsx
index 34473b2..239404d 100644
--- a/application/src/components/services/add-service/ServiceRegionalFields.tsx
+++ b/application/src/components/services/add-service/ServiceRegionalFields.tsx
@@ -9,12 +9,14 @@ import { regionalService } from "@/services/regionalService";
import { MapPin, Loader2, X, Plus } from "lucide-react";
import { Badge } from "@/components/ui/badge";
import { Button } from "@/components/ui/button";
+import { useLanguage } from "@/contexts/LanguageContext.tsx";
interface ServiceRegionalFieldsProps {
form: UseFormReturn;
}
export function ServiceRegionalFields({ form }: ServiceRegionalFieldsProps) {
+ const { t } = useLanguage();
const regionalMonitoringEnabled = form.watch("regionalMonitoringEnabled");
const currentRegionalAgents = form.watch("regionalAgents") || [];
@@ -79,10 +81,10 @@ export function ServiceRegionalFields({ form }: ServiceRegionalFieldsProps) {
- Regional Monitoring
+ {t("regionalMonitoring")}
- Assign this service to regional monitoring agents for distributed monitoring
+ {t("regionalMonitoringDesc")}
@@ -107,7 +109,7 @@ export function ServiceRegionalFields({ form }: ServiceRegionalFieldsProps) {
name="regionalAgents"
render={({ field }) => (
- Regional Agents
+ {t("regionalAgents")}
{/* Display selected agents */}
{currentRegionalAgents.length > 0 && (
@@ -140,12 +142,12 @@ export function ServiceRegionalFields({ form }: ServiceRegionalFieldsProps) {
0
- ? "Select additional regional agents..."
+ ? t("regionalAgentsAvailablePlaceholder")
: currentRegionalAgents.length > 0
- ? "All available agents selected"
- : "No regional agents available"
+ ? t("regionalAgentsAllSelected")
+ : t("regionalAgentsNoAvailable")
} />
@@ -154,14 +156,14 @@ export function ServiceRegionalFields({ form }: ServiceRegionalFieldsProps) {
- Loading agents...
+ t("regionalAgentsLoading")
) : availableAgents.length === 0 ? (
{currentRegionalAgents.length > 0
- ? "All available agents selected"
- : "No online regional agents available"
+ ? t("regionalAgentsAllSelected")
+ : t("regionalAgentsNoOnlineAvailable")
}
) : (
@@ -190,13 +192,13 @@ export function ServiceRegionalFields({ form }: ServiceRegionalFieldsProps) {
{regionalMonitoringEnabled && onlineAgents.length === 0 && !isLoading && (
- No online regional agents found. Services will use default monitoring.
+ {t("regionalAgentsNotFoundMessage")}
)}
{currentRegionalAgents.length === 0 && regionalMonitoringEnabled && (
- No regional agents selected. Service will use default monitoring.
+ {t("regionalAgentsNotSelectedMessage")}
)}
diff --git a/application/src/components/services/add-service/ServiceTypeField.tsx b/application/src/components/services/add-service/ServiceTypeField.tsx
index 73c9848..a3f1fa0 100644
--- a/application/src/components/services/add-service/ServiceTypeField.tsx
+++ b/application/src/components/services/add-service/ServiceTypeField.tsx
@@ -4,12 +4,14 @@ import { Select, SelectContent, SelectItem, SelectTrigger, SelectValue } from "@
import { Globe, Wifi, Server, Globe2 } from "lucide-react";
import { UseFormReturn } from "react-hook-form";
import { ServiceFormData } from "./types";
+import { useLanguage } from "@/contexts/LanguageContext.tsx";
interface ServiceTypeFieldProps {
form: UseFormReturn;
}
export function ServiceTypeField({ form }: ServiceTypeFieldProps) {
+ const { t } = useLanguage();
const getServiceIcon = (type: string) => {
switch (type) {
case "http":
@@ -31,7 +33,7 @@ export function ServiceTypeField({ form }: ServiceTypeFieldProps) {
name="type"
render={({ field }) => (
- Service Type
+ {t("serviceType")}
HTTP/S
- Monitor websites and REST APIs with HTTP/HTTPS Protocol
+ {t("serviceTypeHTTPDesc")}
@@ -67,7 +69,7 @@ export function ServiceTypeField({ form }: ServiceTypeFieldProps) {
PING
- Monitor host availability with PING Protocol
+ {t("serviceTypePINGDesc")}
@@ -78,7 +80,7 @@ export function ServiceTypeField({ form }: ServiceTypeFieldProps) {
TCP
- Monitor TCP port connectivity with TCP Protocol
+ {t("serviceTypeTCPDesc")}
@@ -89,7 +91,7 @@ export function ServiceTypeField({ form }: ServiceTypeFieldProps) {
DNS
- Monitor DNS resolution
+ {t("serviceTypeDNSDesc")}
diff --git a/application/src/components/services/add-service/ServiceUrlField.tsx b/application/src/components/services/add-service/ServiceUrlField.tsx
index f8419c4..8b4aee0 100644
--- a/application/src/components/services/add-service/ServiceUrlField.tsx
+++ b/application/src/components/services/add-service/ServiceUrlField.tsx
@@ -3,12 +3,14 @@ import { FormControl, FormField, FormItem, FormLabel, FormMessage, FormDescripti
import { Input } from "@/components/ui/input";
import { UseFormReturn } from "react-hook-form";
import { ServiceFormData } from "./types";
+import { useLanguage } from "@/contexts/LanguageContext.tsx";
interface ServiceUrlFieldProps {
form: UseFormReturn;
}
export function ServiceUrlField({ form }: ServiceUrlFieldProps) {
+ const { t } = useLanguage();
const serviceType = form.watch("type");
const getPlaceholder = () => {
@@ -22,35 +24,35 @@ export function ServiceUrlField({ form }: ServiceUrlFieldProps) {
case "dns":
return "example.com";
default:
- return "Enter URL or hostname";
+ return t("targetDefaultPlaceholder");
}
};
const getDescription = () => {
switch (serviceType) {
case "http":
- return "Enter the full URL including protocol (http:// or https://)";
+ return t("targetHTTPDesc");
case "ping":
- return "Enter hostname or IP address to ping";
+ return t("targetPINGDesc");
case "tcp":
- return "Enter hostname or IP address for TCP connection test";
+ return t("targetTCPDesc");
case "dns":
- return "Enter domain name for DNS record monitoring (A, AAAA, MX, etc.)";
+ return t("targetDNSDesc");
default:
- return "Enter the target URL or hostname for monitoring";
+ return t("targetDefaultDesc");
}
};
const getFieldLabel = () => {
switch (serviceType) {
case "dns":
- return "Domain Name";
+ return t("targetDNS");
case "ping":
return "Hostname/IP";
case "tcp":
return "Hostname/IP";
default:
- return "Target URL/Host";
+ return t("targetDefault");
}
};
@@ -99,7 +101,7 @@ export function ServiceUrlField({ form }: ServiceUrlFieldProps) {
/>
- Enter the port number for TCP connection test
+ {t("targetTCPPortDesc")}
diff --git a/application/src/components/services/add-service/types.ts b/application/src/components/services/add-service/types.ts
index 4269a42..d3f8033 100644
--- a/application/src/components/services/add-service/types.ts
+++ b/application/src/components/services/add-service/types.ts
@@ -1,22 +1,42 @@
-
import { z } from "zod";
+import type { ZodSchema } from "zod";
+import { useLanguage } from "@/contexts/LanguageContext";
-export const serviceSchema = z.object({
- name: z.string().min(1, "Service name is required"),
- type: z.enum(["http", "ping", "tcp", "dns"]),
- url: z.string().min(1, "URL/Domain/Host is required").refine((value) => {
- // Basic validation - more specific validation can be added per type
- return value.trim().length > 0;
- }, "Please enter a valid URL, hostname, or domain"),
- port: z.string().optional(),
- interval: z.string(),
- retries: z.string(),
- notificationStatus: z.enum(["enabled", "disabled"]).optional(),
- notificationChannels: z.array(z.string()).optional(),
- alertTemplate: z.string().optional(),
- // Regional monitoring fields - now supports multiple agents
- regionalMonitoringEnabled: z.boolean().optional(),
- regionalAgents: z.array(z.string()).optional(),
-});
-export type ServiceFormData = z.infer;
\ No newline at end of file
+export type ServiceFormData = {
+ name: string;
+ type: "http" | "ping" | "tcp" | "dns";
+ url: string;
+ port?: string;
+ interval: string;
+ retries: string;
+ notificationStatus?: "enabled" | "disabled";
+ notificationChannels?: string[];
+ alertTemplate?: string;
+ regionalMonitoringEnabled?: boolean;
+ regionalAgents?: string[];
+};
+
+// Hook to use the schema with translations
+export const useServiceSchema = () => {
+ const { t } = useLanguage();
+ return z.object({
+ name: z.string().min(1, t("serviceNameRequired")),
+ type: z.enum(["http", "ping", "tcp", "dns"]),
+ url: z.string()
+ .min(1, t("urlDomainHostRequired"))
+ .refine(
+ (value) => value.trim().length > 0,
+ t("enterValidUrlHostnameDomain")
+ ),
+ port: z.string().optional(),
+ interval: z.string(),
+ retries: z.string(),
+ notificationStatus: z.enum(["enabled", "disabled"]).optional(),
+ notificationChannels: z.array(z.string()).optional(),
+ alertTemplate: z.string().optional(),
+ // Regional monitoring fields - now supports multiple agents
+ regionalMonitoringEnabled: z.boolean().optional(),
+ regionalAgents: z.array(z.string()).optional(),
+ });
+};
\ No newline at end of file
diff --git a/application/src/components/settings/about-system/AboutSystem.tsx b/application/src/components/settings/about-system/AboutSystem.tsx
index 677d2dd..e3fc5ec 100644
--- a/application/src/components/settings/about-system/AboutSystem.tsx
+++ b/application/src/components/settings/about-system/AboutSystem.tsx
@@ -1,50 +1,293 @@
-import React, { useEffect, useState } from 'react';
-import { format } from 'date-fns';
-import {
- Card, CardContent, CardDescription, CardHeader, CardTitle,
-} from "@/components/ui/card";
+import React, { useState } from 'react';
+import { Card, CardContent, CardDescription, CardHeader, CardTitle } from "@/components/ui/card";
import { Separator } from "@/components/ui/separator";
-import {
- Github, FileText, Twitter, MessageCircle, Code2, ServerIcon,
-} from "lucide-react";
+import { Github, FileText, Twitter, MessageCircle, Code2, ServerIcon, FolderOpen, Database, CheckCircle } from "lucide-react";
import { Button } from "@/components/ui/button";
+import { Label } from "@/components/ui/label";
+import { Checkbox } from "@/components/ui/checkbox";
import { useLanguage } from "@/contexts/LanguageContext";
import { useTheme } from "@/contexts/ThemeContext";
import { useSystemSettings } from "@/hooks/useSystemSettings";
+import { pb } from "@/lib/pocketbase";
+import { toast } from "@/components/ui/use-toast";
export const AboutSystem: React.FC = () => {
const { t } = useLanguage();
const { theme } = useTheme();
const { systemName } = useSystemSettings();
+ const [isImporting, setIsImporting] = useState(false);
+ const [mergeFields, setMergeFields] = useState(true);
+ const [importResult, setImportResult] = useState<{
+ success: boolean;
+ created: number;
+ updated: number;
+ skipped: number;
+ } | null>(null);
- const [version, setVersion] = useState('...');
- const [releaseDate, setReleaseDate] = useState('...');
+ // Helper function to check if a collection is a system collection
+ const isSystemCollection = (name: string): boolean => {
+ return name.startsWith('_') || ['users'].includes(name);
+ };
- useEffect(() => {
- const fetchLatestRelease = async () => {
- try {
- const res = await fetch('https://api.github.com/repos/operacle/checkcle/releases/latest');
- const data = await res.json();
- setVersion(data.tag_name || 'v1.x.x');
- setReleaseDate(data.published_at ? format(new Date(data.published_at), 'MMMM d, yyyy') : t('unknown'));
- } catch (err) {
- setVersion('v1.x.x');
- setReleaseDate(t('unknown'));
+ // Helper function to validate collection schema
+ const validateCollectionSchema = (collection: any): string | null => {
+ if (!collection.name) return "Collection name is required";
+ if (typeof collection.name !== 'string') return "Collection name must be a string";
+ if (!/^[a-z][a-z0-9_]*$/.test(collection.name)) {
+ return "Collection name must start with a letter and contain only lowercase letters, numbers, and underscores";
+ }
+ if (collection.name.length < 3 || collection.name.length > 32) {
+ return "Collection name must be between 3 and 32 characters";
+ }
+
+ // Validate schema array if present
+ if (collection.schema && !Array.isArray(collection.schema)) {
+ return "Collection schema must be an array";
+ }
+
+ // Validate each field in the schema
+ if (collection.schema) {
+ for (const field of collection.schema) {
+ if (!field.name || typeof field.name !== 'string') {
+ return `Invalid field name in collection '${collection.name}'`;
+ }
+ if (!field.type || typeof field.type !== 'string') {
+ return `Invalid field type for '${field.name}' in collection '${collection.name}'`;
+ }
}
- };
- fetchLatestRelease();
- }, [t]);
+ }
+
+ return null;
+ };
+
+ const handleSchemaImport = async (schemaData: string) => {
+ if (!schemaData.trim()) {
+ toast({
+ title: "Error",
+ description: "No schema data provided",
+ variant: "destructive",
+ });
+ return;
+ }
+
+ try {
+ setIsImporting(true);
+ setImportResult(null);
+
+ // Parse the JSON to validate it
+ const collections = JSON.parse(schemaData);
+
+ if (!Array.isArray(collections)) {
+ throw new Error("Schema must be an array of collections");
+ }
+
+ // Check if user is authenticated as admin
+ if (!pb.authStore.isValid) {
+ throw new Error("Authentication required. Please log in as an admin.");
+ }
+ // Create/update collections one by one using PocketBase client
+ let successCount = 0;
+ let errorCount = 0;
+ let updatedCount = 0;
+ let skippedCount = 0;
+ const errors = [];
+
+ for (const collection of collections) {
+ try {
+ // Skip system collections
+ if (isSystemCollection(collection.name)) {
+ skippedCount++;
+ continue;
+ }
+
+ // Validate collection schema
+ const validationError = validateCollectionSchema(collection);
+ if (validationError) {
+ throw new Error(validationError);
+ }
+ // Check if collection already exists
+ const existingCollections = await pb.collections.getFullList();
+ const existingCollection = existingCollections.find(c => c.name === collection.name);
+
+ if (existingCollection) {
+ if (mergeFields) {
+
+ try {
+ // Get existing schema
+ const existingSchema = existingCollection.schema || [];
+ const newSchema = collection.schema || [];
+ // Merge schemas - add new fields, keep existing ones
+ const mergedSchema = [...existingSchema];
+ let fieldsAdded = 0;
+
+ for (const newField of newSchema) {
+ const existingFieldIndex = mergedSchema.findIndex(f => f.name === newField.name);
+ if (existingFieldIndex >= 0) {
+ } else {
+ // Add new field
+ mergedSchema.push(newField);
+ fieldsAdded++;
+ }
+ }
+
+ // Update the collection with merged schema
+ const updateData = {
+ ...collection,
+ schema: mergedSchema
+ };
+
+ const updatedCollection = await pb.collections.update(existingCollection.id, updateData);
+ updatedCount++;
+ } catch (mergeError) {
+ throw new Error(`Failed to merge fields: ${mergeError.message || mergeError}`);
+ }
+ } else {
+ skippedCount++;
+ continue;
+ }
+ } else {
+ // Create new collection
+ try {
+ const newCollection = await pb.collections.create(collection);
+ successCount++;
+ } catch (createError) {
+
+ // Extract more detailed error information
+ let errorMessage = createError.message || createError;
+ if (createError.data) {
+ // Try to extract field-specific errors
+ if (createError.data.data) {
+ const fieldErrors = Object.entries(createError.data.data).map(([field, msgs]) =>
+ `${field}: ${Array.isArray(msgs) ? msgs.join(', ') : msgs}`
+ ).join('; ');
+ if (fieldErrors) {
+ errorMessage += ` - Field errors: ${fieldErrors}`;
+ }
+ }
+ }
+
+ throw new Error(`Failed to create collection: ${errorMessage}`);
+ }
+ }
+ } catch (error) {
+ errorCount++;
+ const errorMsg = `Failed to process collection '${collection.name}': ${error.message || error}`;
+ errors.push(errorMsg);
+ }
+ }
+ // Set import result for display
+ setImportResult({
+ success: successCount + updatedCount > 0,
+ created: successCount,
+ updated: updatedCount,
+ skipped: skippedCount
+ });
+
+ // Show results
+ const totalProcessed = successCount + updatedCount;
+ if (totalProcessed > 0 || skippedCount > 0) {
+ let description = '';
+ if (totalProcessed > 0) {
+ description = `Successfully processed ${totalProcessed} collection(s)`;
+ if (successCount > 0) description += ` (${successCount} created)`;
+ if (updatedCount > 0) description += ` (${updatedCount} updated)`;
+ }
+ if (skippedCount > 0) {
+ if (description) description += `, `;
+ description += `${skippedCount} skipped (system collections or existing)`;
+ }
+ if (errorCount > 0) description += `. ${errorCount} failed.`;
+
+ toast({
+ title: "Import Complete",
+ description,
+ variant: totalProcessed > errorCount ? "default" : "destructive",
+ });
+ } else if (errorCount > 0) {
+ toast({
+ title: "Import Failed",
+ description: "No collections were processed successfully.",
+ variant: "destructive",
+ });
+ } else {
+ toast({
+ title: "No Changes",
+ description: "All collections already exist and no changes were made.",
+ variant: "default",
+ });
+ }
+
+ if (errors.length > 0) {
+ // Show detailed errors for debugging
+ if (errors.length <= 3) {
+ toast({
+ title: "Detailed Errors",
+ description: errors.join('; '),
+ variant: "destructive",
+ });
+ }
+ }
+
+ } catch (error) {
+ toast({
+ title: "Import Failed",
+ description: error instanceof Error ? error.message : "Failed to import schema",
+ variant: "destructive",
+ });
+ setImportResult({
+ success: false,
+ created: 0,
+ updated: 0,
+ skipped: 0
+ });
+ } finally {
+ setIsImporting(false);
+ }
+ };
+
+ const handleLoadLocalSchema = async () => {
+ try {
+ setIsImporting(true);
+ setImportResult(null);
+
+ const response = await fetch('/upload/data/pb_schema_latest.json');
+
+ if (!response.ok) {
+ throw new Error(`Failed to load local schema: ${response.status} ${response.statusText}`);
+ }
+
+ const schemaText = await response.text();
+
+ // Validate that it's valid JSON
+ JSON.parse(schemaText);
+
+ // Directly import the schema
+ await handleSchemaImport(schemaText);
+
+ } catch (error) {
+ toast({
+ title: "Import Failed",
+ description: error instanceof Error ? error.message : "Failed to load and import local schema file",
+ variant: "destructive",
+ });
+ setImportResult({
+ success: false,
+ created: 0,
+ updated: 0,
+ skipped: 0
+ });
+ setIsImporting(false);
+ }
+ };
return (
-
+
-
+
@@ -58,7 +301,7 @@ export const AboutSystem: React.FC = () => {
{t('systemVersion')}
- {version}
+ {t('version')} 1.5.1
@@ -68,22 +311,20 @@ export const AboutSystem: React.FC = () => {
{t('releasedOn')}
- {releaseDate}
+ Auguest 21, 2025
-
+
{t('links')}
-
- {systemName || 'CheckCle'} {t('resources').toLowerCase()}
-
+ {systemName || 'CheckCle'} {t('resources').toLowerCase()}
@@ -107,8 +348,90 @@ export const AboutSystem: React.FC = () => {
+
+
+
+
+
+
+
+ Update Schema
+
+ Automatic import collections schema
+
+
+
+
+ setMergeFields(checked === true)}
+ />
+
+
+
+
+
+
+
+
+ {importResult && (
+
+
+
+
+ {importResult.success ? 'Import Successful' : 'Import Failed'}
+
+
+
+ {importResult.created > 0 && `${importResult.created} collections created`}
+ {importResult.updated > 0 && (importResult.created > 0 ? ', ' : '') + `${importResult.updated} collections updated`}
+ {importResult.skipped > 0 && ((importResult.created > 0 || importResult.updated > 0) ? ', ' : '') + `${importResult.skipped} collections skipped`}
+
+
+ )}
+
+
+
+ Instructions:
+
+
+ - Merge fields: Safely add new fields to existing collections, preserves all data
+ - System collections (starting with _) and users collection will be skipped automatically
+ - Only authenticated admins can perform schema imports
+
+
+
+
);
};
-export default AboutSystem;
+export default AboutSystem;
\ No newline at end of file
diff --git a/application/src/components/settings/data-retention/DataRetentionSettings.tsx b/application/src/components/settings/data-retention/DataRetentionSettings.tsx
index 15c1d58..5aa246b 100644
--- a/application/src/components/settings/data-retention/DataRetentionSettings.tsx
+++ b/application/src/components/settings/data-retention/DataRetentionSettings.tsx
@@ -170,7 +170,7 @@ const DataRetentionSettings = () => {
- Permission Notice: As an admin user, you do not have access to data retention settings. These settings can only be accessed and modified by Super Admins.
+ {t("permissionNotice")} As an admin user, you do not have access to data retention settings. These settings can only be accessed and modified by Super Admins.
diff --git a/application/src/components/settings/general/GeneralSettingsPanel.tsx b/application/src/components/settings/general/GeneralSettingsPanel.tsx
index b990634..70019d3 100644
--- a/application/src/components/settings/general/GeneralSettingsPanel.tsx
+++ b/application/src/components/settings/general/GeneralSettingsPanel.tsx
@@ -143,7 +143,7 @@ const GeneralSettingsPanel: React.FC
= () => {
- Permission Notice: As an admin user, you do not have access to view or modify system and mail settings. These settings can only be accessed and modified by Super Admins. Contact your Super Admin if you need to make changes to system configuration or mail settings.
+ {t("permissionNotice")} {t("permissionNoticeAddUser")}
@@ -153,11 +153,11 @@ const GeneralSettingsPanel: React.FC = () => {
}
if (isLoading) {
- return Loading settings...
;
+ return {t("loadingSettings")}
;
}
if (error) {
- return Error loading settings
;
+ return {t("loadingSettingsError")}
;
}
return (
diff --git a/application/src/components/settings/notification-settings/NotificationChannelDialog.tsx b/application/src/components/settings/notification-settings/NotificationChannelDialog.tsx
index 87ce90a..7b20f9f 100644
--- a/application/src/components/settings/notification-settings/NotificationChannelDialog.tsx
+++ b/application/src/components/settings/notification-settings/NotificationChannelDialog.tsx
@@ -36,7 +36,7 @@ interface NotificationChannelDialogProps {
const baseSchema = z.object({
notify_name: z.string().min(1, "Name is required"),
- notification_type: z.enum(["telegram", "discord", "slack", "signal", "google_chat", "email", "webhook"]),
+ notification_type: z.enum(["telegram", "discord", "slack", "signal", "google_chat", "email", "ntfy", "pushover", "webhook"]),
enabled: z.boolean().default(true),
service_id: z.string().default("global"),
template_id: z.string().optional(),
@@ -78,12 +78,23 @@ const emailSchema = baseSchema.extend({
smtp_password: z.string().min(1, "SMTP password is required"),
});
+const ntfySchema = baseSchema.extend({
+ notification_type: z.literal("ntfy"),
+ ntfy_endpoint: z.string().url("Must be a valid NTFY endpoint URL"),
+});
+
const webhookSchema = baseSchema.extend({
notification_type: z.literal("webhook"),
webhook_url: z.string().url("Must be a valid URL"),
webhook_payload_template: z.string().optional(),
});
+const pushoverSchema = baseSchema.extend({
+ notification_type: z.literal("pushover"),
+ api_token: z.string().min(1, "API token is required"),
+ user_key: z.string().min(1, "User key is required"),
+});
+
const formSchema = z.discriminatedUnion("notification_type", [
telegramSchema,
discordSchema,
@@ -91,7 +102,9 @@ const formSchema = z.discriminatedUnion("notification_type", [
signalSchema,
googleChatSchema,
emailSchema,
- webhookSchema
+ ntfySchema,
+ pushoverSchema,
+ webhookSchema,
]);
type FormValues = z.infer;
@@ -133,6 +146,18 @@ const notificationTypeOptions = [
description: "Send notifications via email",
icon: "/upload/notification/email.png"
},
+ {
+ value: "ntfy",
+ label: "NTFY",
+ description: "Send notifications via NTFY push service",
+ icon: "/upload/notification/ntfy.png"
+ },
+ {
+ value: "pushover",
+ label: "Pushover",
+ description: "Send push notifications via Pushover",
+ icon: "/upload/notification/pushover.png"
+ },
{
value: "webhook",
label: "Webhook",
@@ -540,6 +565,62 @@ export const NotificationChannelDialog = ({
>
)}
+ {notificationType === "ntfy" && (
+ (
+
+ NTFY Endpoint
+
+
+
+
+ The NTFY endpoint URL including your topic (e.g., https://ntfy.sh/checkcle)
+
+
+
+ )}
+ />
+ )}
+
+ {notificationType === "pushover" && (
+ <>
+ (
+
+ API Token
+
+
+
+
+ Your Pushover application API token
+
+
+
+ )}
+ />
+ (
+
+ User Key
+
+
+
+
+ Your Pushover user key (or group key)
+
+
+
+ )}
+ />
+ >
+ )}
+
{notificationType === "webhook" && (
<>
{
+ const { t } = useLanguage();
const {
users,
loading,
@@ -44,21 +47,21 @@ const UserManagement = () => {
- User Management
+ {t("userManagement")}
-
User Management
+ {t("userManagement")}
{isSuperAdmin && }
{!isSuperAdmin &&
- Permission Notice: As an admin user, you have access to view and modify existing user details. However, only Super Admins have permission to create new user accounts. Contact your Super Admin if you need to add a new user.
+ {t("permissionNotice")} As an admin user, you have access to view and modify existing user details. However, only Super Admins have permission to create new user accounts. Contact your Super Admin if you need to add a new user.
}
diff --git a/application/src/contexts/LanguageContext.tsx b/application/src/contexts/LanguageContext.tsx
index b70f3dc..4419d86 100644
--- a/application/src/contexts/LanguageContext.tsx
+++ b/application/src/contexts/LanguageContext.tsx
@@ -1,4 +1,4 @@
-import React, { createContext, useContext, useState, ReactNode } from "react";
+import React, { createContext, useContext, useState, ReactNode, useCallback } from "react";
import { translations, Language, TranslationModule, TranslationKey } from "@/translations";
type LanguageContextType = {
@@ -21,27 +21,39 @@ export const useLanguage = () => {
export const LanguageProvider = ({ children }: { children: ReactNode }) => {
const [language, setLanguage] = useState("en");
+ const fallbackLanguage: Language = "en";
- const t = (key: string, module?: M): string => {
+ const t = useCallback((key: string, module?: M): string => {
+ const langPack = translations[language];
+ const fallbackPack = translations[fallbackLanguage];
if (module) {
- const translatedValue = translations[language][module][key as TranslationKey];
- return typeof translatedValue === "string" ? translatedValue : key;
+ const valCur = langPack?.[module]?.[key as TranslationKey];
+ if (typeof valCur === "string") return valCur;
+
+ const valEn = fallbackPack?.[module]?.[key as TranslationKey];
+ if (typeof valEn === "string") return valEn;
+
+ return key;
}
- for (const mod in translations[language]) {
- const moduleKey = mod as TranslationModule;
- const translatedValue = translations[language][moduleKey][key as any];
- if (translatedValue && typeof translatedValue === "string") {
- return translatedValue;
- }
+ for (const mod in langPack) {
+ const m = mod as TranslationModule;
+ const val = langPack[m]?.[key as any];
+ if (typeof val === "string") return val;
+ }
+
+ for (const mod in fallbackPack) {
+ const m = mod as TranslationModule;
+ const val = fallbackPack[m]?.[key as any];
+ if (typeof val === "string") return val;
}
return key;
- };
+ }, [language]);
return (
{children}
);
-};
+};
\ No newline at end of file
diff --git a/application/src/services/alertConfigService.ts b/application/src/services/alertConfigService.ts
index 7dff9e5..83a702c 100644
--- a/application/src/services/alertConfigService.ts
+++ b/application/src/services/alertConfigService.ts
@@ -7,7 +7,7 @@ export interface AlertConfiguration {
collectionId?: string;
collectionName?: string;
service_id: string;
- notification_type: "telegram" | "discord" | "slack" | "signal" | "google_chat" | "email" | "webhook";
+ notification_type: "telegram" | "discord" | "slack" | "signal" | "google_chat" | "email" | "ntfy" | "pushover" | "webhook";
telegram_chat_id?: string;
discord_webhook_url?: string;
signal_number?: string;
@@ -28,7 +28,9 @@ export interface AlertConfiguration {
smtp_password?: string;
webhook_id?: string;
channel_id?: string;
- // Webhook fields for alert_configurations
+ ntfy_endpoint?: string;
+ api_token?: string;
+ user_key?: string;
webhook_url?: string;
webhook_payload_template?: string;
}
@@ -82,9 +84,15 @@ export const alertConfigService = {
cleanConfig.smtp_server = config.smtp_server || "";
cleanConfig.smtp_port = config.smtp_port || "";
cleanConfig.smtp_password = config.smtp_password || "";
+
+ } else if (config.notification_type === "ntfy") {
+ cleanConfig.ntfy_endpoint = config.ntfy_endpoint || "";
- } else if (config.notification_type === "webhook") {
+ } else if (config.notification_type === "pushover") {
+ cleanConfig.api_token = config.api_token || "";
+ cleanConfig.user_key = config.user_key || "";
+ } else if (config.notification_type === "webhook") {
cleanConfig.webhook_url = config.webhook_url || "";
cleanConfig.webhook_payload_template = config.webhook_payload_template || "";
diff --git a/application/src/services/incident/incidentOperations.ts b/application/src/services/incident/incidentOperations.ts
index c19905a..8166389 100644
--- a/application/src/services/incident/incidentOperations.ts
+++ b/application/src/services/incident/incidentOperations.ts
@@ -56,7 +56,9 @@ export const createIncident = async (data: CreateIncidentInput): Promise =
affected_systems: data.affected_systems,
priority: data.priority.toLowerCase(),
service_id: data.service_id || '',
- assigned_to: data.assigned_to || '', // Direct user ID assignment
+ //assigned_to: data.assigned_to || '', // Direct user ID assignment
+ //2025-08-18: // map UI field -> server schema
+ assigned_users: typeof data.assigned_to === 'string' ? data.assigned_to : '',
root_cause: data.root_cause || '',
resolution_steps: data.resolution_steps || '',
lessons_learned: data.lessons_learned || '',
@@ -82,28 +84,41 @@ export const createIncident = async (data: CreateIncidentInput): Promise =
export const updateIncident = async (id: string, data: Partial): Promise => {
try {
console.log(`Updating incident ${id} with:`, data);
-
- // Make sure impact and priority are lowercase
- const payload = {
+
+ const payload: Record = {
...data,
- impact: data.impact?.toLowerCase(),
- priority: data.priority?.toLowerCase(),
- status: data.status ? formatStatus(data.status) : undefined,
- impact_status: data.status ? data.status.toLowerCase() : undefined,
- ...(data.status?.toLowerCase() === 'resolved' && !data.resolution_time
- ? { resolution_time: new Date().toISOString() }
- : {})
+ ...(data.impact ? { impact: data.impact.toLowerCase() } : {}),
+ ...(data.priority ? { priority: data.priority.toLowerCase() } : {}),
+ ...(data.status
+ ? {
+ status: formatStatus(data.status),
+ impact_status: data.status.toLowerCase(),
+ }
+ : {}),
+ // set only if assigned_to was provided
+ ...(typeof data.assigned_to === 'string'
+ ? {
+ assigned_users: data.assigned_to, // server field
+ assigned_to: data.assigned_to, // legacy field for backward compatibility
+ }
+ : {}),
+ // add resolution_time only if status changes to resolved
+ ...((data.status?.toLowerCase() === 'resolved' && !data.resolution_time)
+ ? { resolution_time: new Date().toISOString() }
+ : {}),
};
-
+
console.log("Final payload for update:", payload);
await pb.collection('incidents').update(id, payload);
-
+
// Invalidate cache after update
invalidateCache();
-
+
console.log(`Incident ${id} updated successfully`);
} catch (error) {
console.error('Error updating incident:', error);
throw error;
}
};
+
+
diff --git a/application/src/services/incident/pdf/generator.ts b/application/src/services/incident/pdf/generator.ts
index 5ce2ffd..d69b2a1 100644
--- a/application/src/services/incident/pdf/generator.ts
+++ b/application/src/services/incident/pdf/generator.ts
@@ -1,6 +1,7 @@
import jsPDF from 'jspdf';
import { IncidentItem } from '../types';
+import { userService } from '@/services/userService';
import {
addBasicInfoSection,
addDescriptionSection,
@@ -22,6 +23,18 @@ export const generatePdf = async (incident: IncidentItem): Promise => {
throw new Error('Invalid incident data');
}
+ // Fetch assigned user data if available
+ let assignedUser: { full_name?: string; username?: string } | null = null;
+ const assigneeId = incident?.assigned_users || incident?.assigned_to;
+ if (assigneeId) {
+ try {
+ assignedUser = await userService.getUser(assigneeId);
+ } catch (error) {
+ console.warn('Failed to fetch assigned user for PDF:', error);
+ // Continue without user data
+ }
+ }
+
try {
// Create new PDF document with portrait orientation
const doc = new jsPDF({
@@ -85,7 +98,7 @@ export const generatePdf = async (incident: IncidentItem): Promise => {
}
// Add assignment section
- yPos = addAssignmentSection(doc, incident, yPos);
+ yPos = addAssignmentSection(doc, incident, yPos, assignedUser);
// Check if we need to add a new page
if (yPos > 250) {
diff --git a/application/src/services/incident/pdf/sections.ts b/application/src/services/incident/pdf/sections.ts
index a3ee403..59c43cf 100644
--- a/application/src/services/incident/pdf/sections.ts
+++ b/application/src/services/incident/pdf/sections.ts
@@ -146,7 +146,7 @@ export const addResolutionSection = (doc: jsPDF, incident: IncidentItem, yPos: n
/**
* Add the assignment information section to the PDF
*/
-export const addAssignmentSection = (doc: jsPDF, incident: IncidentItem, yPos: number): number => {
+export const addAssignmentSection = (doc: jsPDF, incident: IncidentItem, yPos: number, assignedUser?: { full_name?: string; username?: string } | null): number => {
doc.setFontSize(14);
doc.setTextColor(30, 64, 175); // Blue-800
doc.text('Assignment Information', 15, yPos);
@@ -158,8 +158,16 @@ export const addAssignmentSection = (doc: jsPDF, incident: IncidentItem, yPos: n
yPos += 10;
doc.setFontSize(10);
doc.setTextColor(0, 0, 0);
- const assignedTo = incident.assigned_to || 'Not assigned';
- doc.text(`Assigned to: ${assignedTo}`, 15, yPos);
+
+ if (assignedUser) {
+ // Show user name if available
+ const userName = assignedUser.full_name || assignedUser.username || 'Unknown User';
+ doc.text(`Assigned to: ${userName}`, 15, yPos);
+ } else {
+ // Fallback to ID if no user data available
+ const assignedTo = incident.assigned_users || incident.assigned_to || 'Not assigned';
+ doc.text(`Assigned to: ${assignedTo}`, 15, yPos);
+ }
return yPos + 10;
};
diff --git a/application/src/services/incident/types.ts b/application/src/services/incident/types.ts
index 0297356..3a4a2ed 100644
--- a/application/src/services/incident/types.ts
+++ b/application/src/services/incident/types.ts
@@ -5,7 +5,8 @@ export type IncidentItem = {
service_id?: string;
timestamp?: string;
description: string;
- assigned_to?: string;
+ assigned_to?: string; // legacy UI field
+ assigned_users?: string; // server field
resolution_time?: string;
impact: string;
affected_systems: string;
@@ -32,7 +33,8 @@ export type CreateIncidentInput = {
affected_systems: string;
priority: string;
service_id?: string;
- assigned_to?: string;
+ assigned_to?: string; // legacy UI field
+ assigned_users?: string; // server field
root_cause?: string;
resolution_steps?: string;
lessons_learned?: string;
@@ -50,7 +52,8 @@ export type UpdateIncidentInput = {
affected_systems?: string;
priority?: string;
service_id?: string;
- assigned_to?: string;
+ assigned_to?: string; // legacy UI field
+ assigned_users?: string; // server field
root_cause?: string;
resolution_steps?: string;
lessons_learned?: string;
diff --git a/application/src/translations/de/about.ts b/application/src/translations/de/about.ts
index ba49c4e..90ea64c 100644
--- a/application/src/translations/de/about.ts
+++ b/application/src/translations/de/about.ts
@@ -2,7 +2,7 @@
import { AboutTranslations } from '../types/about';
export const aboutTranslations: AboutTranslations = {
- aboutCheckcle: "Über Checkcle",
+ aboutCheckCle: "Über Checkcle",
systemDescription: "Checkcle ist ein Open-Source-Überwachungs-Stack, der Echtzeit-Einblicke in Server- und Dienstzustände, Vorfallmanagement und operative Transparenz bietet. Veröffentlicht unter der MIT-Lizenz.",
systemVersion: "Systemversion",
license: "Lizenz",
@@ -15,6 +15,7 @@ export const aboutTranslations: AboutTranslations = {
quickActions: "Schnelle Aktionen",
quickActionsDescription: "Greifen Sie schnell auf gängige Überwachungsvorgänge und -funktionen zu. Wählen Sie unten eine Aktion aus, um loszulegen.",
quickTips: "Schnelle Tipps",
+ releasedOn: "Veröffentlicht",
};
diff --git a/application/src/translations/de/common.ts b/application/src/translations/de/common.ts
index 070ace3..0b2f409 100644
--- a/application/src/translations/de/common.ts
+++ b/application/src/translations/de/common.ts
@@ -6,9 +6,11 @@ export const commonTranslations: CommonTranslations = {
logout: "Abmelden",
language: "Sprache",
english: "Englisch",
- khmer: "Khmer",
+ khmer: "ភាសាខ្មែរ",
german: "Deutsch",
- simplifiedChinese: "Simplified Chinese",
+ korean: "한국어",
+ japanese: "日本語",
+ simplifiedChinese: "简体中文",
goodMorning: "Guten Morgen",
goodAfternoon: "Guten Nachmittag",
goodEvening: "Guten Abend",
diff --git a/application/src/translations/de/incident.ts b/application/src/translations/de/incident.ts
index 9236dab..7fe6348 100644
--- a/application/src/translations/de/incident.ts
+++ b/application/src/translations/de/incident.ts
@@ -51,4 +51,13 @@ export const incidentTranslations: IncidentTranslations = {
configuration: 'Konfiguration',
failedToUpdateStatus: 'Fehler beim Aktualisieren des Status',
inProgress: 'In Bearbeitung',
+ enterRootCause: 'Grundursache eingeben',
+ enterIncidentTitle: 'Vorfalltitel eingeben',
+ enterIncidentDescription: 'Vorfallbeschreibung eingeben',
+ enterServiceId: 'Service-IDs durch Komma getrennt eingeben',
+ selectAssignedUser: 'Zugewiesenen Benutzer auswählen',
+ noAssignedUser: 'Der Vorfall ist derzeit keinem Benutzer zugewiesen',
+ affectedSystems: 'Betroffene Systeme',
+ enterAffectedSystems: 'Betroffene Systeme eingeben',
+ separateSystemsWithComma: 'Betroffene Systeme durch Komma getrennt eingeben',
};
diff --git a/application/src/translations/de/maintenance.ts b/application/src/translations/de/maintenance.ts
index 0b7caf3..6e40b11 100644
--- a/application/src/translations/de/maintenance.ts
+++ b/application/src/translations/de/maintenance.ts
@@ -64,4 +64,17 @@ export const maintenanceTranslations: MaintenanceTranslations = {
noScheduledMaintenance: 'Keine geplanten Wartungen',
noMaintenanceWindows: 'Für diesen Zeitraum sind keine Wartungsfenster vorhanden. Erstellen Sie eines über die Schaltfläche „Wartung erstellen“.',
maintenanceCreatedSuccess: 'Wartungsfenster erfolgreich erstellt',
+ editMaintenanceWindow: 'Wartung bearbeiten',
+ editMaintenanceDesc: 'Wartungsdetails bearbeiten',
+ priorityDescription: 'Wartungspriorität auswählen',
+ statusDescription: 'Wartungsstatus auswählen',
+ impactLevel: 'Auswirkungsgrad',
+ impactLevelDescription: 'Auswirkungsgrad auswählen',
+ selectAssignedUsers: 'Zugewiesene Benutzer auswählen',
+ assignedPersonnelDescription: 'Derzeit zugewiesene Benutzer',
+ mutedNotifications: 'Benachrichtigungen deaktiviert',
+ notificationsAreMuted: 'Benachrichtigungen sind für diese Wartung derzeit deaktiviert',
+ selectNotificationChannel: 'Benachrichtigungskanal hinzufügen',
+ enableNotificationsFirst: 'Aktivieren Sie zuerst Benachrichtigungen, um einen Kanal auszuwählen',
+ updateMaintenance: 'Wartung aktualisieren',
};
diff --git a/application/src/translations/de/services.ts b/application/src/translations/de/services.ts
index 0dee15a..0117bec 100644
--- a/application/src/translations/de/services.ts
+++ b/application/src/translations/de/services.ts
@@ -1,13 +1,98 @@
-
import { ServicesTranslations } from '../types/services';
export const servicesTranslations: ServicesTranslations = {
-// Dienst-Tabelle
- serviceName: "Dienstname",
- serviceType: "Diensttyp",
+ // Service Table
serviceStatus: "Dienststatus",
responseTime: "Antwortzeit",
uptime: "Betriebszeit",
lastChecked: "Zuletzt überprüft",
noServices: "Keine Dienste entsprechen Ihren Filterkriterien.",
+ currentlyMonitoring: "Derzeit überwacht",
+ retry: "Wiederholen",
+ overview: "Überblick",
+ newService: "Neuer Dienst",
+ rowsPerPage: "Zeilen pro Seite",
+ search: "Suchen",
+ allTypes: "Alle Arten",
+ createNewService: "Neuen Service hinzufügen",
+ createNewServiceDesc: "Geben Sie detaillierte Informationen ein, um einen neuen zu erstellen, den Sie überwachen möchten.",
+
+ // ServiceBasicFields.tsx
+ serviceName: "Dienstname",
+ serviceNameDesc: "Geben Sie einen aussagekräftigen Namen für Ihren Service ein",
+
+ // ServiceConfigFields.tsx
+ checkInterval: "Prüfintervall",
+ seconds: "Sekunden",
+ minute: "Minute",
+ minutes: "Minuten",
+ hour: "Stunde",
+ hours: "Stunden",
+ custom: "Benutzerdefiniert",
+ checkIntervalPlaceholder: "Intervall in Sekunden eingeben",
+ backToPresets: "Zurück zu Voreinstellungen",
+ checkIntervalDesc: "Wie oft der Dienststatus überprüft werden soll",
+ checkIntervalDescCustom: "Benutzerdefiniertes Intervall in Sekunden eingeben (mindestens 10 Sekunden)",
+ retryAttempts: "Wiederholungsversuche",
+ attempt: "Versuch",
+ attempts: "Versuche",
+ retryAttemptsDesc: "Anzahl der Wiederholungsversuche, bevor der Dienst als ausgefallen markiert wird",
+
+ // ServiceForm.tsx
+ updateService: "Dienst aktualisieren",
+ createService: "Dienst erstellen",
+
+ // ServiceNotificationFields.tsx
+ enableNotifications: "Benachrichtigungen aktivieren",
+ enableNotificationsDesc: "Benachrichtigungen für diesen Dienst aktivieren oder deaktivieren",
+ notificationChannels: "Benachrichtigungskanäle",
+ notificationChannelsEnabledDesc: "Benachrichtigungskanäle für diesen Dienst auswählen",
+ notificationChannelsDesc: "Aktivieren Sie zuerst Benachrichtigungen, um Kanäle auszuwählen",
+ notificationChannelsPlaceholder: "Benachrichtigungskanal hinzufügen",
+ alertTemplate: "Alarmvorlage",
+ alertTemplateLoading: "Lade Vorlagen...",
+ alertTemplatePlaceholder: "Alarmvorlage auswählen",
+ alertTemplateEnabledDesc: "Wählen Sie eine Vorlage für Alarmmeldungen",
+ alertTemplateDesc: "Aktivieren Sie zuerst Benachrichtigungen, um eine Vorlage auszuwählen",
+
+ // ServiceTypeField.tsx
+ serviceType: "Diensttyp",
+ serviceTypeHTTPDesc: "Webseiten und REST-APIs mit HTTP/HTTPS-Protokoll überwachen",
+ serviceTypePINGDesc: "Host-Verfügbarkeit mit PING-Protokoll überwachen",
+ serviceTypeTCPDesc: "TCP-Port-Konnektivität mit TCP-Protokoll überwachen",
+ serviceTypeDNSDesc: "DNS-Auflösung überwachen",
+
+ // ServiceRegionalFields.tsx
+ regionalMonitoring: "Regionale Überwachung",
+ regionalMonitoringDesc: "Diesen Dienst regionalen Überwachungsagenten für verteilte Überwachung zuweisen",
+ regionalAgents: "Regionale Agenten",
+ regionalAgentsLoading: "Lade Agenten...",
+ regionalAgentsAvailablePlaceholder: "Zusätzliche regionale Agenten auswählen...",
+ regionalAgentsAllSelected: "Alle verfügbaren Agenten ausgewählt",
+ regionalAgentsNoAvailable: "Keine regionalen Agenten verfügbar",
+ regionalAgentsNoOnlineAvailable: "Keine regionalen Agenten online verfügbar",
+ regionalAgentsNotFoundMessage: "Keine regionalen Online-Agenten gefunden. Dienste verwenden die Standardüberwachung.",
+ regionalAgentsNotSelectedMessage: "Keine regionalen Agenten ausgewählt. Der Dienst verwendet die Standardüberwachung.",
+
+ // ServiceUrlField.tsx
+ targetDefault: "Ziel-URL/Host",
+ targetDNS: "Domainname",
+ targetHTTPDesc: "Geben Sie die vollständige URL inklusive Protokoll ein (http:// oder https://)",
+ targetPINGDesc: "Geben Sie den Hostnamen oder die IP-Adresse zum Pingen ein",
+ targetTCPDesc: "Geben Sie Hostname oder IP-Adresse für TCP-Verbindungstest ein",
+ targetTCPPortDesc: "Geben Sie die Portnummer für den TCP-Verbindungstest ein",
+ targetDNSDesc: "Domainnamen für DNS-Überwachung eingeben (A, AAAA, MX, etc.)",
+ targetDefaultDesc: "Geben Sie die Ziel-URL oder den Hostnamen für die Überwachung ein",
+ targetDefaultPlaceholder: "URL oder Hostname eingeben",
+
+ // types.ts
+ serviceNameRequired: "Dienstname ist erforderlich",
+ urlDomainHostRequired: "URL/Domain/Host ist erforderlich",
+ enterValidUrlHostnameDomain: "Bitte eine gültige URL, einen Hostnamen oder eine Domain eingeben",
+
+ // Dashboard
+ upServices: "DIENSTE ONLINE",
+ downServices: "DIENSTE OFFLINE",
+ pausedServices: "DIENSTE PAUSIERT",
+ warningServices: "DIENSTE MIT WARNUNG",
};
diff --git a/application/src/translations/de/settings.ts b/application/src/translations/de/settings.ts
index 465087a..1e46f50 100644
--- a/application/src/translations/de/settings.ts
+++ b/application/src/translations/de/settings.ts
@@ -23,7 +23,7 @@ export const settingsTranslations: SettingsTranslations = {
enableTLS: "TLS aktivieren",
localName: "Lokaler Name",
- // Test Email
+ // Test Email
testEmail: "Test Email",
sendTestEmail: "Send test email",
emailTemplate: "Email template",
@@ -47,5 +47,12 @@ export const settingsTranslations: SettingsTranslations = {
testConnection: "Verbindung testen",
testingConnection: "Verbindung wird getestet...",
connectionSuccess: "Verbindung erfolgreich",
- connectionFailed: "Verbindung fehlgeschlagen"
+ connectionFailed: "Verbindung fehlgeschlagen",
+
+ // Ergänzte fehlende Einträge
+ addUser: "Benutzer hinzufügen",
+ permissionNotice: "Berechtigungshinweis:",
+ permissionNoticeAddUser: "Als Admin-Benutzer haben Sie keinen Zugriff auf die Anzeige oder Änderung von System- und E-Mail-Einstellungen. Diese Einstellungen können nur von Super-Admins aufgerufen und geändert werden. Wenden Sie sich an Ihren Super-Admin, wenn Sie Änderungen an der Systemkonfiguration oder den E-Mail-Einstellungen vornehmen müssen.",
+ loadingSettings: "Einstellungen werden geladen...",
+ loadingSettingsError: "Fehler beim Laden der Einstellungen",
};
diff --git a/application/src/translations/de/ssl.ts b/application/src/translations/de/ssl.ts
index 877b4b2..eb51064 100644
--- a/application/src/translations/de/ssl.ts
+++ b/application/src/translations/de/ssl.ts
@@ -112,6 +112,7 @@ export const sslTranslations: SSLTranslations = {
created: "Erstellt",
lastUpdated: "Zuletzt aktualisiert",
lastNotification: "Letzte Benachrichtigung",
- collectionId: "Sammlungs-ID"
+ collectionId: "Sammlungs-ID",
+ noCertificatesFound: "Keine Zertifikate gefunden",
}
diff --git a/application/src/translations/en/about.ts b/application/src/translations/en/about.ts
index 83e4071..ef6ddcc 100644
--- a/application/src/translations/en/about.ts
+++ b/application/src/translations/en/about.ts
@@ -2,7 +2,7 @@
import { AboutTranslations } from '../types/about';
export const aboutTranslations: AboutTranslations = {
- aboutCheckcle: "About Checkcle",
+ aboutCheckCle: "About Checkcle",
systemDescription: "Checkcle is an open-source monitoring stack offering real-time insights into server and service health, incident management, and operational transparency. Released as MIT License.",
systemVersion: "System Version",
license: "License",
@@ -15,4 +15,5 @@ export const aboutTranslations: AboutTranslations = {
quickActions: "Quick Actions",
quickActionsDescription: "Access common monitoring operations and features quickly. Select an action below to get started.",
quickTips: "Quick Tips",
+ releasedOn: "Released On",
};
diff --git a/application/src/translations/en/common.ts b/application/src/translations/en/common.ts
index 4c02002..abda24b 100644
--- a/application/src/translations/en/common.ts
+++ b/application/src/translations/en/common.ts
@@ -5,10 +5,12 @@ export const commonTranslations: CommonTranslations = {
welcome: "Welcome",
logout: "Logout",
language: "Language",
- english: "English",
- khmer: "Khmer",
+ english: "Englisch",
+ khmer: "ភាសាខ្មែរ",
german: "Deutsch",
- simplifiedChinese: "Simplified Chinese",
+ korean: "한국어",
+ japanese: "日本語",
+ simplifiedChinese: "简体中文",
goodMorning: "Good morning",
goodAfternoon: "Good afternoon",
goodEvening: "Good evening",
diff --git a/application/src/translations/en/incident.ts b/application/src/translations/en/incident.ts
index 461babd..7a7943e 100644
--- a/application/src/translations/en/incident.ts
+++ b/application/src/translations/en/incident.ts
@@ -52,4 +52,13 @@ export const incidentTranslations: IncidentTranslations = {
configuration: 'Configuration',
failedToUpdateStatus: 'Failed to update status',
inProgress: 'In Progress',
+ enterRootCause: 'Enter Root Cause',
+ enterIncidentTitle: 'Enter Incident Title',
+ enterIncidentDescription: 'Enter Incident Description',
+ enterServiceId: 'Enter Service-IDs seperated by comma',
+ selectAssignedUser: 'Select Assigned User',
+ noAssignedUser: 'Incident is currently not assigned to any user',
+ affectedSystems: 'Affected Systems',
+ enterAffectedSystems: 'Enter Affected Systems',
+ separateSystemsWithComma: 'Enter affected systems seperated by comma',
};
diff --git a/application/src/translations/en/maintenance.ts b/application/src/translations/en/maintenance.ts
index c056eea..4d8563f 100644
--- a/application/src/translations/en/maintenance.ts
+++ b/application/src/translations/en/maintenance.ts
@@ -65,4 +65,17 @@ export const maintenanceTranslations: MaintenanceTranslations = {
noScheduledMaintenance: 'No Scheduled Maintenance',
noMaintenanceWindows: 'There are no maintenance windows for this period. Create one by clicking the "Create Maintenance" button.',
maintenanceCreatedSuccess: 'Maintenance window created successfully',
+ editMaintenanceWindow: 'Edit Maintenance',
+ editMaintenanceDesc: 'Edit maintenance details',
+ priorityDescription: 'Select maintenance priority',
+ statusDescription: 'Select maintenance status',
+ impactLevel: 'Impact Level',
+ impactLevelDescription: 'Select impact level',
+ selectAssignedUsers: 'Select Assigned Users',
+ assignedPersonnelDescription: 'Currently assigned users',
+ mutedNotifications: 'Notifications disabled',
+ notificationsAreMuted: 'Notifications are currently muted for this maintenance',
+ selectNotificationChannel: 'Add a notification channel',
+ enableNotificationsFirst: 'Enable notifications first to select channel',
+ updateMaintenance: 'Update Maintenance',
};
diff --git a/application/src/translations/en/services.ts b/application/src/translations/en/services.ts
index 5501bd1..3058a85 100644
--- a/application/src/translations/en/services.ts
+++ b/application/src/translations/en/services.ts
@@ -2,11 +2,97 @@
import { ServicesTranslations } from '../types/services';
export const servicesTranslations: ServicesTranslations = {
- serviceName: "Service Name",
- serviceType: "Service Type",
serviceStatus: "Service Status",
responseTime: "Response Time",
uptime: "Uptime",
lastChecked: "Last Checked",
noServices: "No services match your filter criteria.",
-};
+ currentlyMonitoring: "Currently Monitoring",
+ retry: "Retry",
+ overview: "Overview",
+ newService: "NewService",
+ rowsPerPage: "Rows Per Page",
+ search: "Search",
+ allTypes: "All Types",
+ createNewService: "Create New Service",
+ createNewServiceDesc: "Fill in the details to create a new service to monitor.",
+
+ // ServiceBasicFields.tsx
+ serviceName: "Service Name",
+ serviceNameDesc: "Enter a descriptive name for your service",
+
+ // ServiceConfigFields.tsx
+ checkInterval: "Check Interval",
+ seconds: "seconds",
+ minute: "minute",
+ minutes: "minutes",
+ hour: "hour",
+ hours: "hours",
+ custom: "Custom",
+ checkIntervalPlaceholder: "Enter interval in seconds",
+ backToPresets: "Back to presets",
+ checkIntervalDesc: "How often to check the service status",
+ checkIntervalDescCustom: "Enter custom interval in seconds (minimum 10 seconds)",
+ retryAttempts: "Retry Attempts",
+ attempt: "attempt",
+ attempts: "attempts",
+ retryAttemptsDesc: "Number of retry attempts before marking as down",
+
+ // ServiceForm.tsx
+ updateService: "Update Service",
+ createService: "Create Service",
+
+ // ServiceNotificationFields.tsx
+ enableNotifications: "Enable Notifications",
+ enableNotificationsDesc: "Enable or disable notifications for this service",
+ notificationChannels: "Notification Channels",
+ notificationChannelsEnabledDesc: "Select notification channels for this service",
+ notificationChannelsDesc: "Enable notifications first to select channels",
+ notificationChannelsPlaceholder: "Add a notification channel",
+ alertTemplate: "Alert Template",
+ alertTemplateLoading: "Loading templates...",
+ alertTemplatePlaceholder: "Select an alert template",
+ alertTemplateEnabledDesc: "Choose a template for alert messages",
+ alertTemplateDesc: "Enable notifications first to select template",
+
+ // ServiceTypeField.tsx
+ serviceType: "Service Type",
+ serviceTypeHTTPDesc: "Monitor websites and REST APIs with HTTP/HTTPS Protocol",
+ serviceTypePINGDesc: "Monitor host availability with PING Protocol",
+ serviceTypeTCPDesc: "Monitor TCP port connectivity with TCP Protocol",
+ serviceTypeDNSDesc: "Monitor DNS resolution",
+
+ // ServiceRegionalFields.tsx
+ regionalMonitoring: "Regional Monitoring",
+ regionalMonitoringDesc: "Assign this service to regional monitoring agents for distributed monitoring",
+ regionalAgents: "Regional Agents",
+ regionalAgentsLoading: "Loading agents...",
+ regionalAgentsAvailablePlaceholder: "Select additional regional agents...",
+ regionalAgentsAllSelected: "All available agents selected",
+ regionalAgentsNoAvailable: "No regional agents available",
+ regionalAgentsNoOnlineAvailable: "No online regional agents available",
+ regionalAgentsNotFoundMessage: "No online regional agents found. Services will use default monitoring.",
+ regionalAgentsNotSelectedMessage: "No regional agents selected. Service will use default monitoring.",
+
+ // ServiceUrlField.tsx
+ targetDefault: "Target URL/Host",
+ targetDNS: "Domain Name",
+ targetHTTPDesc: "Enter the full URL including protocol (http:// or https://)",
+ targetPINGDesc: "Enter hostname or IP address to ping",
+ targetTCPDesc: "Enter hostname or IP address for TCP connection test",
+ targetTCPPortDesc: "Enter the port number for TCP connection test",
+ targetDNSDesc: "Enter domain name for DNS record monitoring (A, AAAA, MX, etc.)",
+ targetDefaultDesc: "Enter the target URL or hostname for monitoring",
+ targetDefaultPlaceholder: "Enter URL or hostname",
+
+ // types.ts
+ serviceNameRequired: "Service name is required",
+ urlDomainHostRequired: "URL/Domain/Host is required",
+ enterValidUrlHostnameDomain: "Please enter a valid URL, hostname, or domain",
+
+ // Dashboard
+ upServices: "UP SERVICES",
+ downServices: "DOWN SERVICES",
+ pausedServices: "PAUSED SERVICES",
+ warningServices: "WARNING SERVICES",
+};
\ No newline at end of file
diff --git a/application/src/translations/en/settings.ts b/application/src/translations/en/settings.ts
index 9681f86..16077c5 100644
--- a/application/src/translations/en/settings.ts
+++ b/application/src/translations/en/settings.ts
@@ -2,18 +2,18 @@
import { SettingsTranslations } from '../types/settings';
export const settingsTranslations: SettingsTranslations = {
- // Tabs
+ // General Settings - Tabs
systemSettings: "System Settings",
mailSettings: "Mail Settings",
- // System Settings
+ // General Settings - System Settings
appName: "Application Name",
appURL: "Application URL",
senderName: "Sender Name",
senderEmail: "Sender Email Address",
hideControls: "Hide Controls",
- // Mail Settings
+ // General Settings - Mail Settings
smtpSettings: "SMTP Configuration",
smtpEnabled: "Enable SMTP",
smtpHost: "SMTP Host",
@@ -24,7 +24,7 @@ export const settingsTranslations: SettingsTranslations = {
enableTLS: "Enable TLS",
localName: "Local Name",
- // Test Email
+ // General Settings - Test Email
testEmail: "Test Email",
sendTestEmail: "Send test email",
emailTemplate: "Email template",
@@ -39,7 +39,7 @@ export const settingsTranslations: SettingsTranslations = {
enterEmailAddress: "Enter email address",
sending: "Sending...",
- // Actions and status
+ // General Settings - Actions and status
save: "Save Changes",
saving: "Saving...",
settingsUpdated: "Settings updated successfully",
@@ -48,5 +48,12 @@ export const settingsTranslations: SettingsTranslations = {
testConnection: "Test Connection",
testingConnection: "Testing Connection...",
connectionSuccess: "Connection successful",
- connectionFailed: "Connection failed"
+ connectionFailed: "Connection failed",
+
+ // User Management
+ addUser: "Add User",
+ permissionNotice: "Permission Notice:",
+ permissionNoticeAddUser: "As an admin user, you do not have access to view or modify system and mail settings. These settings can only be accessed and modified by Super Admins. Contact your Super Admin if you need to make changes to system configuration or mail settings.",
+ loadingSettings: "Loading settings...",
+ loadingSettingsError: "Error loading settings",
};
\ No newline at end of file
diff --git a/application/src/translations/en/ssl.ts b/application/src/translations/en/ssl.ts
index 1b2df8c..4cc13d8 100644
--- a/application/src/translations/en/ssl.ts
+++ b/application/src/translations/en/ssl.ts
@@ -112,5 +112,6 @@ export const sslTranslations: SSLTranslations = {
created: "Created",
lastUpdated: "Last Updated",
lastNotification: "Last Notification",
- collectionId: "Collection ID"
+ collectionId: "Collection ID",
+ noCertificatesFound: "No Certificates Found",
};
diff --git a/application/src/translations/index.ts b/application/src/translations/index.ts
index fdd550e..8dd3223 100644
--- a/application/src/translations/index.ts
+++ b/application/src/translations/index.ts
@@ -1,15 +1,17 @@
import enTranslations from './en';
import kmTranslations from './km';
import deTranslations from './de';
+import koTranslations from './ko';
import jaTranslations from './ja';
import zhcnTranslations from './zhcn';
-export type Language = "en" | "km" | "de" | "ja" | "zhcn";
+export type Language = "en" | "km" | "de" | "ko" | "ja" | "zhcn";
export const translations = {
en: enTranslations,
km: kmTranslations,
de: deTranslations,
+ ko: koTranslations,
ja: jaTranslations,
zhcn: zhcnTranslations,
};
diff --git a/application/src/translations/ja/about.ts b/application/src/translations/ja/about.ts
index b8965f1..4f4799d 100644
--- a/application/src/translations/ja/about.ts
+++ b/application/src/translations/ja/about.ts
@@ -1,7 +1,7 @@
import { AboutTranslations } from '../types/about';
export const aboutTranslations: AboutTranslations = {
- aboutCheckcle: "Checkcleについて",
+ aboutCheckCle: "Checkcleについて",
systemDescription: "Checkcleは、サーバーとサービスの健全性に関するリアルタイム監視、インシデント管理、運用の透明性を提供するオープンソースの監視スタックです。MIT ライセンスの下で公開されています。",
systemVersion: "システムバージョン",
license: "ライセンス",
@@ -14,4 +14,5 @@ export const aboutTranslations: AboutTranslations = {
quickActions: "クイックアクション",
quickActionsDescription: "一般的な監視操作と機能に素早くアクセスできます。開始するには、以下のアクションを選択してください。",
quickTips: "クイックヒント",
+ releasedOn: "公開日",
};
\ No newline at end of file
diff --git a/application/src/translations/ja/common.ts b/application/src/translations/ja/common.ts
index c8f0ce7..e59de9b 100644
--- a/application/src/translations/ja/common.ts
+++ b/application/src/translations/ja/common.ts
@@ -4,11 +4,12 @@ export const commonTranslations: CommonTranslations = {
welcome: "ようこそ",
logout: "ログアウト",
language: "言語",
- english: "English",
- khmer: "Khmer",
+ english: "Englisch",
+ khmer: "ភាសាខ្មែរ",
german: "Deutsch",
- simplifiedChinese: "简体中文",
+ korean: "한국어",
japanese: "日本語",
+ simplifiedChinese: "简体中文",
goodMorning: "おはようございます",
goodAfternoon: "こんにちは",
goodEvening: "こんばんは",
diff --git a/application/src/translations/ja/incident.ts b/application/src/translations/ja/incident.ts
index b591f3c..331a832 100644
--- a/application/src/translations/ja/incident.ts
+++ b/application/src/translations/ja/incident.ts
@@ -51,4 +51,5 @@ export const incidentTranslations: IncidentTranslations = {
configuration: '設定',
failedToUpdateStatus: 'ステータスの更新に失敗しました',
inProgress: '進行中',
+ enterRootCause: '原因を入力してください',
};
\ No newline at end of file
diff --git a/application/src/translations/ja/services.ts b/application/src/translations/ja/services.ts
index 668a644..bb64ae0 100644
--- a/application/src/translations/ja/services.ts
+++ b/application/src/translations/ja/services.ts
@@ -2,10 +2,20 @@ import { ServicesTranslations } from '../types/services';
export const servicesTranslations: ServicesTranslations = {
serviceName: "サービス名",
+ serviceNameDesc: "サービスのわかりやすい名前を入力してください",
serviceType: "サービスタイプ",
serviceStatus: "サービスステータス",
responseTime: "応答時間",
uptime: "稼働時間",
lastChecked: "最終チェック",
noServices: "フィルタ条件に一致するサービスがありません。",
+ currentlyMonitoring: "現在監視中",
+ retry: "再試行",
+ overview: "概要",
+ newService: "新しいサービス",
+ rowsPerPage: "1ページあたりの行数",
+ search: "検索",
+ allTypes: "すべてのタイプ",
+ createNewService: "新しいサービスを作成",
+ createNewServiceDesc: "監視する新しいサービスを作成するには、詳細を入力してください。",
};
\ No newline at end of file
diff --git a/application/src/translations/ja/ssl.ts b/application/src/translations/ja/ssl.ts
index 4d2f7db..2fb3622 100644
--- a/application/src/translations/ja/ssl.ts
+++ b/application/src/translations/ja/ssl.ts
@@ -111,5 +111,6 @@ export const sslTranslations: SSLTranslations = {
created: "作成日",
lastUpdated: "最終更新",
lastNotification: "最終通知",
- collectionId: "コレクションID"
+ collectionId: "コレクションID",
+ noCertificatesFound: "証明書が見つかりません",
};
\ No newline at end of file
diff --git a/application/src/translations/km/about.ts b/application/src/translations/km/about.ts
index dd44555..01183cf 100644
--- a/application/src/translations/km/about.ts
+++ b/application/src/translations/km/about.ts
@@ -2,7 +2,7 @@
import { AboutTranslations } from '../types/about';
export const aboutTranslations: AboutTranslations = {
- aboutCheckcle: "អំពី Checkcle",
+ aboutCheckCle: "អំពី Checkcle",
systemDescription: "Checkcle គឺជាស្តាកការត្រួតពិនិត្យប្រភពបើកទូលាយដែលផ្តល់នូវការយល់ដឹងជាក់ស្តែងអំពីសុខភាពម៉ាស៊ីនមេ និងសេវាកម្ម, ការគ្រប់គ្រងឧបទ្ទវហេតុ, និងតម្លាភាពនៃប្រតិបត្តិការ។ ចេញផ្សាយជាអាជ្ញាបណ្ណ MIT។",
systemVersion: "កំណែប្រព័ន្ធ",
license: "អាជ្ញាបណ្ណ",
@@ -15,4 +15,5 @@ export const aboutTranslations: AboutTranslations = {
quickActions: "សកម្មភាពរហ័ស",
quickActionsDescription: "ចូលប្រើប្រតិបត្តិការត្រួតពិនិត្យ និងមុខងារទូទៅយ៉ាងរហ័ស។ ជ្រើសរើសសកម្មភាពខាងក្រោមដើម្បីចាប់ផ្តើម។",
quickTips: "គន្លឹះរហ័ស",
+ releasedOn: "បានចេញផ្សាយនៅថ្ងៃទី",
};
\ No newline at end of file
diff --git a/application/src/translations/km/common.ts b/application/src/translations/km/common.ts
index 47219ce..fe1a1f9 100644
--- a/application/src/translations/km/common.ts
+++ b/application/src/translations/km/common.ts
@@ -5,9 +5,11 @@ export const commonTranslations: CommonTranslations = {
welcome: "សូមស្វាគមន៍",
logout: "ចាកចេញ",
language: "ភាសា",
- english: "អង់គ្លេស",
- khmer: "ខ្មែរ",
+ english: "Englisch",
+ khmer: "ភាសាខ្មែរ",
german: "Deutsch",
+ korean: "한국어",
+ japanese: "日本語",
simplifiedChinese: "简体中文",
goodMorning: "អរុណសួស្តី",
goodAfternoon: "ទិវាសួស្តី",
diff --git a/application/src/translations/km/incident.ts b/application/src/translations/km/incident.ts
index c33191f..32cea91 100644
--- a/application/src/translations/km/incident.ts
+++ b/application/src/translations/km/incident.ts
@@ -52,4 +52,5 @@ export const incidentTranslations: IncidentTranslations = {
configuration: "ការកំណត់រចនាសម្ព័ន្ធ",
failedToUpdateStatus: "បរាជ័យក្នុងការធ្វើបច្ចុប្បន្នភាពស្ថានភាព",
inProgress: "កំពុងដំណើរការ",
+ enterRootCause: 'បញ្ចូលហេតុផលដើម',
};
diff --git a/application/src/translations/km/services.ts b/application/src/translations/km/services.ts
index 658ac75..9cab3fc 100644
--- a/application/src/translations/km/services.ts
+++ b/application/src/translations/km/services.ts
@@ -3,10 +3,20 @@ import { ServicesTranslations } from '../types/services';
export const servicesTranslations: ServicesTranslations = {
serviceName: "ឈ្មោះសេវាកម្ម",
+ serviceNameDesc: "បញ្ចូលឈ្មោះពិពណ៌នាសម្រាប់សេវាកម្មរបស់អ្នក",
serviceType: "ប្រភេទសេវាកម្ម",
serviceStatus: "ស្ថានភាពសេវាកម្ម",
responseTime: "ពេលវេលាឆ្លើយតប",
uptime: "ពេលវេលាដំណើរការ",
lastChecked: "ពិនិត្យចុងក្រោយ",
noServices: "មិនមានសេវាកម្មដែលត្រូវនឹងលក្ខណៈវិនិច្ឆ័យរបស់អ្នក។",
+ currentlyMonitoring: "កំពុងតាមដានពេលនេះ",
+ retry: "សាកល្បងម្ដងទៀត",
+ overview: "ទិដ្ឋភាពទូទៅ",
+ newService: "សេវាកម្មថ្មី",
+ rowsPerPage: "ចំនួនជួរដេកក្នុងមួយទំព័រ",
+ search: "ស្វែងរក",
+ allTypes: "គ្រប់ប្រភេទ",
+ createNewService: "បង្កើតសេវាកម្មថ្មី",
+ createNewServiceDesc: "បញ្ចូលព័ត៌មានលម្អិតដើម្បីបង្កើតសេវាកម្មថ្មីដែលត្រូវតាមដាន។",
};
diff --git a/application/src/translations/km/ssl.ts b/application/src/translations/km/ssl.ts
index 10ba129..05cb0fa 100644
--- a/application/src/translations/km/ssl.ts
+++ b/application/src/translations/km/ssl.ts
@@ -112,5 +112,6 @@ export const sslTranslations: SSLTranslations = {
created: "បានបង្កើត",
lastUpdated: "បានធ្វើបច្ចុប្បន្នភាពចុងក្រោយ",
lastNotification: "ការជូនដំណឹងចុងក្រោយ",
- collectionId: "លេខសម្គាល់ប្រមូលផ្តុំ"
+ collectionId: "លេខសម្គាល់ប្រមូលផ្តុំ",
+ noCertificatesFound: "រកមិនឃើញវិញ្ញាបនប័ត្រ",
};
diff --git a/application/src/translations/ko/about.ts b/application/src/translations/ko/about.ts
new file mode 100644
index 0000000..e0d6ad6
--- /dev/null
+++ b/application/src/translations/ko/about.ts
@@ -0,0 +1,18 @@
+import { AboutTranslations } from '../types/about';
+
+export const aboutTranslations: AboutTranslations = {
+ aboutCheckCle: "About Checkcle",
+ systemDescription: "Checkcle는 서버 및 서비스 상태, 사고 관리, 운영 투명성에 대한 실시간 인사이트를 제공하는 오픈소스 모니터링 스택입니다. MIT 라이선스로 공개됨.",
+ systemVersion: "시스템 버전",
+ license: "라이선스",
+ mitLicense: "MIT 라이선스",
+ links: "링크",
+ viewOnGithub: "GitHub에서 보기",
+ viewDocumentation: "문서 보기",
+ followOnX: "X에서 팔로우",
+ joinDiscord: "Discord 참여",
+ quickActions: "빠른 작업",
+ quickActionsDescription: "자주 사용하는 모니터링 작업과 기능에 빠르게 접근하세요. 아래에서 작업을 선택하여 시작할 수 있습니다.",
+ quickTips: "빠른 팁",
+ releasedOn: "출시일",
+};
diff --git a/application/src/translations/ko/common.ts b/application/src/translations/ko/common.ts
new file mode 100644
index 0000000..fd08a0c
--- /dev/null
+++ b/application/src/translations/ko/common.ts
@@ -0,0 +1,31 @@
+import { CommonTranslations } from '../types/common';
+
+export const commonTranslations: CommonTranslations = {
+ welcome: "환영합니다",
+ logout: "로그아웃",
+ language: "언어",
+ english: "Englisch",
+ khmer: "ភាសាខ្មែរ",
+ german: "Deutsch",
+ korean: "한국어",
+ japanese: "日本語",
+ simplifiedChinese: "简体中文",
+ goodMorning: "좋은 아침입니다",
+ goodAfternoon: "좋은 오후입니다",
+ goodEvening: "좋은 저녁입니다",
+ profile: "프로필",
+ settings: "설정",
+ documentation: "문서",
+ notifications: "알림",
+ close: "닫기",
+ cancel: "취소",
+ view: "보기",
+ edit: "편집",
+ delete: "삭제",
+ status: "상태",
+ time: "시간",
+ title: "제목",
+ description: "설명",
+ success: "성공",
+ error: "오류",
+};
diff --git a/application/src/translations/ko/incident.ts b/application/src/translations/ko/incident.ts
new file mode 100644
index 0000000..e43ffaf
--- /dev/null
+++ b/application/src/translations/ko/incident.ts
@@ -0,0 +1,64 @@
+
+import { IncidentTranslations } from '../types/incident';
+
+export const incidentTranslations: IncidentTranslations = {
+ incidentManagement: '인시던트 관리',
+ incidentsManagementDesc: '서비스 인시던트 및 해결 과정을 추적하고 관리합니다',
+ unresolvedIncidents: '미해결',
+ resolvedIncidents: '해결됨',
+ activeIncidents: '활성 인시던트',
+ criticalIssues: '중대한 문제',
+ avgResolutionTime: '평균 해결 시간',
+ noIncidents: '활성 인시던트 없음',
+ createIncident: '인시던트 생성',
+ investigating: '조사 중',
+ identified: '확인됨',
+ monitoring: '모니터링 중',
+ resolved: '해결됨',
+ scheduleIncidentManagement: '일정 및 인시던트 관리',
+ incidentName: '인시던트 이름',
+ incidentStatus: '인시던트 상태',
+ highPriority: '높은 우선순위',
+ configurationSettings: '구성 설정',
+ incidentCreatedSuccess: '인시던트가 성공적으로 생성되었습니다',
+ basicInfo: '기본 정보',
+ serviceId: '서비스 ID',
+ assignedTo: '담당자',
+ unassigned: '미할당',
+ timeline: '타임라인',
+ incidentTime: '인시던트 발생 시간',
+ resolutionTime: '해결 시간',
+ systems: '시스템',
+ noSystems: '영향을 받은 시스템 없음',
+ impactAnalysis: '영향 분석',
+ rootCause: '근본 원인',
+ resolutionSteps: '해결 단계',
+ lessonsLearned: '교훈',
+ resolutionDetails: '해결 상세',
+ assignment: '할당',
+ download: '다운로드',
+ downloadPdf: 'PDF 다운로드',
+ print: '인쇄',
+ confidentialNote: '이 문서는 기밀이며 내부 용도로만 사용됩니다.',
+ generatedOn: '생성일',
+ enterResolutionSteps: '인시던트 해결 단계 입력',
+ enterLessonsLearned: '인시던트 교훈 입력',
+ editIncident: '인시던트 편집',
+ editIncidentDesc: '인시던트 세부 정보 업데이트',
+ updating: '업데이트 중...',
+ update: '업데이트',
+ create: '생성',
+ creating: '생성 중...',
+ configuration: '구성',
+ failedToUpdateStatus: '상태 업데이트 실패',
+ inProgress: '진행 중',
+ enterRootCause: '근본 원인 입력',
+ enterIncidentTitle: '인시던트 제목 입력',
+ enterIncidentDescription: '인시던트 설명 입력',
+ enterServiceId: '서비스 ID를 콤마로 구분하여 입력',
+ selectAssignedUser: '담당자 선택',
+ noAssignedUser: '현재 인시던트에 할당된 사용자가 없습니다',
+ affectedSystems: '영향을 받은 시스템',
+ enterAffectedSystems: '영향을 받은 시스템 입력',
+ separateSystemsWithComma: '영향 시스템을 콤마로 구분하여 입력',
+};
diff --git a/application/src/translations/ko/index.ts b/application/src/translations/ko/index.ts
new file mode 100644
index 0000000..e282607
--- /dev/null
+++ b/application/src/translations/ko/index.ts
@@ -0,0 +1,25 @@
+
+import { Translations } from '../types';
+import { commonTranslations } from './common';
+import { menuTranslations } from './menu';
+import { loginTranslations } from './login';
+import { aboutTranslations } from './about';
+import { servicesTranslations } from './services';
+import { maintenanceTranslations } from './maintenance';
+import { incidentTranslations } from './incident';
+import { sslTranslations } from './ssl';
+import { settingsTranslations } from './settings';
+
+const enTranslations: Translations = {
+ common: commonTranslations,
+ menu: menuTranslations,
+ login: loginTranslations,
+ about: aboutTranslations,
+ services: servicesTranslations,
+ maintenance: maintenanceTranslations,
+ incident: incidentTranslations,
+ ssl: sslTranslations,
+ settings: settingsTranslations
+};
+
+export default enTranslations;
\ No newline at end of file
diff --git a/application/src/translations/ko/login.ts b/application/src/translations/ko/login.ts
new file mode 100644
index 0000000..530787b
--- /dev/null
+++ b/application/src/translations/ko/login.ts
@@ -0,0 +1,23 @@
+
+import { LoginTranslations } from '../types/login';
+
+export const loginTranslations: LoginTranslations = {
+ signInToYourAccount: "계정 로그인",
+ dontHaveAccount: "계정이 없으신가요?",
+ createOne: "계정 생성",
+ signInWithGoogle: "Google로 로그인",
+ orContinueWith: "또는",
+ email: "이메일",
+ password: "비밀번호",
+ forgot: "잊으셨나요?",
+ signIn: "로그인",
+ signingIn: "로그인 중...",
+ loginSuccessful: "로그인 성공",
+ loginSuccessMessage: "성공적으로 로그인되었습니다.",
+ loginFailed: "로그인 실패",
+ authenticationFailed: "인증 실패",
+ bySigningIn: "로그인하면 다음에 동의하게 됩니다:",
+ termsAndConditions: "이용약관",
+ and: "및",
+ privacyPolicy: "개인정보 처리방침",
+};
diff --git a/application/src/translations/ko/maintenance.ts b/application/src/translations/ko/maintenance.ts
new file mode 100644
index 0000000..9b4eb4c
--- /dev/null
+++ b/application/src/translations/ko/maintenance.ts
@@ -0,0 +1,81 @@
+
+import { MaintenanceTranslations } from '../types/maintenance';
+
+export const maintenanceTranslations: MaintenanceTranslations = {
+ scheduledMaintenance: '예정된 유지보수',
+ scheduledMaintenanceDesc: '시스템 및 서비스에 계획된 유지보수 일정을 보고 관리합니다',
+ upcomingMaintenance: '예정',
+ ongoingMaintenance: '진행 중',
+ completedMaintenance: '완료됨',
+ createMaintenanceWindow: '유지보수 생성',
+ totalScheduledHours: '총 예정 시간',
+ maintenanceName: '유지보수 이름',
+ maintenanceStatus: '상태',
+ scheduledStart: '예정 시작',
+ scheduledEnd: '예정 종료',
+ affectedServices: '영향받는 서비스',
+ impact: '영향',
+ minor: '경미',
+ major: '중대',
+ critical: '심각',
+ none: '없음',
+ actions: '작업',
+ scheduled: '예정됨',
+ inprogress: '진행 중',
+ completed: '완료됨',
+ cancelled: '취소됨',
+ markAsInProgress: '진행 중으로 표시',
+ markAsCompleted: '완료로 표시',
+ markAsCancelled: '취소로 표시',
+ confirmDelete: '삭제 확인',
+ deleteMaintenanceConfirmation: '이 유지보수 일정을 삭제하시겠습니까?',
+ thisActionCannotBeUndone: '이 작업은 되돌릴 수 없습니다.',
+ maintenanceDeleted: '유지보수 삭제됨',
+ maintenanceDeletedDesc: '유지보수 일정이 성공적으로 삭제되었습니다.',
+ errorDeletingMaintenance: '유지보수 삭제 중 오류가 발생했습니다.',
+ statusUpdated: '상태 업데이트됨',
+ maintenanceStatusUpdated: '유지보수 상태가 성공적으로 업데이트되었습니다.',
+ errorUpdatingMaintenanceStatus: '유지보수 상태 업데이트 중 오류가 발생했습니다.',
+ createMaintenance: '유지보수 생성',
+ createMaintenanceDesc: '서비스를 위한 새 유지보수 일정을 예약합니다',
+ enterTitle: '유지보수 제목 입력',
+ enterDescription: '유지보수 상세 설명 입력',
+ startTime: '시작 시간',
+ endTime: '종료 시간',
+ selectDate: '날짜 선택',
+ enterAffectedServices: '영향받는 서비스 입력',
+ separateServicesWithComma: '여러 서비스를 콤마로 구분하여 입력',
+ priority: '우선순위',
+ selectPriority: '우선순위 선택',
+ selectStatus: '상태 선택',
+ selectImpact: '영향 선택',
+ notifySubscribers: '구독자에게 알림',
+ notifySubscribersDesc: '유지보수 시작 시 모든 구독자에게 알림 전송',
+ maintenanceCreated: '유지보수 생성됨',
+ maintenanceCreatedDesc: '유지보수 일정이 성공적으로 예약되었습니다.',
+ errorCreatingMaintenance: '유지보수 생성 중 오류 발생',
+ errorFetchingMaintenanceData: '유지보수 데이터 가져오기 중 오류 발생',
+ low: '낮음',
+ medium: '중간',
+ high: '높음',
+ created: '생성됨',
+ lastUpdated: '마지막 업데이트',
+ subscribersWillBeNotified: '유지보수가 시작되면 구독자에게 알림이 전송됩니다',
+ noNotifications: '알림이 전송되지 않습니다',
+ noScheduledMaintenance: '예정된 유지보수 없음',
+ noMaintenanceWindows: '이 기간에 유지보수 일정이 없습니다. "유지보수 생성" 버튼을 클릭하여 새 일정을 생성하세요.',
+ maintenanceCreatedSuccess: '유지보수 일정이 성공적으로 생성되었습니다',
+ editMaintenanceWindow: '유지보수 편집',
+ editMaintenanceDesc: '유지보수 세부정보 편집',
+ priorityDescription: '유지보수 우선순위 선택',
+ statusDescription: '유지보수 상태 선택',
+ impactLevel: '영향 수준',
+ impactLevelDescription: '영향 수준 선택',
+ selectAssignedUsers: '담당 사용자 선택',
+ assignedPersonnelDescription: '현재 할당된 사용자',
+ mutedNotifications: '알림 비활성화됨',
+ notificationsAreMuted: '현재 유지보수 알림이 비활성화되어 있습니다',
+ selectNotificationChannel: '알림 채널 추가',
+ enableNotificationsFirst: '채널을 선택하려면 먼저 알림을 활성화하세요',
+ updateMaintenance: '유지보수 업데이트',
+};
diff --git a/application/src/translations/ko/menu.ts b/application/src/translations/ko/menu.ts
new file mode 100644
index 0000000..a29c5b0
--- /dev/null
+++ b/application/src/translations/ko/menu.ts
@@ -0,0 +1,21 @@
+
+import { MenuTranslations } from '../types/menu';
+
+export const menuTranslations: MenuTranslations = {
+ uptimeMonitoring: "가동 시간 모니터링",
+ instanceMonitoring: "인스턴스 모니터링",
+ sslDomain: "SSL & 도메인",
+ scheduleIncident: "일정 및 인시던트",
+ operationalPage: "운영 페이지",
+ reports: "리포트",
+ regionalMonitoring: "지역 모니터링",
+ settingPanel: "설정 패널",
+ generalSettings: "일반 설정",
+ userManagement: "사용자 관리",
+ notificationSettings: "알림 설정",
+ alertsTemplates: "알림 템플릿",
+ rolesManagement: "권한 관리",
+ dataRetention: "데이터 보존",
+ backupSettings: "백업 설정",
+ aboutSystem: "시스템 정보",
+};
diff --git a/application/src/translations/ko/services.ts b/application/src/translations/ko/services.ts
new file mode 100644
index 0000000..a9b3fa7
--- /dev/null
+++ b/application/src/translations/ko/services.ts
@@ -0,0 +1,89 @@
+
+import { ServicesTranslations } from '../types/services';
+
+export const servicesTranslations: ServicesTranslations = {
+ serviceStatus: "서비스 상태",
+ responseTime: "응답 시간",
+ uptime: "가동 시간",
+ lastChecked: "마지막 확인",
+ noServices: "필터 조건에 맞는 서비스가 없습니다.",
+ currentlyMonitoring: "현재 모니터링 중",
+ retry: "재시도",
+ overview: "개요",
+ newService: "새 서비스",
+ rowsPerPage: "페이지당 행",
+ search: "검색",
+ allTypes: "모든 유형",
+ createNewService: "새 서비스 생성",
+ createNewServiceDesc: "모니터링할 새 서비스의 세부 정보를 입력하세요.",
+
+ serviceName: "서비스 이름",
+ serviceNameDesc: "서비스에 대한 설명적인 이름을 입력하세요",
+
+ checkInterval: "체크 간격",
+ seconds: "초",
+ minute: "분",
+ minutes: "분",
+ hour: "시간",
+ hours: "시간",
+ custom: "사용자 정의",
+ checkIntervalPlaceholder: "초 단위로 간격 입력",
+ backToPresets: "기본값으로 돌아가기",
+ checkIntervalDesc: "서비스 상태를 확인하는 간격",
+ checkIntervalDescCustom: "사용자 정의 간격 입력 (최소 10초)",
+ retryAttempts: "재시도 횟수",
+ attempt: "회",
+ attempts: "회",
+ retryAttemptsDesc: "서비스 다운으로 표시되기 전 재시도 횟수",
+
+ updateService: "서비스 업데이트",
+ createService: "서비스 생성",
+
+ enableNotifications: "알림 활성화",
+ enableNotificationsDesc: "서비스 알림을 활성화하거나 비활성화합니다",
+ notificationChannels: "알림 채널",
+ notificationChannelsEnabledDesc: "서비스 알림 채널 선택",
+ notificationChannelsDesc: "채널을 선택하려면 먼저 알림을 활성화하세요",
+ notificationChannelsPlaceholder: "알림 채널 추가",
+ alertTemplate: "알림 템플릿",
+ alertTemplateLoading: "템플릿 로딩 중...",
+ alertTemplatePlaceholder: "알림 템플릿 선택",
+ alertTemplateEnabledDesc: "알림 메시지용 템플릿 선택",
+ alertTemplateDesc: "템플릿 선택 전 알림을 활성화하세요",
+
+ serviceType: "서비스 유형",
+ serviceTypeHTTPDesc: "HTTP/HTTPS 프로토콜로 웹사이트 및 REST API 모니터링",
+ serviceTypePINGDesc: "PING 프로토콜로 호스트 가용성 모니터링",
+ serviceTypeTCPDesc: "TCP 프로토콜로 TCP 포트 연결 상태 모니터링",
+ serviceTypeDNSDesc: "DNS 해석 모니터링",
+
+ regionalMonitoring: "지역 모니터링",
+ regionalMonitoringDesc: "이 서비스를 지역 모니터링 에이전트에 할당하여 분산 모니터링",
+ regionalAgents: "지역 에이전트",
+ regionalAgentsLoading: "에이전트 로딩 중...",
+ regionalAgentsAvailablePlaceholder: "추가 지역 에이전트 선택...",
+ regionalAgentsAllSelected: "모든 사용 가능한 에이전트 선택됨",
+ regionalAgentsNoAvailable: "사용 가능한 지역 에이전트 없음",
+ regionalAgentsNoOnlineAvailable: "온라인 지역 에이전트 없음",
+ regionalAgentsNotFoundMessage: "온라인 지역 에이전트 없음. 기본 모니터링 사용",
+ regionalAgentsNotSelectedMessage: "지역 에이전트 선택 안됨. 기본 모니터링 사용",
+
+ targetDefault: "대상 URL/호스트",
+ targetDNS: "도메인 이름",
+ targetHTTPDesc: "프로토콜 포함 전체 URL 입력 (http:// 또는 https://)",
+ targetPINGDesc: "호스트 이름 또는 IP 주소 입력",
+ targetTCPDesc: "TCP 연결 테스트용 호스트 이름 또는 IP 입력",
+ targetTCPPortDesc: "TCP 연결 테스트용 포트 번호 입력",
+ targetDNSDesc: "DNS 레코드 모니터링용 도메인 이름 입력 (A, AAAA, MX 등)",
+ targetDefaultDesc: "모니터링 대상 URL 또는 호스트 이름 입력",
+ targetDefaultPlaceholder: "URL 또는 호스트 이름 입력",
+
+ serviceNameRequired: "서비스 이름은 필수입니다",
+ urlDomainHostRequired: "URL/도메인/호스트는 필수입니다",
+ enterValidUrlHostnameDomain: "유효한 URL, 호스트 이름 또는 도메인을 입력하세요",
+
+ upServices: "가동 서비스",
+ downServices: "다운 서비스",
+ pausedServices: "일시정지 서비스",
+ warningServices: "경고 서비스",
+};
diff --git a/application/src/translations/ko/settings.ts b/application/src/translations/ko/settings.ts
new file mode 100644
index 0000000..c8f2fd4
--- /dev/null
+++ b/application/src/translations/ko/settings.ts
@@ -0,0 +1,59 @@
+
+import { SettingsTranslations } from '../types/settings';
+
+export const settingsTranslations: SettingsTranslations = {
+ // General Settings - Tabs
+ systemSettings: "시스템 설정",
+ mailSettings: "메일 설정",
+
+ // General Settings - System Settings
+ appName: "앱 이름",
+ appURL: "앱 URL",
+ senderName: "발신자 이름",
+ senderEmail: "발신자 이메일 주소",
+ hideControls: "컨트롤 숨기기",
+
+ // General Settings - Mail Settings
+ smtpSettings: "SMTP 구성",
+ smtpEnabled: "SMTP 활성화",
+ smtpHost: "SMTP 호스트",
+ smtpPort: "SMTP 포트",
+ smtpUsername: "SMTP 사용자 이름",
+ smtpPassword: "SMTP 비밀번호",
+ smtpAuthMethod: "인증 방법",
+ enableTLS: "TLS 활성화",
+ localName: "로컬 이름",
+
+ // General Settings - Test Email
+ testEmail: "테스트 이메일",
+ sendTestEmail: "테스트 이메일 전송",
+ emailTemplate: "이메일 템플릿",
+ verification: "검증",
+ passwordReset: "비밀번호 재설정",
+ confirmEmailChange: "이메일 변경 확인",
+ otp: "OTP",
+ loginAlert: "로그인 알림",
+ authCollection: "인증 컬렉션",
+ selectCollection: "컬렉션 선택",
+ toEmailAddress: "받는 이메일",
+ enterEmailAddress: "이메일 주소 입력",
+ sending: "전송 중...",
+
+ // General Settings - Actions and status
+ save: "변경 사항 저장",
+ saving: "저장 중...",
+ settingsUpdated: "설정이 성공적으로 업데이트되었습니다",
+ errorSavingSettings: "설정 저장 중 오류 발생",
+ errorFetchingSettings: "설정 불러오기 중 오류 발생",
+ testConnection: "연결 테스트",
+ testingConnection: "연결 테스트 중...",
+ connectionSuccess: "연결 성공",
+ connectionFailed: "연결 실패",
+
+ // User Management
+ addUser: "사용자 추가",
+ permissionNotice: "권한 안내:",
+ permissionNoticeAddUser: "관리자 계정은 시스템 및 메일 설정을 확인하거나 변경할 수 없습니다. 이 설정은 슈퍼 관리자만 접근 및 수정할 수 있습니다. 시스템 구성 또는 메일 설정 변경이 필요하면 슈퍼 관리자에게 문의하세요.",
+ loadingSettings: "설정 로딩 중...",
+ loadingSettingsError: "설정 로딩 중 오류 발생",
+};
\ No newline at end of file
diff --git a/application/src/translations/ko/ssl.ts b/application/src/translations/ko/ssl.ts
new file mode 100644
index 0000000..d08add2
--- /dev/null
+++ b/application/src/translations/ko/ssl.ts
@@ -0,0 +1,117 @@
+
+import { SSLTranslations } from '../types/ssl';
+
+export const sslTranslations: SSLTranslations = {
+ // Page and section titles
+ sslDomainManagement: "SSL & 도메인 관리",
+ monitorSSLCertificates: "도메인의 SSL 인증서를 모니터링하고 관리",
+ addSSLCertificate: "SSL 인증서 추가",
+ editSSLCertificate: "SSL 인증서 편집",
+ deleteSSLCertificate: "SSL 인증서 삭제",
+ sslCertificateDetails: "SSL 인증서 상세",
+ detailedInfo: "상세 정보",
+ viewDetailedInformation: "상세 정보 보기",
+
+ // Status related
+ valid: "유효",
+ expiringSoon: "곧 만료",
+ expired: "만료됨",
+ pending: "대기 중",
+
+ // Statistics and cards
+ validCertificates: "유효 인증서",
+ expiringSoonCertificates: "곧 만료 인증서",
+ expiredCertificates: "만료 인증서",
+
+ // Form fields
+ domain: "도메인",
+ domainName: "도메인 이름",
+ domainCannotChange: "생성 후 도메인은 변경할 수 없습니다",
+ warningThreshold: "경고 임계값",
+ warningThresholdDays: "경고 임계값(일)",
+ expiryThreshold: "만료 임계값",
+ expiryThresholdDays: "만료 임계값(일)",
+ notificationChannel: "알림 채널",
+ chooseChannel: "알림 채널 선택",
+ whereToSend: "알림 전송 위치",
+ daysBeforeExpiration: "만료 전 경고 받을 일수",
+ daysBeforeCritical: "만료 임박 시 알림 받을 일수",
+ getNotifiedExpiration: "인증서 만료 시 알림 받기",
+ getNotifiedCritical: "인증서 임박 시 알림 받기",
+
+ // Table headers and fields
+ issuer: "발급자",
+ expirationDate: "만료일",
+ daysLeft: "남은 일수",
+ status: "상태",
+ lastNotified: "마지막 알림",
+ actions: "작업",
+ validFrom: "유효 시작",
+ validUntil: "유효 종료",
+ validityDays: "유효 일수",
+ validityPeriod: "유효 기간",
+ organization: "조직",
+ commonName: "공통 이름",
+ serialNumber: "일련번호",
+ algorithm: "알고리즘",
+ subjectAltNames: "대체 이름",
+ subjectAlternativeNames: "대체 이름",
+ resolvedIP: "해결된 IP",
+ issuedTo: "발급 대상",
+ days: "일",
+
+ // Buttons and actions
+ addDomain: "도메인 추가",
+ refreshAll: "모두 새로고침",
+ cancel: "취소",
+ addCertificate: "인증서 추가",
+ check: "확인",
+ view: "보기",
+ edit: "편집",
+ delete: "삭제",
+ close: "닫기",
+ saveChanges: "변경 사항 저장",
+ updating: "업데이트 중",
+
+ // Sections in detail view
+ basicInformation: "기본 정보",
+ validity: "유효성",
+ issuerInfo: "발급자 정보",
+ technicalDetails: "기술 세부정보",
+ technicalInformation: "기술 정보",
+ monitoringConfig: "모니터링 구성",
+ monitoringConfiguration: "모니터링 구성",
+ recordInfo: "레코드 정보",
+ certificateDetails: "인증서 상세",
+
+ // Notifications and messages
+ sslCertificateAdded: "SSL 인증서가 성공적으로 추가되었습니다",
+ sslCertificateUpdated: "SSL 인증서가 성공적으로 업데이트되었습니다",
+ sslCertificateDeleted: "SSL 인증서가 성공적으로 삭제되었습니다",
+ sslCertificateRefreshed: "{domain}의 SSL 인증서가 성공적으로 갱신되었습니다",
+ allCertificatesRefreshed: "총 {count}개의 인증서가 성공적으로 갱신되었습니다",
+ someCertificatesFailed: "{success}개의 인증서 갱신 성공, {failed}개 실패",
+ failedToAddCertificate: "SSL 인증서 추가 실패",
+ failedToLoadCertificates: "SSL 인증서 불러오기 실패",
+ failedToUpdateCertificate: "SSL 인증서 업데이트 실패",
+ failedToDeleteCertificate: "SSL 인증서 삭제 실패",
+ failedToCheckCertificate: "SSL 인증서 확인 실패",
+ noCertificatesToRefresh: "갱신할 인증서 없음",
+ startingRefreshAll: "{count}개의 인증서 갱신 시작",
+ checkingSSLCertificate: "SSL 인증서 확인 중...",
+ deleteConfirmation: "인증서를 삭제하시겠습니까?",
+ deleteWarning: "이 작업은 되돌릴 수 없으며 인증서를 영구적으로 삭제합니다.",
+
+ // Misc
+ unknown: "알 수 없음",
+ never: "없음",
+ none: "없음",
+ loadingChannels: "채널 로딩 중...",
+ noChannelsFound: "알림 채널 없음",
+ noSSLCertificates: "SSL 인증서 없음",
+ created: "생성됨",
+ lastUpdated: "마지막 업데이트",
+ lastNotification: "마지막 알림",
+ collectionId: "컬렉션 ID",
+ noCertificatesFound: "인증서 없음",
+};
diff --git a/application/src/translations/types/about.ts b/application/src/translations/types/about.ts
index 7197b39..9d8a1f6 100644
--- a/application/src/translations/types/about.ts
+++ b/application/src/translations/types/about.ts
@@ -13,4 +13,5 @@ export interface AboutTranslations {
quickActions: string;
quickActionsDescription: string;
quickTips: string;
+ releasedOn: string;
}
diff --git a/application/src/translations/types/common.ts b/application/src/translations/types/common.ts
index 275651b..5324bce 100644
--- a/application/src/translations/types/common.ts
+++ b/application/src/translations/types/common.ts
@@ -6,6 +6,7 @@ export interface CommonTranslations {
english: string;
khmer: string;
german: string;
+ korean: string;
japanese: string;
simplifiedChinese: string;
goodMorning: string;
diff --git a/application/src/translations/types/incident.ts b/application/src/translations/types/incident.ts
index 83d2014..4ad5ccf 100644
--- a/application/src/translations/types/incident.ts
+++ b/application/src/translations/types/incident.ts
@@ -50,4 +50,13 @@ export interface IncidentTranslations {
configuration: string;
failedToUpdateStatus: string;
inProgress: string;
+ enterRootCause: string;
+ enterIncidentTitle: string;
+ enterIncidentDescription: string;
+ enterServiceId: string;
+ selectAssignedUser: string;
+ noAssignedUser: string;
+ affectedSystems: string;
+ enterAffectedSystems: string;
+ separateSystemsWithComma: string;
}
diff --git a/application/src/translations/types/maintenance.ts b/application/src/translations/types/maintenance.ts
index 7170349..4189301 100644
--- a/application/src/translations/types/maintenance.ts
+++ b/application/src/translations/types/maintenance.ts
@@ -63,4 +63,17 @@ export interface MaintenanceTranslations {
noScheduledMaintenance: string;
noMaintenanceWindows: string;
maintenanceCreatedSuccess: string;
+ editMaintenanceWindow: string;
+ editMaintenanceDesc: string;
+ priorityDescription: string;
+ statusDescription: string;
+ impactLevel: string;
+ impactLevelDescription: string;
+ selectAssignedUsers: string;
+ assignedPersonnelDescription: string;
+ mutedNotifications: string;
+ notificationsAreMuted: string;
+ selectNotificationChannel: string;
+ enableNotificationsFirst: string;
+ updateMaintenance: string;
}
diff --git a/application/src/translations/types/services.ts b/application/src/translations/types/services.ts
index 5d93087..bd9e7a9 100644
--- a/application/src/translations/types/services.ts
+++ b/application/src/translations/types/services.ts
@@ -1,10 +1,97 @@
export interface ServicesTranslations {
- serviceName: string;
- serviceType: string;
+
serviceStatus: string;
responseTime: string;
uptime: string;
lastChecked: string;
noServices: string;
+ currentlyMonitoring: string;
+ retry: string;
+ overview: string;
+ newService: string;
+ rowsPerPage: string;
+ search: string;
+ allTypes: string;
+ createNewService: string;
+ createNewServiceDesc: string;
+
+ // ServiceBasicFields.tsx
+ serviceName: string;
+ serviceNameDesc: string;
+
+ // ServiceConfigFields.tsx
+ checkInterval: string;
+ seconds: string;
+ minute: string;
+ minutes: string;
+ hour: string;
+ hours: string;
+ custom: string;
+ checkIntervalPlaceholder: string;
+ backToPresets: string;
+ checkIntervalDesc: string;
+ checkIntervalDescCustom: string;
+ retryAttempts: string;
+ attempt: string;
+ attempts: string;
+ retryAttemptsDesc: string;
+
+ // ServiceForm.tsx
+ updateService: string;
+ createService: string;
+
+ // ServiceNotificationFields.tsx
+ enableNotifications: string;
+ enableNotificationsDesc: string;
+ notificationChannels: string;
+ notificationChannelsEnabledDesc: string;
+ notificationChannelsDesc: string;
+ notificationChannelsPlaceholder: string;
+ alertTemplate: string;
+ alertTemplateLoading: string;
+ alertTemplatePlaceholder: string;
+ alertTemplateEnabledDesc: string;
+ alertTemplateDesc: string;
+
+ // ServiceTypeField.tsx
+ serviceType: string;
+ serviceTypeHTTPDesc: string;
+ serviceTypePINGDesc: string;
+ serviceTypeTCPDesc: string;
+ serviceTypeDNSDesc: string;
+
+ // ServiceRegionalFields.tsx
+ regionalMonitoring: string;
+ regionalMonitoringDesc: string;
+ regionalAgents: string;
+ regionalAgentsLoading: string;
+ regionalAgentsAvailablePlaceholder: string;
+ regionalAgentsAllSelected: string;
+ regionalAgentsNoAvailable: string;
+ regionalAgentsNoOnlineAvailable: string;
+ regionalAgentsNotFoundMessage: string;
+ regionalAgentsNotSelectedMessage: string;
+
+ // ServiceUrlField.tsx
+ targetDefault: string;
+ targetDNS: string;
+ targetHTTPDesc: string;
+ targetPINGDesc: string;
+ targetTCPDesc: string;
+ targetTCPPortDesc: string;
+ targetDNSDesc: string;
+ targetDefaultDesc: string;
+ targetDefaultPlaceholder: string;
+
+ // types.ts
+ serviceNameRequired: string;
+ urlDomainHostRequired: string;
+ enterValidUrlHostnameDomain: string;
+
+ // Dashboard
+ upServices: string;
+ downServices: string;
+ pausedServices: string;
+ warningServices: string;
}
diff --git a/application/src/translations/types/settings.ts b/application/src/translations/types/settings.ts
index 71b07e5..cf4de01 100644
--- a/application/src/translations/types/settings.ts
+++ b/application/src/translations/types/settings.ts
@@ -1,17 +1,17 @@
export interface SettingsTranslations {
- // Tabs
+ // General Settings - Tabs
systemSettings: string;
mailSettings: string;
- // System Settings
+ // General Settings - System Settings
appName: string;
appURL: string;
senderName: string;
senderEmail: string;
hideControls: string;
- // Mail Settings
+ // General Settings - Mail Settings
smtpSettings?: string;
smtpEnabled: string;
smtpHost: string;
@@ -22,7 +22,7 @@ export interface SettingsTranslations {
enableTLS: string;
localName: string;
- // Test Email
+ // General Settings - Test Email
testEmail: string;
sendTestEmail: string;
emailTemplate: string;
@@ -37,7 +37,7 @@ export interface SettingsTranslations {
enterEmailAddress: string;
sending: string;
- // Actions and status
+ // General Settings - Actions and status
save: string;
saving: string;
settingsUpdated: string;
@@ -47,4 +47,11 @@ export interface SettingsTranslations {
testingConnection: string;
connectionSuccess: string;
connectionFailed: string;
+
+ // User Management
+ addUser: string;
+ permissionNotice: string;
+ permissionNoticeAddUser: string;
+ loadingSettings: string;
+ loadingSettingsError: string;
}
\ No newline at end of file
diff --git a/application/src/translations/types/ssl.ts b/application/src/translations/types/ssl.ts
index f42834d..04a6b43 100644
--- a/application/src/translations/types/ssl.ts
+++ b/application/src/translations/types/ssl.ts
@@ -111,4 +111,5 @@ export interface SSLTranslations {
lastUpdated: string;
lastNotification: string;
collectionId: string;
+ noCertificatesFound: string;
}
\ No newline at end of file
diff --git a/application/src/translations/zhcn/about.ts b/application/src/translations/zhcn/about.ts
index 3914510..f8eb611 100644
--- a/application/src/translations/zhcn/about.ts
+++ b/application/src/translations/zhcn/about.ts
@@ -2,7 +2,7 @@
import { AboutTranslations } from '../types/about';
export const aboutTranslations: AboutTranslations = {
- aboutCheckcle: "关于 Checkcle",
+ aboutCheckCle: "关于 Checkcle",
systemDescription: "Checkcle 是一个开源监控平台,可提供有关服务器和服务健康状况的实时洞察、事件管理以及透明化运营。以 MIT 许可证发布。",
systemVersion: "系统版本",
license: "许可证",
@@ -15,4 +15,5 @@ export const aboutTranslations: AboutTranslations = {
quickActions: "快速操作",
quickActionsDescription: "快速访问常用的监控操作和功能。选择下面的操作开始。",
quickTips: "快速提示",
+ releasedOn: "发布于",
};
diff --git a/application/src/translations/zhcn/common.ts b/application/src/translations/zhcn/common.ts
index 0f5b71e..7d30a2e 100644
--- a/application/src/translations/zhcn/common.ts
+++ b/application/src/translations/zhcn/common.ts
@@ -5,9 +5,11 @@ export const commonTranslations: CommonTranslations = {
welcome: "欢迎",
logout: "注销",
language: "语言",
- english: "English",
- khmer: "Khmer",
+ english: "Englisch",
+ khmer: "ភាសាខ្មែរ",
german: "Deutsch",
+ korean: "한국어",
+ japanese: "日本語",
simplifiedChinese: "简体中文",
goodMorning: "早上好",
goodAfternoon: "下午好",
diff --git a/application/src/translations/zhcn/incident.ts b/application/src/translations/zhcn/incident.ts
index 8903f2d..16c21c6 100644
--- a/application/src/translations/zhcn/incident.ts
+++ b/application/src/translations/zhcn/incident.ts
@@ -52,4 +52,5 @@ export const incidentTranslations: IncidentTranslations = {
configuration: '配置',
failedToUpdateStatus: '更新状态失败',
inProgress: '进行中',
+ enterRootCause: '输入故障根源',
};
diff --git a/application/src/translations/zhcn/maintenance.ts b/application/src/translations/zhcn/maintenance.ts
index 7dd51bd..fa8f7c3 100644
--- a/application/src/translations/zhcn/maintenance.ts
+++ b/application/src/translations/zhcn/maintenance.ts
@@ -4,7 +4,7 @@ import { MaintenanceTranslations } from '../types/maintenance';
export const maintenanceTranslations: MaintenanceTranslations = {
scheduledMaintenance: '计划维护',
scheduledMaintenanceDesc: '查看和管理您系统和服务的计划维护窗口',
- upcomingMaintenance: '即将',
+ upcomingMaintenance: '计划中',
ongoingMaintenance: '进行中',
completedMaintenance: '已完成',
createMaintenanceWindow: '创建维护',
diff --git a/application/src/translations/zhcn/menu.ts b/application/src/translations/zhcn/menu.ts
index 30c7ab0..0962799 100644
--- a/application/src/translations/zhcn/menu.ts
+++ b/application/src/translations/zhcn/menu.ts
@@ -2,7 +2,7 @@
import { MenuTranslations } from '../types/menu';
export const menuTranslations: MenuTranslations = {
- uptimeMonitoring: "Uptime 监控",
+ uptimeMonitoring: "在线监控",
instanceMonitoring: "实例监控",
sslDomain: "SSL & 域名",
scheduleIncident: "计划与事件",
diff --git a/application/src/translations/zhcn/services.ts b/application/src/translations/zhcn/services.ts
index 7cf86c7..4e9cc95 100644
--- a/application/src/translations/zhcn/services.ts
+++ b/application/src/translations/zhcn/services.ts
@@ -2,11 +2,97 @@
import { ServicesTranslations } from '../types/services';
export const servicesTranslations: ServicesTranslations = {
- serviceName: "服务名称",
- serviceType: "服务类型",
serviceStatus: "服务状态",
responseTime: "响应时间",
- uptime: "Uptime",
+ uptime: "在线时间",
lastChecked: "最后检查时间",
noServices: "没有符合您筛选条件的服务。",
-};
+ currentlyMonitoring: "当前监控",
+ retry: "重试",
+ overview: "概览",
+ newService: "新增服务",
+ rowsPerPage: "每页行数",
+ search: "搜索",
+ allTypes: "所有类型",
+ createNewService: "添加新服务",
+ createNewServiceDesc: "填写详细信息以创建要监控的新服务。",
+
+ // ServiceBasicFields.tsx
+ serviceName: "服务名称",
+ serviceNameDesc: "为你的服务输入一个描述性名称",
+
+ // ServiceConfigFields.tsx
+ checkInterval: "检查间隔",
+ seconds: "秒",
+ minute: "分钟",
+ minutes: "分钟",
+ hour: "小时",
+ hours: "小时",
+ custom: "自定义",
+ checkIntervalPlaceholder: "输入间隔时间(秒)",
+ backToPresets: "回到预设",
+ checkIntervalDesc: "多久检查一次服务状态",
+ checkIntervalDescCustom: "输入自定义间隔时间(以秒为单位,最小10秒)",
+ retryAttempts: "重试次数",
+ attempt: "次",
+ attempts: "次",
+ retryAttemptsDesc: "在标记为下线之前重试的次数",
+
+ // ServiceForm.tsx
+ updateService: "更新服务",
+ createService: "创建服务",
+
+ // ServiceNotificationFields.tsx
+ enableNotifications: "启用通知",
+ enableNotificationsDesc: "为本服务启用或禁用通知",
+ notificationChannels: "通知渠道",
+ notificationChannelsEnabledDesc: "为本服务选择通知渠道",
+ notificationChannelsDesc: "先启用通知以选择渠道",
+ notificationChannelsPlaceholder: "添加一个通知渠道",
+ alertTemplate: "警报模板",
+ alertTemplateLoading: "正在加载模板...",
+ alertTemplatePlaceholder: "选择一个警报模板",
+ alertTemplateEnabledDesc: "选择一个警报消息的模板",
+ alertTemplateDesc: "先启用通知才能选择模板",
+
+ // ServiceTypeField.tsx
+ serviceType: "服务类型",
+ serviceTypeHTTPDesc: "使用 HTTP/HTTPS 协议监控网站和 RESTAPI",
+ serviceTypePINGDesc: "使用 PING 协议监控主机可用性",
+ serviceTypeTCPDesc: "使用 TCP 协议监控 TCP 端口连接性",
+ serviceTypeDNSDesc: "监控 DNS 解析",
+
+ // ServiceRegionalFields.tsx
+ regionalMonitoring: "区域监控",
+ regionalMonitoringDesc: "将此服务分配给区域监控代理以进行分布式监控",
+ regionalAgents: "区域代理",
+ regionalAgentsLoading: "加载代理中...",
+ regionalAgentsAvailablePlaceholder: "选择额外的区域代理...",
+ regionalAgentsAllSelected: "已选择所有可用代理",
+ regionalAgentsNoAvailable: "无可用区域代理",
+ regionalAgentsNoOnlineAvailable: "无可用在线区域代理",
+ regionalAgentsNotFoundMessage: "未找到在线区域代理。服务将使用默认监控。",
+ regionalAgentsNotSelectedMessage: "未选择区域代理。服务将使用默认监控。",
+
+ // ServiceUrlField.tsx
+ targetDefault: "目标 URL/Host",
+ targetDNS: "域名",
+ targetHTTPDesc: "输入完整的 URL,包括协议(http:// 或 https://)",
+ targetPINGDesc: "输入要 ping 的主机名或 IP 地址",
+ targetTCPDesc: "输入主机名或 IP 地址以进行 TCP 连接测试",
+ targetTCPPortDesc: "输入用于 TCP 连接测试的端口号",
+ targetDNSDesc: "输入要监控的 DNS 记录域名(A、AAAA、MX等)",
+ targetDefaultDesc: "输入要监控的目标 URL 或主机名",
+ targetDefaultPlaceholder: "输入 URL 或主机名",
+
+ // types.ts
+ serviceNameRequired: "服务名称是必填项",
+ urlDomainHostRequired: "URL/域名/主机名是必填项",
+ enterValidUrlHostnameDomain: "请输入有效的URL、主机名或域名",
+
+ // Dashboard
+ upServices: "在线服务",
+ downServices: "下线服务",
+ pausedServices: "暂停服务",
+ warningServices: "告警服务",
+};
\ No newline at end of file
diff --git a/application/src/translations/zhcn/settings.ts b/application/src/translations/zhcn/settings.ts
index 8f86b1b..a57757e 100644
--- a/application/src/translations/zhcn/settings.ts
+++ b/application/src/translations/zhcn/settings.ts
@@ -2,18 +2,18 @@
import { SettingsTranslations } from '../types/settings';
export const settingsTranslations: SettingsTranslations = {
- // Tabs
+ // General Settings - Tabs
systemSettings: "系统设置",
mailSettings: "邮件设置",
- // System Settings
+ // General Settings - System Settings
appName: "应用名称",
appURL: "应用 URL",
senderName: "发送者名称",
senderEmail: "发送者邮箱地址",
hideControls: "隐藏控件",
- // Mail Settings
+ // General Settings - Mail Settings
smtpSettings: "SMTP 配置",
smtpEnabled: "启用 SMTP",
smtpHost: "SMTP 主机",
@@ -24,7 +24,7 @@ export const settingsTranslations: SettingsTranslations = {
enableTLS: "启用 TLS",
localName: "本地名称",
- // Test Email
+ // General Settings - Test Email
testEmail: "测试邮箱",
sendTestEmail: "发送测试邮箱",
emailTemplate: "邮箱模板",
@@ -39,7 +39,7 @@ export const settingsTranslations: SettingsTranslations = {
enterEmailAddress: "输入收件人邮箱地址",
sending: "发送中...",
- // Actions and status
+ // General Settings - Actions and status
save: "保存变更",
saving: "保存中...",
settingsUpdated: "设置已成功更新",
@@ -48,5 +48,12 @@ export const settingsTranslations: SettingsTranslations = {
testConnection: "测试连接",
testingConnection: "测试连接中...",
connectionSuccess: "连接成功",
- connectionFailed: "连接失败"
-};
+ connectionFailed: "连接失败",
+
+ // User Management
+ addUser: "添加用户",
+ permissionNotice: "权限问题:",
+ permissionNoticeAddUser: "作为管理员用户,您无权查看或修改系统及邮件设置。这些设置仅超级管理员可访问和修改。如需更改系统配置或邮件设置,请联系您的超级管理员。",
+ loadingSettings: "加载设置中...",
+ loadingSettingsError: "加载设置时出错",
+};
\ No newline at end of file
diff --git a/application/src/translations/zhcn/ssl.ts b/application/src/translations/zhcn/ssl.ts
index a01249e..af4f7ae 100644
--- a/application/src/translations/zhcn/ssl.ts
+++ b/application/src/translations/zhcn/ssl.ts
@@ -112,5 +112,6 @@ export const sslTranslations: SSLTranslations = {
created: "创建时间",
lastUpdated: "最后更新时间",
lastNotification: "最后通知时间",
- collectionId: "集合 ID"
+ collectionId: "集合 ID",
+ noCertificatesFound: "未找到证书",
};
diff --git a/docs/DEVELOPMENT_ROADMAP.md b/docs/DEVELOPMENT_ROADMAP.md
index d0299a6..be995f4 100644
--- a/docs/DEVELOPMENT_ROADMAP.md
+++ b/docs/DEVELOPMENT_ROADMAP.md
@@ -55,7 +55,7 @@ The roadmap is divided into the following stages:
## 🗂 Milestone Overview
-### 📦 v1.0.0-1.3.0 – Initial Release _(Target: Q2 2025)_
+### 🚀 v1.0.0-1.3.0 – Initial Release _(Target: Q2 2025)_
**Status:** ✅ Completed
**Goal:** MVP feature completion, API stability, and core use-case readiness.
@@ -64,7 +64,7 @@ The roadmap is divided into the following stages:
---
### 🚀 v1.4 - 1.5 – Feature Enhancements _(Target: Q3 2025)_
-**Status:** 🔧 In Progress
+**Status:** ✅ Completed
#### Tentative Features:
- [ ] ✅ Server and Service Table row clickable to detail page.
- [ ] ✅ Implement pagination for the SSL dashboard table
@@ -73,14 +73,31 @@ The roadmap is divided into the following stages:
- [ ] ✅ Improve Uptime Service and Server connection update based on status and notification.
- [ ] ✅ Improve SSL perform the initial check automatically after creation
- [ ] ✅ Rate limiting and abuse protection
+- [ ] ✅ Add ntfy push notifications
+
+### 🚀 v1.6.0 – Feature Enhancements _(Target: Q3 2025)_
+**Status:** 🔧 In Progress
+#### Tentative Features:
+- [ ] ✅ Allow user to update the schema directly from the dashboard
+- [ ] ✅ Add Korean translations and update types. By @taking [#143](https://github.com/operacle/checkcle/pull/143)
+- [ ] ✅ Add Simplified Chinese translation. By @sqkkyzx [#128](https://github.com/operacle/checkcle/pull/128)
+- [ ] ✅ improve i18n and add new translations. @sqkkyzx [#132](https://github.com/operacle/checkcle/pull/132)
+- [ ] ✅ fix(incident): unify assigned user handling with fallback and UI update. By @ghotso [#142](https://github.com/operacle/checkcle/pull/142)
+- [ ] ✅ sync German translations across incident, maintenance, services & settings. By @ghotso [#141](https://github.com/operacle/checkcle/pull/141)
+- [ ] ✅ fix(services-form): max retry attempts. By @ghotso [#147](https://github.com/operacle/checkcle/pull/147)
+- [ ] ✅ Add Pushover notifications
+- [ ] 🔧 Enhance the Data retention feature
+- [ ] 🔧 Improve docker agent for server monitoring
+- [ ] 🔧 Improve the Server Agent on Unraid
- [ ] 🔧 Server Windows Agent
-- [ ] 🔧 Improve the Operational status page
- [ ] 🔧 More Uptime Service Type (HTTP keyword, HTTP json)
- [ ] 🔧 Server support with cpu temperature
-- [ ] 🔧 Server upport with multiple disks
+- [ ] 🔧 Server upport with multiple disks/volume
- [ ] 🔧 Server support with Multiple Network Interfaces
+- [ ] 🔧 Improve the Operational status page
+- [ ] 🔧 Server network bandwidth monitoring
- [ ] 🎯 Improve the Schedule and Incident for automation
-- [ ] 🎯 Uptime Monitoring option for choose: HTTP/HTTPS
+- [ ] 🎯 Uptime Monitoring option for choose: HTTP/HTTPS. Add Option to Bypass SSL Verification in Uptime
- [ ] 🎯 Add 2FA support
---
@@ -91,8 +108,7 @@ These are community-suggested or experimental features under review:
- [ ] Grouping uptime services
- [ ] OIDC Connect | OAuth2 integration
-- [ ] Mobile PWA support
-- [ ] Cloud-native Helm/Kubernetes deployment
+- [ ] PWA support
- [ ] Server outbound and inbound traffic usage
You’re welcome to propose features via [GitHub Discussions](https://github.com/operacle/checkcle/discussions) or open an issue with the `feature-request` template.
diff --git a/package-lock.json b/package-lock.json
new file mode 100644
index 0000000..cc76d8e
--- /dev/null
+++ b/package-lock.json
@@ -0,0 +1,6 @@
+{
+ "name": "checkcle",
+ "lockfileVersion": 3,
+ "requires": true,
+ "packages": {}
+}
diff --git a/server/pb_data/auxiliary.db b/server/pb_data/auxiliary.db
deleted file mode 100644
index b3c2a34..0000000
Binary files a/server/pb_data/auxiliary.db and /dev/null differ
diff --git a/server/pb_data/auxiliary.db-shm b/server/pb_data/auxiliary.db-shm
deleted file mode 100644
index 9a867ac..0000000
Binary files a/server/pb_data/auxiliary.db-shm and /dev/null differ
diff --git a/server/pb_data/auxiliary.db-wal b/server/pb_data/auxiliary.db-wal
deleted file mode 100644
index fe1b1ff..0000000
Binary files a/server/pb_data/auxiliary.db-wal and /dev/null differ
diff --git a/server/pb_data/data.db b/server/pb_data/data.db
deleted file mode 100644
index 8047a3c..0000000
Binary files a/server/pb_data/data.db and /dev/null differ
diff --git a/server/pb_data/data.db-shm b/server/pb_data/data.db-shm
deleted file mode 100644
index fe9ac28..0000000
Binary files a/server/pb_data/data.db-shm and /dev/null differ
diff --git a/server/pb_data/data.db-wal b/server/pb_data/data.db-wal
deleted file mode 100644
index e69de29..0000000
diff --git a/server/pb_data/types.d.ts b/server/pb_data/types.d.ts
deleted file mode 100644
index 2503831..0000000
--- a/server/pb_data/types.d.ts
+++ /dev/null
@@ -1,23030 +0,0 @@
-// 1746911627
-// GENERATED CODE - DO NOT MODIFY BY HAND
-
-// -------------------------------------------------------------------
-// cronBinds
-// -------------------------------------------------------------------
-
-/**
- * CronAdd registers a new cron job.
- *
- * If a cron job with the specified name already exist, it will be
- * replaced with the new one.
- *
- * Example:
- *
- * ```js
- * // prints "Hello world!" on every 30 minutes
- * cronAdd("hello", "*\/30 * * * *", () => {
- * console.log("Hello world!")
- * })
- * ```
- *
- * _Note that this method is available only in pb_hooks context._
- *
- * @group PocketBase
- */
-declare function cronAdd(
- jobId: string,
- cronExpr: string,
- handler: () => void,
-): void;
-
-/**
- * CronRemove removes a single registered cron job by its name.
- *
- * Example:
- *
- * ```js
- * cronRemove("hello")
- * ```
- *
- * _Note that this method is available only in pb_hooks context._
- *
- * @group PocketBase
- */
-declare function cronRemove(jobId: string): void;
-
-// -------------------------------------------------------------------
-// routerBinds
-// -------------------------------------------------------------------
-
-/**
- * RouterAdd registers a new route definition.
- *
- * Example:
- *
- * ```js
- * routerAdd("GET", "/hello", (e) => {
- * return e.json(200, {"message": "Hello!"})
- * }, $apis.requireAuth())
- * ```
- *
- * _Note that this method is available only in pb_hooks context._
- *
- * @group PocketBase
- */
-declare function routerAdd(
- method: string,
- path: string,
- handler: (e: core.RequestEvent) => void,
- ...middlewares: Array void)|Middleware>,
-): void;
-
-/**
- * RouterUse registers one or more global middlewares that are executed
- * along the handler middlewares after a matching route is found.
- *
- * Example:
- *
- * ```js
- * routerUse((e) => {
- * console.log(e.request.url.path)
- * return e.next()
- * })
- * ```
- *
- * _Note that this method is available only in pb_hooks context._
- *
- * @group PocketBase
- */
-declare function routerUse(...middlewares: Array void)|Middleware>): void;
-
-// -------------------------------------------------------------------
-// baseBinds
-// -------------------------------------------------------------------
-
-/**
- * Global helper variable that contains the absolute path to the app pb_hooks directory.
- *
- * @group PocketBase
- */
-declare var __hooks: string
-
-// Utility type to exclude the on* hook methods from a type
-// (hooks are separately generated as global methods).
-//
-// See https://www.typescriptlang.org/docs/handbook/2/mapped-types.html#key-remapping-via-as
-type excludeHooks = {
- [Property in keyof Type as Exclude]: Type[Property]
-};
-
-// CoreApp without the on* hook methods
-type CoreApp = excludeHooks
-
-// PocketBase without the on* hook methods
-type PocketBase = excludeHooks
-
-/**
- * `$app` is the current running PocketBase instance that is globally
- * available in each .pb.js file.
- *
- * _Note that this variable is available only in pb_hooks context._
- *
- * @namespace
- * @group PocketBase
- */
-declare var $app: PocketBase
-
-/**
- * `$template` is a global helper to load and cache HTML templates on the fly.
- *
- * The templates uses the standard Go [html/template](https://pkg.go.dev/html/template)
- * and [text/template](https://pkg.go.dev/text/template) package syntax.
- *
- * Example:
- *
- * ```js
- * const html = $template.loadFiles(
- * "views/layout.html",
- * "views/content.html",
- * ).render({"name": "John"})
- * ```
- *
- * _Note that this method is available only in pb_hooks context._
- *
- * @namespace
- * @group PocketBase
- */
-declare var $template: template.Registry
-
-/**
- * This method is superseded by toString.
- *
- * @deprecated
- * @group PocketBase
- */
-declare function readerToString(reader: any, maxBytes?: number): string;
-
-/**
- * toString stringifies the specified value.
- *
- * Support optional second maxBytes argument to limit the max read bytes
- * when the value is a io.Reader (default to 32MB).
- *
- * Types that don't have explicit string representation are json serialized.
- *
- * Example:
- *
- * ```js
- * // io.Reader
- * const ex1 = toString(e.request.body)
- *
- * // slice of bytes ("hello")
- * const ex2 = toString([104 101 108 108 111])
- * ```
- *
- * @group PocketBase
- */
-declare function toString(val: any, maxBytes?: number): string;
-
-/**
- * sleep pauses the current goroutine for at least the specified user duration (in ms).
- * A zero or negative duration returns immediately.
- *
- * Example:
- *
- * ```js
- * sleep(250) // sleeps for 250ms
- * ```
- *
- * @group PocketBase
- */
-declare function sleep(milliseconds: number): void;
-
-/**
- * arrayOf creates a placeholder array of the specified models.
- * Usually used to populate DB result into an array of models.
- *
- * Example:
- *
- * ```js
- * const records = arrayOf(new Record)
- *
- * $app.recordQuery("articles").limit(10).all(records)
- * ```
- *
- * @group PocketBase
- */
-declare function arrayOf(model: T): Array;
-
-/**
- * DynamicModel creates a new dynamic model with fields from the provided data shape.
- *
- * Note that in order to use 0 as double/float initialization number you have to use negative zero (`-0`).
- *
- * Example:
- *
- * ```js
- * const model = new DynamicModel({
- * name: ""
- * age: 0, // int64
- * totalSpent: -0, // float64
- * active: false,
- * roles: [],
- * meta: {}
- * })
- * ```
- *
- * @group PocketBase
- */
-declare class DynamicModel {
- constructor(shape?: { [key:string]: any })
-}
-
-interface Context extends context.Context{} // merge
-/**
- * Context creates a new empty Go context.Context.
- *
- * This is usually used as part of some Go transitive bindings.
- *
- * Example:
- *
- * ```js
- * const blank = new Context()
- *
- * // with single key-value pair
- * const base = new Context(null, "a", 123)
- * console.log(base.value("a")) // 123
- *
- * // extend with additional key-value pair
- * const sub = new Context(base, "b", 456)
- * console.log(sub.value("a")) // 123
- * console.log(sub.value("b")) // 456
- * ```
- *
- * @group PocketBase
- */
-declare class Context implements context.Context {
- constructor(parentCtx?: Context, key?: any, value?: any)
-}
-
-/**
- * Record model class.
- *
- * ```js
- * const collection = $app.findCollectionByNameOrId("article")
- *
- * const record = new Record(collection, {
- * title: "Lorem ipsum"
- * })
- *
- * // or set field values after the initialization
- * record.set("description", "...")
- * ```
- *
- * @group PocketBase
- */
-declare const Record: {
- new(collection?: core.Collection, data?: { [key:string]: any }): core.Record
-
- // note: declare as "newable" const due to conflict with the Record TS utility type
-}
-
-interface Collection extends core.Collection{
- type: "base" | "view" | "auth"
-} // merge
-/**
- * Collection model class.
- *
- * ```js
- * const collection = new Collection({
- * type: "base",
- * name: "article",
- * listRule: "@request.auth.id != '' || status = 'public'",
- * viewRule: "@request.auth.id != '' || status = 'public'",
- * deleteRule: "@request.auth.id != ''",
- * fields: [
- * {
- * name: "title",
- * type: "text",
- * required: true,
- * min: 6,
- * max: 100,
- * },
- * {
- * name: "description",
- * type: "text",
- * },
- * ]
- * })
- * ```
- *
- * @group PocketBase
- */
-declare class Collection implements core.Collection {
- constructor(data?: Partial)
-}
-
-interface FieldsList extends core.FieldsList{} // merge
-/**
- * FieldsList model class, usually used to define the Collection.fields.
- *
- * @group PocketBase
- */
-declare class FieldsList implements core.FieldsList {
- constructor(data?: Partial)
-}
-
-interface Field extends core.Field{} // merge
-/**
- * Field model class, usually used as part of the FieldsList model.
- *
- * @group PocketBase
- */
-declare class Field implements core.Field {
- constructor(data?: Partial)
-}
-
-interface NumberField extends core.NumberField{} // merge
-/**
- * {@inheritDoc core.NumberField}
- *
- * @group PocketBase
- */
-declare class NumberField implements core.NumberField {
- constructor(data?: Partial)
-}
-
-interface BoolField extends core.BoolField{} // merge
-/**
- * {@inheritDoc core.BoolField}
- *
- * @group PocketBase
- */
-declare class BoolField implements core.BoolField {
- constructor(data?: Partial)
-}
-
-interface TextField extends core.TextField{} // merge
-/**
- * {@inheritDoc core.TextField}
- *
- * @group PocketBase
- */
-declare class TextField implements core.TextField {
- constructor(data?: Partial)
-}
-
-interface URLField extends core.URLField{} // merge
-/**
- * {@inheritDoc core.URLField}
- *
- * @group PocketBase
- */
-declare class URLField implements core.URLField {
- constructor(data?: Partial)
-}
-
-interface EmailField extends core.EmailField{} // merge
-/**
- * {@inheritDoc core.EmailField}
- *
- * @group PocketBase
- */
-declare class EmailField implements core.EmailField {
- constructor(data?: Partial)
-}
-
-interface EditorField extends core.EditorField{} // merge
-/**
- * {@inheritDoc core.EditorField}
- *
- * @group PocketBase
- */
-declare class EditorField implements core.EditorField {
- constructor(data?: Partial)
-}
-
-interface PasswordField extends core.PasswordField{} // merge
-/**
- * {@inheritDoc core.PasswordField}
- *
- * @group PocketBase
- */
-declare class PasswordField implements core.PasswordField {
- constructor(data?: Partial)
-}
-
-interface DateField extends core.DateField{} // merge
-/**
- * {@inheritDoc core.DateField}
- *
- * @group PocketBase
- */
-declare class DateField implements core.DateField {
- constructor(data?: Partial)
-}
-
-interface AutodateField extends core.AutodateField{} // merge
-/**
- * {@inheritDoc core.AutodateField}
- *
- * @group PocketBase
- */
-declare class AutodateField implements core.AutodateField {
- constructor(data?: Partial)
-}
-
-interface JSONField extends core.JSONField{} // merge
-/**
- * {@inheritDoc core.JSONField}
- *
- * @group PocketBase
- */
-declare class JSONField implements core.JSONField {
- constructor(data?: Partial)
-}
-
-interface RelationField extends core.RelationField{} // merge
-/**
- * {@inheritDoc core.RelationField}
- *
- * @group PocketBase
- */
-declare class RelationField implements core.RelationField {
- constructor(data?: Partial)
-}
-
-interface SelectField extends core.SelectField{} // merge
-/**
- * {@inheritDoc core.SelectField}
- *
- * @group PocketBase
- */
-declare class SelectField implements core.SelectField {
- constructor(data?: Partial)
-}
-
-interface FileField extends core.FileField{} // merge
-/**
- * {@inheritDoc core.FileField}
- *
- * @group PocketBase
- */
-declare class FileField implements core.FileField {
- constructor(data?: Partial)
-}
-
-interface GeoPointField extends core.GeoPointField{} // merge
-/**
- * {@inheritDoc core.GeoPointField}
- *
- * @group PocketBase
- */
-declare class GeoPointField implements core.GeoPointField {
- constructor(data?: Partial)
-}
-
-interface MailerMessage extends mailer.Message{} // merge
-/**
- * MailerMessage defines a single email message.
- *
- * ```js
- * const message = new MailerMessage({
- * from: {
- * address: $app.settings().meta.senderAddress,
- * name: $app.settings().meta.senderName,
- * },
- * to: [{address: "test@example.com"}],
- * subject: "YOUR_SUBJECT...",
- * html: "YOUR_HTML_BODY...",
- * })
- *
- * $app.newMailClient().send(message)
- * ```
- *
- * @group PocketBase
- */
-declare class MailerMessage implements mailer.Message {
- constructor(message?: Partial)
-}
-
-interface Command extends cobra.Command{} // merge
-/**
- * Command defines a single console command.
- *
- * Example:
- *
- * ```js
- * const command = new Command({
- * use: "hello",
- * run: (cmd, args) => { console.log("Hello world!") },
- * })
- *
- * $app.rootCmd.addCommand(command);
- * ```
- *
- * @group PocketBase
- */
-declare class Command implements cobra.Command {
- constructor(cmd?: Partial)
-}
-
-/**
- * RequestInfo defines a single core.RequestInfo instance, usually used
- * as part of various filter checks.
- *
- * Example:
- *
- * ```js
- * const authRecord = $app.findAuthRecordByEmail("users", "test@example.com")
- *
- * const info = new RequestInfo({
- * auth: authRecord,
- * body: {"name": 123},
- * headers: {"x-token": "..."},
- * })
- *
- * const record = $app.findFirstRecordByData("articles", "slug", "hello")
- *
- * const canAccess = $app.canAccessRecord(record, info, "@request.auth.id != '' && @request.body.name = 123")
- * ```
- *
- * @group PocketBase
- */
-declare const RequestInfo: {
- new(info?: Partial): core.RequestInfo
-
- // note: declare as "newable" const due to conflict with the RequestInfo TS node type
-}
-
-/**
- * Middleware defines a single request middleware handler.
- *
- * This class is usually used when you want to explicitly specify a priority to your custom route middleware.
- *
- * Example:
- *
- * ```js
- * routerUse(new Middleware((e) => {
- * console.log(e.request.url.path)
- * return e.next()
- * }, -10))
- * ```
- *
- * @group PocketBase
- */
-declare class Middleware {
- constructor(
- func: string|((e: core.RequestEvent) => void),
- priority?: number,
- id?: string,
- )
-}
-
-interface Timezone extends time.Location{} // merge
-/**
- * Timezone returns the timezone location with the given name.
- *
- * The name is expected to be a location name corresponding to a file
- * in the IANA Time Zone database, such as "America/New_York".
- *
- * If the name is "Local", LoadLocation returns Local.
- *
- * If the name is "", invalid or "UTC", returns UTC.
- *
- * The constructor is equivalent to calling the Go `time.LoadLocation(name)` method.
- *
- * Example:
- *
- * ```js
- * const zone = new Timezone("America/New_York")
- * $app.cron().setTimezone(zone)
- * ```
- *
- * @group PocketBase
- */
-declare class Timezone implements time.Location {
- constructor(name?: string)
-}
-
-interface DateTime extends types.DateTime{} // merge
-/**
- * DateTime defines a single DateTime type instance.
- * The returned date is always represented in UTC.
- *
- * Example:
- *
- * ```js
- * const dt0 = new DateTime() // now
- *
- * // full datetime string
- * const dt1 = new DateTime('2023-07-01 00:00:00.000Z')
- *
- * // datetime string with default "parse in" timezone location
- * //
- * // similar to new DateTime('2023-07-01 00:00:00 +01:00') or new DateTime('2023-07-01 00:00:00 +02:00')
- * // but accounts for the daylight saving time (DST)
- * const dt2 = new DateTime('2023-07-01 00:00:00', 'Europe/Amsterdam')
- * ```
- *
- * @group PocketBase
- */
-declare class DateTime implements types.DateTime {
- constructor(date?: string, defaultParseInLocation?: string)
-}
-
-interface ValidationError extends ozzo_validation.Error{} // merge
-/**
- * ValidationError defines a single formatted data validation error,
- * usually used as part of an error response.
- *
- * ```js
- * new ValidationError("invalid_title", "Title is not valid")
- * ```
- *
- * @group PocketBase
- */
-declare class ValidationError implements ozzo_validation.Error {
- constructor(code?: string, message?: string)
-}
-
-interface Cookie extends http.Cookie{} // merge
-/**
- * A Cookie represents an HTTP cookie as sent in the Set-Cookie header of an
- * HTTP response.
- *
- * Example:
- *
- * ```js
- * routerAdd("POST", "/example", (c) => {
- * c.setCookie(new Cookie({
- * name: "example_name",
- * value: "example_value",
- * path: "/",
- * domain: "example.com",
- * maxAge: 10,
- * secure: true,
- * httpOnly: true,
- * sameSite: 3,
- * }))
- *
- * return c.redirect(200, "/");
- * })
- * ```
- *
- * @group PocketBase
- */
-declare class Cookie implements http.Cookie {
- constructor(options?: Partial)
-}
-
-interface SubscriptionMessage extends subscriptions.Message{} // merge
-/**
- * SubscriptionMessage defines a realtime subscription payload.
- *
- * Example:
- *
- * ```js
- * onRealtimeConnectRequest((e) => {
- * e.client.send(new SubscriptionMessage({
- * name: "example",
- * data: '{"greeting": "Hello world"}'
- * }))
- * })
- * ```
- *
- * @group PocketBase
- */
-declare class SubscriptionMessage implements subscriptions.Message {
- constructor(options?: Partial)
-}
-
-// -------------------------------------------------------------------
-// dbxBinds
-// -------------------------------------------------------------------
-
-/**
- * `$dbx` defines common utility for working with the DB abstraction.
- * For examples and guides please check the [Database guide](https://pocketbase.io/docs/js-database).
- *
- * @group PocketBase
- */
-declare namespace $dbx {
- /**
- * {@inheritDoc dbx.HashExp}
- */
- export function hashExp(pairs: { [key:string]: any }): dbx.Expression
-
- let _in: dbx._in
- export { _in as in }
-
- export let exp: dbx.newExp
- export let not: dbx.not
- export let and: dbx.and
- export let or: dbx.or
- export let notIn: dbx.notIn
- export let like: dbx.like
- export let orLike: dbx.orLike
- export let notLike: dbx.notLike
- export let orNotLike: dbx.orNotLike
- export let exists: dbx.exists
- export let notExists: dbx.notExists
- export let between: dbx.between
- export let notBetween: dbx.notBetween
-}
-
-// -------------------------------------------------------------------
-// mailsBinds
-// -------------------------------------------------------------------
-
-/**
- * `$mails` defines helpers to send common
- * auth records emails like verification, password reset, etc.
- *
- * @group PocketBase
- */
-declare namespace $mails {
- let sendRecordPasswordReset: mails.sendRecordPasswordReset
- let sendRecordVerification: mails.sendRecordVerification
- let sendRecordChangeEmail: mails.sendRecordChangeEmail
- let sendRecordOTP: mails.sendRecordOTP
-}
-
-// -------------------------------------------------------------------
-// securityBinds
-// -------------------------------------------------------------------
-
-/**
- * `$security` defines low level helpers for creating
- * and parsing JWTs, random string generation, AES encryption, etc.
- *
- * @group PocketBase
- */
-declare namespace $security {
- let randomString: security.randomString
- let randomStringWithAlphabet: security.randomStringWithAlphabet
- let randomStringByRegex: security.randomStringByRegex
- let pseudorandomString: security.pseudorandomString
- let pseudorandomStringWithAlphabet: security.pseudorandomStringWithAlphabet
- let encrypt: security.encrypt
- let decrypt: security.decrypt
- let hs256: security.hs256
- let hs512: security.hs512
- let equal: security.equal
- let md5: security.md5
- let sha256: security.sha256
- let sha512: security.sha512
-
- /**
- * {@inheritDoc security.newJWT}
- */
- export function createJWT(payload: { [key:string]: any }, signingKey: string, secDuration: number): string
-
- /**
- * {@inheritDoc security.parseUnverifiedJWT}
- */
- export function parseUnverifiedJWT(token: string): _TygojaDict
-
- /**
- * {@inheritDoc security.parseJWT}
- */
- export function parseJWT(token: string, verificationKey: string): _TygojaDict
-}
-
-// -------------------------------------------------------------------
-// filesystemBinds
-// -------------------------------------------------------------------
-
-/**
- * `$filesystem` defines common helpers for working
- * with the PocketBase filesystem abstraction.
- *
- * @group PocketBase
- */
-declare namespace $filesystem {
- let fileFromPath: filesystem.newFileFromPath
- let fileFromBytes: filesystem.newFileFromBytes
- let fileFromMultipart: filesystem.newFileFromMultipart
-
- /**
- * fileFromURL creates a new File from the provided url by
- * downloading the resource and creating a BytesReader.
- *
- * Example:
- *
- * ```js
- * // with default max timeout of 120sec
- * const file1 = $filesystem.fileFromURL("https://...")
- *
- * // with custom timeout of 15sec
- * const file2 = $filesystem.fileFromURL("https://...", 15)
- * ```
- */
- export function fileFromURL(url: string, secTimeout?: number): filesystem.File
-}
-
-// -------------------------------------------------------------------
-// filepathBinds
-// -------------------------------------------------------------------
-
-/**
- * `$filepath` defines common helpers for manipulating filename
- * paths in a way compatible with the target operating system-defined file paths.
- *
- * @group PocketBase
- */
-declare namespace $filepath {
- export let base: filepath.base
- export let clean: filepath.clean
- export let dir: filepath.dir
- export let ext: filepath.ext
- export let fromSlash: filepath.fromSlash
- export let glob: filepath.glob
- export let isAbs: filepath.isAbs
- export let join: filepath.join
- export let match: filepath.match
- export let rel: filepath.rel
- export let split: filepath.split
- export let splitList: filepath.splitList
- export let toSlash: filepath.toSlash
- export let walk: filepath.walk
- export let walkDir: filepath.walkDir
-}
-
-// -------------------------------------------------------------------
-// osBinds
-// -------------------------------------------------------------------
-
-/**
- * `$os` defines common helpers for working with the OS level primitives
- * (eg. deleting directories, executing shell commands, etc.).
- *
- * @group PocketBase
- */
-declare namespace $os {
- /**
- * Legacy alias for $os.cmd().
- */
- export let exec: exec.command
-
- /**
- * Prepares an external OS command.
- *
- * Example:
- *
- * ```js
- * // prepare the command to execute
- * const cmd = $os.cmd('ls', '-sl')
- *
- * // execute the command and return its standard output as string
- * const output = toString(cmd.output());
- * ```
- */
- export let cmd: exec.command
-
- /**
- * Args hold the command-line arguments, starting with the program name.
- */
- export let args: Array
-
- export let exit: os.exit
- export let getenv: os.getenv
- export let dirFS: os.dirFS
- export let readFile: os.readFile
- export let writeFile: os.writeFile
- export let stat: os.stat
- export let readDir: os.readDir
- export let tempDir: os.tempDir
- export let truncate: os.truncate
- export let getwd: os.getwd
- export let mkdir: os.mkdir
- export let mkdirAll: os.mkdirAll
- export let rename: os.rename
- export let remove: os.remove
- export let removeAll: os.removeAll
-}
-
-// -------------------------------------------------------------------
-// formsBinds
-// -------------------------------------------------------------------
-
-interface AppleClientSecretCreateForm extends forms.AppleClientSecretCreate{} // merge
-/**
- * @inheritDoc
- * @group PocketBase
- */
-declare class AppleClientSecretCreateForm implements forms.AppleClientSecretCreate {
- constructor(app: CoreApp)
-}
-
-interface RecordUpsertForm extends forms.RecordUpsert{} // merge
-/**
- * @inheritDoc
- * @group PocketBase
- */
-declare class RecordUpsertForm implements forms.RecordUpsert {
- constructor(app: CoreApp, record: core.Record)
-}
-
-interface TestEmailSendForm extends forms.TestEmailSend{} // merge
-/**
- * @inheritDoc
- * @group PocketBase
- */
-declare class TestEmailSendForm implements forms.TestEmailSend {
- constructor(app: CoreApp)
-}
-
-interface TestS3FilesystemForm extends forms.TestS3Filesystem{} // merge
-/**
- * @inheritDoc
- * @group PocketBase
- */
-declare class TestS3FilesystemForm implements forms.TestS3Filesystem {
- constructor(app: CoreApp)
-}
-
-// -------------------------------------------------------------------
-// apisBinds
-// -------------------------------------------------------------------
-
-interface ApiError extends router.ApiError{} // merge
-/**
- * @inheritDoc
- *
- * @group PocketBase
- */
-declare class ApiError implements router.ApiError {
- constructor(status?: number, message?: string, data?: any)
-}
-
-interface NotFoundError extends router.ApiError{} // merge
-/**
- * NotFounderor returns 404 ApiError.
- *
- * @group PocketBase
- */
-declare class NotFoundError implements router.ApiError {
- constructor(message?: string, data?: any)
-}
-
-interface BadRequestError extends router.ApiError{} // merge
-/**
- * BadRequestError returns 400 ApiError.
- *
- * @group PocketBase
- */
-declare class BadRequestError implements router.ApiError {
- constructor(message?: string, data?: any)
-}
-
-interface ForbiddenError extends router.ApiError{} // merge
-/**
- * ForbiddenError returns 403 ApiError.
- *
- * @group PocketBase
- */
-declare class ForbiddenError implements router.ApiError {
- constructor(message?: string, data?: any)
-}
-
-interface UnauthorizedError extends router.ApiError{} // merge
-/**
- * UnauthorizedError returns 401 ApiError.
- *
- * @group PocketBase
- */
-declare class UnauthorizedError implements router.ApiError {
- constructor(message?: string, data?: any)
-}
-
-interface TooManyRequestsError extends router.ApiError{} // merge
-/**
- * TooManyRequestsError returns 429 ApiError.
- *
- * @group PocketBase
- */
-declare class TooManyRequestsError implements router.ApiError {
- constructor(message?: string, data?: any)
-}
-
-interface InternalServerError extends router.ApiError{} // merge
-/**
- * InternalServerError returns 429 ApiError.
- *
- * @group PocketBase
- */
-declare class InternalServerError implements router.ApiError {
- constructor(message?: string, data?: any)
-}
-
-/**
- * `$apis` defines commonly used PocketBase api helpers and middlewares.
- *
- * @group PocketBase
- */
-declare namespace $apis {
- /**
- * Route handler to serve static directory content (html, js, css, etc.).
- *
- * If a file resource is missing and indexFallback is set, the request
- * will be forwarded to the base index.html (useful for SPA).
- */
- export function static(dir: string, indexFallback: boolean): (e: core.RequestEvent) => void
-
- let requireGuestOnly: apis.requireGuestOnly
- let requireAuth: apis.requireAuth
- let requireSuperuserAuth: apis.requireSuperuserAuth
- let requireSuperuserOrOwnerAuth: apis.requireSuperuserOrOwnerAuth
- let skipSuccessActivityLog: apis.skipSuccessActivityLog
- let gzip: apis.gzip
- let bodyLimit: apis.bodyLimit
- let enrichRecord: apis.enrichRecord
- let enrichRecords: apis.enrichRecords
-
- /**
- * RecordAuthResponse writes standardized json record auth response
- * into the specified request event.
- *
- * The authMethod argument specify the name of the current authentication method (eg. password, oauth2, etc.)
- * that it is used primarily as an auth identifier during MFA and for login alerts.
- *
- * Set authMethod to empty string if you want to ignore the MFA checks and the login alerts
- * (can be also adjusted additionally via the onRecordAuthRequest hook).
- */
- export function recordAuthResponse(e: core.RequestEvent, authRecord: core.Record, authMethod: string, meta?: any): void
-}
-
-// -------------------------------------------------------------------
-// httpClientBinds
-// -------------------------------------------------------------------
-
-// extra FormData overload to prevent TS warnings when used with non File/Blob value.
-interface FormData {
- append(key:string, value:any): void
- set(key:string, value:any): void
-}
-
-/**
- * `$http` defines common methods for working with HTTP requests.
- *
- * @group PocketBase
- */
-declare namespace $http {
- /**
- * Sends a single HTTP request.
- *
- * Example:
- *
- * ```js
- * const res = $http.send({
- * method: "POST",
- * url: "https://example.com",
- * body: JSON.stringify({"title": "test"}),
- * headers: { 'Content-Type': 'application/json' }
- * })
- *
- * console.log(res.statusCode) // the response HTTP status code
- * console.log(res.headers) // the response headers (eg. res.headers['X-Custom'][0])
- * console.log(res.cookies) // the response cookies (eg. res.cookies.sessionId.value)
- * console.log(res.body) // the response body as raw bytes slice
- * console.log(res.json) // the response body as parsed json array or map
- * ```
- */
- function send(config: {
- url: string,
- body?: string|FormData,
- method?: string, // default to "GET"
- headers?: { [key:string]: string },
- timeout?: number, // default to 120
-
- // @deprecated please use body instead
- data?: { [key:string]: any },
- }): {
- statusCode: number,
- headers: { [key:string]: Array },
- cookies: { [key:string]: http.Cookie },
- json: any,
- body: Array,
-
- // @deprecated please use toString(result.body) instead
- raw: string,
- };
-}
-
-// -------------------------------------------------------------------
-// migrate only
-// -------------------------------------------------------------------
-
-/**
- * Migrate defines a single migration upgrade/downgrade action.
- *
- * _Note that this method is available only in pb_migrations context._
- *
- * @group PocketBase
- */
-declare function migrate(
- up: (txApp: CoreApp) => void,
- down?: (txApp: CoreApp) => void
-): void;
-/** @group PocketBase */declare function onBackupCreate(handler: (e: core.BackupEvent) => void): void
-/** @group PocketBase */declare function onBackupRestore(handler: (e: core.BackupEvent) => void): void
-/** @group PocketBase */declare function onBatchRequest(handler: (e: core.BatchRequestEvent) => void): void
-/** @group PocketBase */declare function onBootstrap(handler: (e: core.BootstrapEvent) => void): void
-/** @group PocketBase */declare function onCollectionAfterCreateError(handler: (e: core.CollectionErrorEvent) => void, ...tags: string[]): void
-/** @group PocketBase */declare function onCollectionAfterCreateSuccess(handler: (e: core.CollectionEvent) => void, ...tags: string[]): void
-/** @group PocketBase */declare function onCollectionAfterDeleteError(handler: (e: core.CollectionErrorEvent) => void, ...tags: string[]): void
-/** @group PocketBase */declare function onCollectionAfterDeleteSuccess(handler: (e: core.CollectionEvent) => void, ...tags: string[]): void
-/** @group PocketBase */declare function onCollectionAfterUpdateError(handler: (e: core.CollectionErrorEvent) => void, ...tags: string[]): void
-/** @group PocketBase */declare function onCollectionAfterUpdateSuccess(handler: (e: core.CollectionEvent) => void, ...tags: string[]): void
-/** @group PocketBase */declare function onCollectionCreate(handler: (e: core.CollectionEvent) => void, ...tags: string[]): void
-/** @group PocketBase */declare function onCollectionCreateExecute(handler: (e: core.CollectionEvent) => void, ...tags: string[]): void
-/** @group PocketBase */declare function onCollectionCreateRequest(handler: (e: core.CollectionRequestEvent) => void): void
-/** @group PocketBase */declare function onCollectionDelete(handler: (e: core.CollectionEvent) => void, ...tags: string[]): void
-/** @group PocketBase */declare function onCollectionDeleteExecute(handler: (e: core.CollectionEvent) => void, ...tags: string[]): void
-/** @group PocketBase */declare function onCollectionDeleteRequest(handler: (e: core.CollectionRequestEvent) => void): void
-/** @group PocketBase */declare function onCollectionUpdate(handler: (e: core.CollectionEvent) => void, ...tags: string[]): void
-/** @group PocketBase */declare function onCollectionUpdateExecute(handler: (e: core.CollectionEvent) => void, ...tags: string[]): void
-/** @group PocketBase */declare function onCollectionUpdateRequest(handler: (e: core.CollectionRequestEvent) => void): void
-/** @group PocketBase */declare function onCollectionValidate(handler: (e: core.CollectionEvent) => void, ...tags: string[]): void
-/** @group PocketBase */declare function onCollectionViewRequest(handler: (e: core.CollectionRequestEvent) => void): void
-/** @group PocketBase */declare function onCollectionsImportRequest(handler: (e: core.CollectionsImportRequestEvent) => void): void
-/** @group PocketBase */declare function onCollectionsListRequest(handler: (e: core.CollectionsListRequestEvent) => void): void
-/** @group PocketBase */declare function onFileDownloadRequest(handler: (e: core.FileDownloadRequestEvent) => void, ...tags: string[]): void
-/** @group PocketBase */declare function onFileTokenRequest(handler: (e: core.FileTokenRequestEvent) => void, ...tags: string[]): void
-/** @group PocketBase */declare function onMailerRecordAuthAlertSend(handler: (e: core.MailerRecordEvent) => void, ...tags: string[]): void
-/** @group PocketBase */declare function onMailerRecordEmailChangeSend(handler: (e: core.MailerRecordEvent) => void, ...tags: string[]): void
-/** @group PocketBase */declare function onMailerRecordOTPSend(handler: (e: core.MailerRecordEvent) => void, ...tags: string[]): void
-/** @group PocketBase */declare function onMailerRecordPasswordResetSend(handler: (e: core.MailerRecordEvent) => void, ...tags: string[]): void
-/** @group PocketBase */declare function onMailerRecordVerificationSend(handler: (e: core.MailerRecordEvent) => void, ...tags: string[]): void
-/** @group PocketBase */declare function onMailerSend(handler: (e: core.MailerEvent) => void): void
-/** @group PocketBase */declare function onModelAfterCreateError(handler: (e: core.ModelErrorEvent) => void, ...tags: string[]): void
-/** @group PocketBase */declare function onModelAfterCreateSuccess(handler: (e: core.ModelEvent) => void, ...tags: string[]): void
-/** @group PocketBase */declare function onModelAfterDeleteError(handler: (e: core.ModelErrorEvent) => void, ...tags: string[]): void
-/** @group PocketBase */declare function onModelAfterDeleteSuccess(handler: (e: core.ModelEvent) => void, ...tags: string[]): void
-/** @group PocketBase */declare function onModelAfterUpdateError(handler: (e: core.ModelErrorEvent) => void, ...tags: string[]): void
-/** @group PocketBase */declare function onModelAfterUpdateSuccess(handler: (e: core.ModelEvent) => void, ...tags: string[]): void
-/** @group PocketBase */declare function onModelCreate(handler: (e: core.ModelEvent) => void, ...tags: string[]): void
-/** @group PocketBase */declare function onModelCreateExecute(handler: (e: core.ModelEvent) => void, ...tags: string[]): void
-/** @group PocketBase */declare function onModelDelete(handler: (e: core.ModelEvent) => void, ...tags: string[]): void
-/** @group PocketBase */declare function onModelDeleteExecute(handler: (e: core.ModelEvent) => void, ...tags: string[]): void
-/** @group PocketBase */declare function onModelUpdate(handler: (e: core.ModelEvent) => void, ...tags: string[]): void
-/** @group PocketBase */declare function onModelUpdateExecute(handler: (e: core.ModelEvent) => void, ...tags: string[]): void
-/** @group PocketBase */declare function onModelValidate(handler: (e: core.ModelEvent) => void, ...tags: string[]): void
-/** @group PocketBase */declare function onRealtimeConnectRequest(handler: (e: core.RealtimeConnectRequestEvent) => void): void
-/** @group PocketBase */declare function onRealtimeMessageSend(handler: (e: core.RealtimeMessageEvent) => void): void
-/** @group PocketBase */declare function onRealtimeSubscribeRequest(handler: (e: core.RealtimeSubscribeRequestEvent) => void): void
-/** @group PocketBase */declare function onRecordAfterCreateError(handler: (e: core.RecordErrorEvent) => void, ...tags: string[]): void
-/** @group PocketBase */declare function onRecordAfterCreateSuccess(handler: (e: core.RecordEvent) => void, ...tags: string[]): void
-/** @group PocketBase */declare function onRecordAfterDeleteError(handler: (e: core.RecordErrorEvent) => void, ...tags: string[]): void
-/** @group PocketBase */declare function onRecordAfterDeleteSuccess(handler: (e: core.RecordEvent) => void, ...tags: string[]): void
-/** @group PocketBase */declare function onRecordAfterUpdateError(handler: (e: core.RecordErrorEvent) => void, ...tags: string[]): void
-/** @group PocketBase */declare function onRecordAfterUpdateSuccess(handler: (e: core.RecordEvent) => void, ...tags: string[]): void
-/** @group PocketBase */declare function onRecordAuthRefreshRequest(handler: (e: core.RecordAuthRefreshRequestEvent) => void, ...tags: string[]): void
-/** @group PocketBase */declare function onRecordAuthRequest(handler: (e: core.RecordAuthRequestEvent) => void, ...tags: string[]): void
-/** @group PocketBase */declare function onRecordAuthWithOAuth2Request(handler: (e: core.RecordAuthWithOAuth2RequestEvent) => void, ...tags: string[]): void
-/** @group PocketBase */declare function onRecordAuthWithOTPRequest(handler: (e: core.RecordAuthWithOTPRequestEvent) => void, ...tags: string[]): void
-/** @group PocketBase */declare function onRecordAuthWithPasswordRequest(handler: (e: core.RecordAuthWithPasswordRequestEvent) => void, ...tags: string[]): void
-/** @group PocketBase */declare function onRecordConfirmEmailChangeRequest(handler: (e: core.RecordConfirmEmailChangeRequestEvent) => void, ...tags: string[]): void
-/** @group PocketBase */declare function onRecordConfirmPasswordResetRequest(handler: (e: core.RecordConfirmPasswordResetRequestEvent) => void, ...tags: string[]): void
-/** @group PocketBase */declare function onRecordConfirmVerificationRequest(handler: (e: core.RecordConfirmVerificationRequestEvent) => void, ...tags: string[]): void
-/** @group PocketBase */declare function onRecordCreate(handler: (e: core.RecordEvent) => void, ...tags: string[]): void
-/** @group PocketBase */declare function onRecordCreateExecute(handler: (e: core.RecordEvent) => void, ...tags: string[]): void
-/** @group PocketBase */declare function onRecordCreateRequest(handler: (e: core.RecordRequestEvent) => void, ...tags: string[]): void
-/** @group PocketBase */declare function onRecordDelete(handler: (e: core.RecordEvent) => void, ...tags: string[]): void
-/** @group PocketBase */declare function onRecordDeleteExecute(handler: (e: core.RecordEvent) => void, ...tags: string[]): void
-/** @group PocketBase */declare function onRecordDeleteRequest(handler: (e: core.RecordRequestEvent) => void, ...tags: string[]): void
-/** @group PocketBase */declare function onRecordEnrich(handler: (e: core.RecordEnrichEvent) => void, ...tags: string[]): void
-/** @group PocketBase */declare function onRecordRequestEmailChangeRequest(handler: (e: core.RecordRequestEmailChangeRequestEvent) => void, ...tags: string[]): void
-/** @group PocketBase */declare function onRecordRequestOTPRequest(handler: (e: core.RecordCreateOTPRequestEvent) => void, ...tags: string[]): void
-/** @group PocketBase */declare function onRecordRequestPasswordResetRequest(handler: (e: core.RecordRequestPasswordResetRequestEvent) => void, ...tags: string[]): void
-/** @group PocketBase */declare function onRecordRequestVerificationRequest(handler: (e: core.RecordRequestVerificationRequestEvent) => void, ...tags: string[]): void
-/** @group PocketBase */declare function onRecordUpdate(handler: (e: core.RecordEvent) => void, ...tags: string[]): void
-/** @group PocketBase */declare function onRecordUpdateExecute(handler: (e: core.RecordEvent) => void, ...tags: string[]): void
-/** @group PocketBase */declare function onRecordUpdateRequest(handler: (e: core.RecordRequestEvent) => void, ...tags: string[]): void
-/** @group PocketBase */declare function onRecordValidate(handler: (e: core.RecordEvent) => void, ...tags: string[]): void
-/** @group PocketBase */declare function onRecordViewRequest(handler: (e: core.RecordRequestEvent) => void, ...tags: string[]): void
-/** @group PocketBase */declare function onRecordsListRequest(handler: (e: core.RecordsListRequestEvent) => void, ...tags: string[]): void
-/** @group PocketBase */declare function onSettingsListRequest(handler: (e: core.SettingsListRequestEvent) => void): void
-/** @group PocketBase */declare function onSettingsReload(handler: (e: core.SettingsReloadEvent) => void): void
-/** @group PocketBase */declare function onSettingsUpdateRequest(handler: (e: core.SettingsUpdateRequestEvent) => void): void
-/** @group PocketBase */declare function onTerminate(handler: (e: core.TerminateEvent) => void): void
-type _TygojaDict = { [key:string | number | symbol]: any; }
-type _TygojaAny = any
-
-/**
- * Package os provides a platform-independent interface to operating system
- * functionality. The design is Unix-like, although the error handling is
- * Go-like; failing calls return values of type error rather than error numbers.
- * Often, more information is available within the error. For example,
- * if a call that takes a file name fails, such as [Open] or [Stat], the error
- * will include the failing file name when printed and will be of type
- * [*PathError], which may be unpacked for more information.
- *
- * The os interface is intended to be uniform across all operating systems.
- * Features not generally available appear in the system-specific package syscall.
- *
- * Here is a simple example, opening a file and reading some of it.
- *
- * ```
- * file, err := os.Open("file.go") // For read access.
- * if err != nil {
- * log.Fatal(err)
- * }
- * ```
- *
- * If the open fails, the error string will be self-explanatory, like
- *
- * ```
- * open file.go: no such file or directory
- * ```
- *
- * The file's data can then be read into a slice of bytes. Read and
- * Write take their byte counts from the length of the argument slice.
- *
- * ```
- * data := make([]byte, 100)
- * count, err := file.Read(data)
- * if err != nil {
- * log.Fatal(err)
- * }
- * fmt.Printf("read %d bytes: %q\n", count, data[:count])
- * ```
- *
- * # Concurrency
- *
- * The methods of [File] correspond to file system operations. All are
- * safe for concurrent use. The maximum number of concurrent
- * operations on a File may be limited by the OS or the system. The
- * number should be high, but exceeding it may degrade performance or
- * cause other issues.
- */
-namespace os {
- interface readdirMode extends Number{}
- interface File {
- /**
- * Readdir reads the contents of the directory associated with file and
- * returns a slice of up to n [FileInfo] values, as would be returned
- * by [Lstat], in directory order. Subsequent calls on the same file will yield
- * further FileInfos.
- *
- * If n > 0, Readdir returns at most n FileInfo structures. In this case, if
- * Readdir returns an empty slice, it will return a non-nil error
- * explaining why. At the end of a directory, the error is [io.EOF].
- *
- * If n <= 0, Readdir returns all the FileInfo from the directory in
- * a single slice. In this case, if Readdir succeeds (reads all
- * the way to the end of the directory), it returns the slice and a
- * nil error. If it encounters an error before the end of the
- * directory, Readdir returns the FileInfo read until that point
- * and a non-nil error.
- *
- * Most clients are better served by the more efficient ReadDir method.
- */
- readdir(n: number): Array
- }
- interface File {
- /**
- * Readdirnames reads the contents of the directory associated with file
- * and returns a slice of up to n names of files in the directory,
- * in directory order. Subsequent calls on the same file will yield
- * further names.
- *
- * If n > 0, Readdirnames returns at most n names. In this case, if
- * Readdirnames returns an empty slice, it will return a non-nil error
- * explaining why. At the end of a directory, the error is [io.EOF].
- *
- * If n <= 0, Readdirnames returns all the names from the directory in
- * a single slice. In this case, if Readdirnames succeeds (reads all
- * the way to the end of the directory), it returns the slice and a
- * nil error. If it encounters an error before the end of the
- * directory, Readdirnames returns the names read until that point and
- * a non-nil error.
- */
- readdirnames(n: number): Array
- }
- /**
- * A DirEntry is an entry read from a directory
- * (using the [ReadDir] function or a [File.ReadDir] method).
- */
- interface DirEntry extends fs.DirEntry{}
- interface File {
- /**
- * ReadDir reads the contents of the directory associated with the file f
- * and returns a slice of [DirEntry] values in directory order.
- * Subsequent calls on the same file will yield later DirEntry records in the directory.
- *
- * If n > 0, ReadDir returns at most n DirEntry records.
- * In this case, if ReadDir returns an empty slice, it will return an error explaining why.
- * At the end of a directory, the error is [io.EOF].
- *
- * If n <= 0, ReadDir returns all the DirEntry records remaining in the directory.
- * When it succeeds, it returns a nil error (not io.EOF).
- */
- readDir(n: number): Array
- }
- interface readDir {
- /**
- * ReadDir reads the named directory,
- * returning all its directory entries sorted by filename.
- * If an error occurs reading the directory,
- * ReadDir returns the entries it was able to read before the error,
- * along with the error.
- */
- (name: string): Array
- }
- interface copyFS {
- /**
- * CopyFS copies the file system fsys into the directory dir,
- * creating dir if necessary.
- *
- * Files are created with mode 0o666 plus any execute permissions
- * from the source, and directories are created with mode 0o777
- * (before umask).
- *
- * CopyFS will not overwrite existing files. If a file name in fsys
- * already exists in the destination, CopyFS will return an error
- * such that errors.Is(err, fs.ErrExist) will be true.
- *
- * Symbolic links in fsys are not supported. A *PathError with Err set
- * to ErrInvalid is returned when copying from a symbolic link.
- *
- * Symbolic links in dir are followed.
- *
- * Copying stops at and returns the first error encountered.
- */
- (dir: string, fsys: fs.FS): void
- }
- /**
- * Auxiliary information if the File describes a directory
- */
- interface dirInfo {
- }
- interface expand {
- /**
- * Expand replaces ${var} or $var in the string based on the mapping function.
- * For example, [os.ExpandEnv](s) is equivalent to [os.Expand](s, [os.Getenv]).
- */
- (s: string, mapping: (_arg0: string) => string): string
- }
- interface expandEnv {
- /**
- * ExpandEnv replaces ${var} or $var in the string according to the values
- * of the current environment variables. References to undefined
- * variables are replaced by the empty string.
- */
- (s: string): string
- }
- interface getenv {
- /**
- * Getenv retrieves the value of the environment variable named by the key.
- * It returns the value, which will be empty if the variable is not present.
- * To distinguish between an empty value and an unset value, use [LookupEnv].
- */
- (key: string): string
- }
- interface lookupEnv {
- /**
- * LookupEnv retrieves the value of the environment variable named
- * by the key. If the variable is present in the environment the
- * value (which may be empty) is returned and the boolean is true.
- * Otherwise the returned value will be empty and the boolean will
- * be false.
- */
- (key: string): [string, boolean]
- }
- interface setenv {
- /**
- * Setenv sets the value of the environment variable named by the key.
- * It returns an error, if any.
- */
- (key: string, value: string): void
- }
- interface unsetenv {
- /**
- * Unsetenv unsets a single environment variable.
- */
- (key: string): void
- }
- interface clearenv {
- /**
- * Clearenv deletes all environment variables.
- */
- (): void
- }
- interface environ {
- /**
- * Environ returns a copy of strings representing the environment,
- * in the form "key=value".
- */
- (): Array
- }
- interface timeout {
- [key:string]: any;
- timeout(): boolean
- }
- /**
- * PathError records an error and the operation and file path that caused it.
- */
- interface PathError extends fs.PathError{}
- /**
- * SyscallError records an error from a specific system call.
- */
- interface SyscallError {
- syscall: string
- err: Error
- }
- interface SyscallError {
- error(): string
- }
- interface SyscallError {
- unwrap(): void
- }
- interface SyscallError {
- /**
- * Timeout reports whether this error represents a timeout.
- */
- timeout(): boolean
- }
- interface newSyscallError {
- /**
- * NewSyscallError returns, as an error, a new [SyscallError]
- * with the given system call name and error details.
- * As a convenience, if err is nil, NewSyscallError returns nil.
- */
- (syscall: string, err: Error): void
- }
- interface isExist {
- /**
- * IsExist returns a boolean indicating whether its argument is known to report
- * that a file or directory already exists. It is satisfied by [ErrExist] as
- * well as some syscall errors.
- *
- * This function predates [errors.Is]. It only supports errors returned by
- * the os package. New code should use errors.Is(err, fs.ErrExist).
- */
- (err: Error): boolean
- }
- interface isNotExist {
- /**
- * IsNotExist returns a boolean indicating whether its argument is known to
- * report that a file or directory does not exist. It is satisfied by
- * [ErrNotExist] as well as some syscall errors.
- *
- * This function predates [errors.Is]. It only supports errors returned by
- * the os package. New code should use errors.Is(err, fs.ErrNotExist).
- */
- (err: Error): boolean
- }
- interface isPermission {
- /**
- * IsPermission returns a boolean indicating whether its argument is known to
- * report that permission is denied. It is satisfied by [ErrPermission] as well
- * as some syscall errors.
- *
- * This function predates [errors.Is]. It only supports errors returned by
- * the os package. New code should use errors.Is(err, fs.ErrPermission).
- */
- (err: Error): boolean
- }
- interface isTimeout {
- /**
- * IsTimeout returns a boolean indicating whether its argument is known
- * to report that a timeout occurred.
- *
- * This function predates [errors.Is], and the notion of whether an
- * error indicates a timeout can be ambiguous. For example, the Unix
- * error EWOULDBLOCK sometimes indicates a timeout and sometimes does not.
- * New code should use errors.Is with a value appropriate to the call
- * returning the error, such as [os.ErrDeadlineExceeded].
- */
- (err: Error): boolean
- }
- interface syscallErrorType extends syscall.Errno{}
- interface processMode extends Number{}
- interface processStatus extends Number{}
- /**
- * Process stores the information about a process created by [StartProcess].
- */
- interface Process {
- pid: number
- }
- /**
- * ProcAttr holds the attributes that will be applied to a new process
- * started by StartProcess.
- */
- interface ProcAttr {
- /**
- * If Dir is non-empty, the child changes into the directory before
- * creating the process.
- */
- dir: string
- /**
- * If Env is non-nil, it gives the environment variables for the
- * new process in the form returned by Environ.
- * If it is nil, the result of Environ will be used.
- */
- env: Array
- /**
- * Files specifies the open files inherited by the new process. The
- * first three entries correspond to standard input, standard output, and
- * standard error. An implementation may support additional entries,
- * depending on the underlying operating system. A nil entry corresponds
- * to that file being closed when the process starts.
- * On Unix systems, StartProcess will change these File values
- * to blocking mode, which means that SetDeadline will stop working
- * and calling Close will not interrupt a Read or Write.
- */
- files: Array<(File | undefined)>
- /**
- * Operating system-specific process creation attributes.
- * Note that setting this field means that your program
- * may not execute properly or even compile on some
- * operating systems.
- */
- sys?: syscall.SysProcAttr
- }
- /**
- * A Signal represents an operating system signal.
- * The usual underlying implementation is operating system-dependent:
- * on Unix it is syscall.Signal.
- */
- interface Signal {
- [key:string]: any;
- string(): string
- signal(): void // to distinguish from other Stringers
- }
- interface getpid {
- /**
- * Getpid returns the process id of the caller.
- */
- (): number
- }
- interface getppid {
- /**
- * Getppid returns the process id of the caller's parent.
- */
- (): number
- }
- interface findProcess {
- /**
- * FindProcess looks for a running process by its pid.
- *
- * The [Process] it returns can be used to obtain information
- * about the underlying operating system process.
- *
- * On Unix systems, FindProcess always succeeds and returns a Process
- * for the given pid, regardless of whether the process exists. To test whether
- * the process actually exists, see whether p.Signal(syscall.Signal(0)) reports
- * an error.
- */
- (pid: number): (Process)
- }
- interface startProcess {
- /**
- * StartProcess starts a new process with the program, arguments and attributes
- * specified by name, argv and attr. The argv slice will become [os.Args] in the
- * new process, so it normally starts with the program name.
- *
- * If the calling goroutine has locked the operating system thread
- * with [runtime.LockOSThread] and modified any inheritable OS-level
- * thread state (for example, Linux or Plan 9 name spaces), the new
- * process will inherit the caller's thread state.
- *
- * StartProcess is a low-level interface. The [os/exec] package provides
- * higher-level interfaces.
- *
- * If there is an error, it will be of type [*PathError].
- */
- (name: string, argv: Array, attr: ProcAttr): (Process)
- }
- interface Process {
- /**
- * Release releases any resources associated with the [Process] p,
- * rendering it unusable in the future.
- * Release only needs to be called if [Process.Wait] is not.
- */
- release(): void
- }
- interface Process {
- /**
- * Kill causes the [Process] to exit immediately. Kill does not wait until
- * the Process has actually exited. This only kills the Process itself,
- * not any other processes it may have started.
- */
- kill(): void
- }
- interface Process {
- /**
- * Wait waits for the [Process] to exit, and then returns a
- * ProcessState describing its status and an error, if any.
- * Wait releases any resources associated with the Process.
- * On most operating systems, the Process must be a child
- * of the current process or an error will be returned.
- */
- wait(): (ProcessState)
- }
- interface Process {
- /**
- * Signal sends a signal to the [Process].
- * Sending [Interrupt] on Windows is not implemented.
- */
- signal(sig: Signal): void
- }
- interface ProcessState {
- /**
- * UserTime returns the user CPU time of the exited process and its children.
- */
- userTime(): time.Duration
- }
- interface ProcessState {
- /**
- * SystemTime returns the system CPU time of the exited process and its children.
- */
- systemTime(): time.Duration
- }
- interface ProcessState {
- /**
- * Exited reports whether the program has exited.
- * On Unix systems this reports true if the program exited due to calling exit,
- * but false if the program terminated due to a signal.
- */
- exited(): boolean
- }
- interface ProcessState {
- /**
- * Success reports whether the program exited successfully,
- * such as with exit status 0 on Unix.
- */
- success(): boolean
- }
- interface ProcessState {
- /**
- * Sys returns system-dependent exit information about
- * the process. Convert it to the appropriate underlying
- * type, such as [syscall.WaitStatus] on Unix, to access its contents.
- */
- sys(): any
- }
- interface ProcessState {
- /**
- * SysUsage returns system-dependent resource usage information about
- * the exited process. Convert it to the appropriate underlying
- * type, such as [*syscall.Rusage] on Unix, to access its contents.
- * (On Unix, *syscall.Rusage matches struct rusage as defined in the
- * getrusage(2) manual page.)
- */
- sysUsage(): any
- }
- /**
- * ProcessState stores information about a process, as reported by Wait.
- */
- interface ProcessState {
- }
- interface ProcessState {
- /**
- * Pid returns the process id of the exited process.
- */
- pid(): number
- }
- interface ProcessState {
- string(): string
- }
- interface ProcessState {
- /**
- * ExitCode returns the exit code of the exited process, or -1
- * if the process hasn't exited or was terminated by a signal.
- */
- exitCode(): number
- }
- interface executable {
- /**
- * Executable returns the path name for the executable that started
- * the current process. There is no guarantee that the path is still
- * pointing to the correct executable. If a symlink was used to start
- * the process, depending on the operating system, the result might
- * be the symlink or the path it pointed to. If a stable result is
- * needed, [path/filepath.EvalSymlinks] might help.
- *
- * Executable returns an absolute path unless an error occurred.
- *
- * The main use case is finding resources located relative to an
- * executable.
- */
- (): string
- }
- interface File {
- /**
- * Name returns the name of the file as presented to Open.
- *
- * It is safe to call Name after [Close].
- */
- name(): string
- }
- /**
- * LinkError records an error during a link or symlink or rename
- * system call and the paths that caused it.
- */
- interface LinkError {
- op: string
- old: string
- new: string
- err: Error
- }
- interface LinkError {
- error(): string
- }
- interface LinkError {
- unwrap(): void
- }
- interface File {
- /**
- * Read reads up to len(b) bytes from the File and stores them in b.
- * It returns the number of bytes read and any error encountered.
- * At end of file, Read returns 0, io.EOF.
- */
- read(b: string|Array): number
- }
- interface File {
- /**
- * ReadAt reads len(b) bytes from the File starting at byte offset off.
- * It returns the number of bytes read and the error, if any.
- * ReadAt always returns a non-nil error when n < len(b).
- * At end of file, that error is io.EOF.
- */
- readAt(b: string|Array, off: number): number
- }
- interface File {
- /**
- * ReadFrom implements io.ReaderFrom.
- */
- readFrom(r: io.Reader): number
- }
- /**
- * noReadFrom can be embedded alongside another type to
- * hide the ReadFrom method of that other type.
- */
- interface noReadFrom {
- }
- interface noReadFrom {
- /**
- * ReadFrom hides another ReadFrom method.
- * It should never be called.
- */
- readFrom(_arg0: io.Reader): number
- }
- /**
- * fileWithoutReadFrom implements all the methods of *File other
- * than ReadFrom. This is used to permit ReadFrom to call io.Copy
- * without leading to a recursive call to ReadFrom.
- */
- type _snLnyFf = noReadFrom&File
- interface fileWithoutReadFrom extends _snLnyFf {
- }
- interface File {
- /**
- * Write writes len(b) bytes from b to the File.
- * It returns the number of bytes written and an error, if any.
- * Write returns a non-nil error when n != len(b).
- */
- write(b: string|Array): number
- }
- interface File {
- /**
- * WriteAt writes len(b) bytes to the File starting at byte offset off.
- * It returns the number of bytes written and an error, if any.
- * WriteAt returns a non-nil error when n != len(b).
- *
- * If file was opened with the O_APPEND flag, WriteAt returns an error.
- */
- writeAt(b: string|Array, off: number): number
- }
- interface File {
- /**
- * WriteTo implements io.WriterTo.
- */
- writeTo(w: io.Writer): number
- }
- /**
- * noWriteTo can be embedded alongside another type to
- * hide the WriteTo method of that other type.
- */
- interface noWriteTo {
- }
- interface noWriteTo {
- /**
- * WriteTo hides another WriteTo method.
- * It should never be called.
- */
- writeTo(_arg0: io.Writer): number
- }
- /**
- * fileWithoutWriteTo implements all the methods of *File other
- * than WriteTo. This is used to permit WriteTo to call io.Copy
- * without leading to a recursive call to WriteTo.
- */
- type _syNvbJl = noWriteTo&File
- interface fileWithoutWriteTo extends _syNvbJl {
- }
- interface File {
- /**
- * Seek sets the offset for the next Read or Write on file to offset, interpreted
- * according to whence: 0 means relative to the origin of the file, 1 means
- * relative to the current offset, and 2 means relative to the end.
- * It returns the new offset and an error, if any.
- * The behavior of Seek on a file opened with O_APPEND is not specified.
- */
- seek(offset: number, whence: number): number
- }
- interface File {
- /**
- * WriteString is like Write, but writes the contents of string s rather than
- * a slice of bytes.
- */
- writeString(s: string): number
- }
- interface mkdir {
- /**
- * Mkdir creates a new directory with the specified name and permission
- * bits (before umask).
- * If there is an error, it will be of type *PathError.
- */
- (name: string, perm: FileMode): void
- }
- interface chdir {
- /**
- * Chdir changes the current working directory to the named directory.
- * If there is an error, it will be of type *PathError.
- */
- (dir: string): void
- }
- interface open {
- /**
- * Open opens the named file for reading. If successful, methods on
- * the returned file can be used for reading; the associated file
- * descriptor has mode O_RDONLY.
- * If there is an error, it will be of type *PathError.
- */
- (name: string): (File)
- }
- interface create {
- /**
- * Create creates or truncates the named file. If the file already exists,
- * it is truncated. If the file does not exist, it is created with mode 0o666
- * (before umask). If successful, methods on the returned File can
- * be used for I/O; the associated file descriptor has mode O_RDWR.
- * If there is an error, it will be of type *PathError.
- */
- (name: string): (File)
- }
- interface openFile {
- /**
- * OpenFile is the generalized open call; most users will use Open
- * or Create instead. It opens the named file with specified flag
- * (O_RDONLY etc.). If the file does not exist, and the O_CREATE flag
- * is passed, it is created with mode perm (before umask). If successful,
- * methods on the returned File can be used for I/O.
- * If there is an error, it will be of type *PathError.
- */
- (name: string, flag: number, perm: FileMode): (File)
- }
- interface rename {
- /**
- * Rename renames (moves) oldpath to newpath.
- * If newpath already exists and is not a directory, Rename replaces it.
- * OS-specific restrictions may apply when oldpath and newpath are in different directories.
- * Even within the same directory, on non-Unix platforms Rename is not an atomic operation.
- * If there is an error, it will be of type *LinkError.
- */
- (oldpath: string, newpath: string): void
- }
- interface readlink {
- /**
- * Readlink returns the destination of the named symbolic link.
- * If there is an error, it will be of type *PathError.
- *
- * If the link destination is relative, Readlink returns the relative path
- * without resolving it to an absolute one.
- */
- (name: string): string
- }
- interface tempDir {
- /**
- * TempDir returns the default directory to use for temporary files.
- *
- * On Unix systems, it returns $TMPDIR if non-empty, else /tmp.
- * On Windows, it uses GetTempPath, returning the first non-empty
- * value from %TMP%, %TEMP%, %USERPROFILE%, or the Windows directory.
- * On Plan 9, it returns /tmp.
- *
- * The directory is neither guaranteed to exist nor have accessible
- * permissions.
- */
- (): string
- }
- interface userCacheDir {
- /**
- * UserCacheDir returns the default root directory to use for user-specific
- * cached data. Users should create their own application-specific subdirectory
- * within this one and use that.
- *
- * On Unix systems, it returns $XDG_CACHE_HOME as specified by
- * https://specifications.freedesktop.org/basedir-spec/basedir-spec-latest.html if
- * non-empty, else $HOME/.cache.
- * On Darwin, it returns $HOME/Library/Caches.
- * On Windows, it returns %LocalAppData%.
- * On Plan 9, it returns $home/lib/cache.
- *
- * If the location cannot be determined (for example, $HOME is not defined),
- * then it will return an error.
- */
- (): string
- }
- interface userConfigDir {
- /**
- * UserConfigDir returns the default root directory to use for user-specific
- * configuration data. Users should create their own application-specific
- * subdirectory within this one and use that.
- *
- * On Unix systems, it returns $XDG_CONFIG_HOME as specified by
- * https://specifications.freedesktop.org/basedir-spec/basedir-spec-latest.html if
- * non-empty, else $HOME/.config.
- * On Darwin, it returns $HOME/Library/Application Support.
- * On Windows, it returns %AppData%.
- * On Plan 9, it returns $home/lib.
- *
- * If the location cannot be determined (for example, $HOME is not defined),
- * then it will return an error.
- */
- (): string
- }
- interface userHomeDir {
- /**
- * UserHomeDir returns the current user's home directory.
- *
- * On Unix, including macOS, it returns the $HOME environment variable.
- * On Windows, it returns %USERPROFILE%.
- * On Plan 9, it returns the $home environment variable.
- *
- * If the expected variable is not set in the environment, UserHomeDir
- * returns either a platform-specific default value or a non-nil error.
- */
- (): string
- }
- interface chmod {
- /**
- * Chmod changes the mode of the named file to mode.
- * If the file is a symbolic link, it changes the mode of the link's target.
- * If there is an error, it will be of type *PathError.
- *
- * A different subset of the mode bits are used, depending on the
- * operating system.
- *
- * On Unix, the mode's permission bits, ModeSetuid, ModeSetgid, and
- * ModeSticky are used.
- *
- * On Windows, only the 0o200 bit (owner writable) of mode is used; it
- * controls whether the file's read-only attribute is set or cleared.
- * The other bits are currently unused. For compatibility with Go 1.12
- * and earlier, use a non-zero mode. Use mode 0o400 for a read-only
- * file and 0o600 for a readable+writable file.
- *
- * On Plan 9, the mode's permission bits, ModeAppend, ModeExclusive,
- * and ModeTemporary are used.
- */
- (name: string, mode: FileMode): void
- }
- interface File {
- /**
- * Chmod changes the mode of the file to mode.
- * If there is an error, it will be of type *PathError.
- */
- chmod(mode: FileMode): void
- }
- interface File {
- /**
- * SetDeadline sets the read and write deadlines for a File.
- * It is equivalent to calling both SetReadDeadline and SetWriteDeadline.
- *
- * Only some kinds of files support setting a deadline. Calls to SetDeadline
- * for files that do not support deadlines will return ErrNoDeadline.
- * On most systems ordinary files do not support deadlines, but pipes do.
- *
- * A deadline is an absolute time after which I/O operations fail with an
- * error instead of blocking. The deadline applies to all future and pending
- * I/O, not just the immediately following call to Read or Write.
- * After a deadline has been exceeded, the connection can be refreshed
- * by setting a deadline in the future.
- *
- * If the deadline is exceeded a call to Read or Write or to other I/O
- * methods will return an error that wraps ErrDeadlineExceeded.
- * This can be tested using errors.Is(err, os.ErrDeadlineExceeded).
- * That error implements the Timeout method, and calling the Timeout
- * method will return true, but there are other possible errors for which
- * the Timeout will return true even if the deadline has not been exceeded.
- *
- * An idle timeout can be implemented by repeatedly extending
- * the deadline after successful Read or Write calls.
- *
- * A zero value for t means I/O operations will not time out.
- */
- setDeadline(t: time.Time): void
- }
- interface File {
- /**
- * SetReadDeadline sets the deadline for future Read calls and any
- * currently-blocked Read call.
- * A zero value for t means Read will not time out.
- * Not all files support setting deadlines; see SetDeadline.
- */
- setReadDeadline(t: time.Time): void
- }
- interface File {
- /**
- * SetWriteDeadline sets the deadline for any future Write calls and any
- * currently-blocked Write call.
- * Even if Write times out, it may return n > 0, indicating that
- * some of the data was successfully written.
- * A zero value for t means Write will not time out.
- * Not all files support setting deadlines; see SetDeadline.
- */
- setWriteDeadline(t: time.Time): void
- }
- interface File {
- /**
- * SyscallConn returns a raw file.
- * This implements the syscall.Conn interface.
- */
- syscallConn(): syscall.RawConn
- }
- interface dirFS {
- /**
- * DirFS returns a file system (an fs.FS) for the tree of files rooted at the directory dir.
- *
- * Note that DirFS("/prefix") only guarantees that the Open calls it makes to the
- * operating system will begin with "/prefix": DirFS("/prefix").Open("file") is the
- * same as os.Open("/prefix/file"). So if /prefix/file is a symbolic link pointing outside
- * the /prefix tree, then using DirFS does not stop the access any more than using
- * os.Open does. Additionally, the root of the fs.FS returned for a relative path,
- * DirFS("prefix"), will be affected by later calls to Chdir. DirFS is therefore not
- * a general substitute for a chroot-style security mechanism when the directory tree
- * contains arbitrary content.
- *
- * The directory dir must not be "".
- *
- * The result implements [io/fs.StatFS], [io/fs.ReadFileFS] and
- * [io/fs.ReadDirFS].
- */
- (dir: string): fs.FS
- }
- interface dirFS extends String{}
- interface dirFS {
- open(name: string): fs.File
- }
- interface dirFS {
- /**
- * The ReadFile method calls the [ReadFile] function for the file
- * with the given name in the directory. The function provides
- * robust handling for small files and special file systems.
- * Through this method, dirFS implements [io/fs.ReadFileFS].
- */
- readFile(name: string): string|Array
- }
- interface dirFS {
- /**
- * ReadDir reads the named directory, returning all its directory entries sorted
- * by filename. Through this method, dirFS implements [io/fs.ReadDirFS].
- */
- readDir(name: string): Array
- }
- interface dirFS {
- stat(name: string): fs.FileInfo
- }
- interface readFile {
- /**
- * ReadFile reads the named file and returns the contents.
- * A successful call returns err == nil, not err == EOF.
- * Because ReadFile reads the whole file, it does not treat an EOF from Read
- * as an error to be reported.
- */
- (name: string): string|Array
- }
- interface writeFile {
- /**
- * WriteFile writes data to the named file, creating it if necessary.
- * If the file does not exist, WriteFile creates it with permissions perm (before umask);
- * otherwise WriteFile truncates it before writing, without changing permissions.
- * Since WriteFile requires multiple system calls to complete, a failure mid-operation
- * can leave the file in a partially written state.
- */
- (name: string, data: string|Array, perm: FileMode): void
- }
- interface File {
- /**
- * Close closes the [File], rendering it unusable for I/O.
- * On files that support [File.SetDeadline], any pending I/O operations will
- * be canceled and return immediately with an [ErrClosed] error.
- * Close will return an error if it has already been called.
- */
- close(): void
- }
- interface chown {
- /**
- * Chown changes the numeric uid and gid of the named file.
- * If the file is a symbolic link, it changes the uid and gid of the link's target.
- * A uid or gid of -1 means to not change that value.
- * If there is an error, it will be of type [*PathError].
- *
- * On Windows or Plan 9, Chown always returns the [syscall.EWINDOWS] or
- * EPLAN9 error, wrapped in *PathError.
- */
- (name: string, uid: number, gid: number): void
- }
- interface lchown {
- /**
- * Lchown changes the numeric uid and gid of the named file.
- * If the file is a symbolic link, it changes the uid and gid of the link itself.
- * If there is an error, it will be of type [*PathError].
- *
- * On Windows, it always returns the [syscall.EWINDOWS] error, wrapped
- * in *PathError.
- */
- (name: string, uid: number, gid: number): void
- }
- interface File {
- /**
- * Chown changes the numeric uid and gid of the named file.
- * If there is an error, it will be of type [*PathError].
- *
- * On Windows, it always returns the [syscall.EWINDOWS] error, wrapped
- * in *PathError.
- */
- chown(uid: number, gid: number): void
- }
- interface File {
- /**
- * Truncate changes the size of the file.
- * It does not change the I/O offset.
- * If there is an error, it will be of type [*PathError].
- */
- truncate(size: number): void
- }
- interface File {
- /**
- * Sync commits the current contents of the file to stable storage.
- * Typically, this means flushing the file system's in-memory copy
- * of recently written data to disk.
- */
- sync(): void
- }
- interface chtimes {
- /**
- * Chtimes changes the access and modification times of the named
- * file, similar to the Unix utime() or utimes() functions.
- * A zero [time.Time] value will leave the corresponding file time unchanged.
- *
- * The underlying filesystem may truncate or round the values to a
- * less precise time unit.
- * If there is an error, it will be of type [*PathError].
- */
- (name: string, atime: time.Time, mtime: time.Time): void
- }
- interface File {
- /**
- * Chdir changes the current working directory to the file,
- * which must be a directory.
- * If there is an error, it will be of type [*PathError].
- */
- chdir(): void
- }
- /**
- * file is the real representation of *File.
- * The extra level of indirection ensures that no clients of os
- * can overwrite this data, which could cause the finalizer
- * to close the wrong file descriptor.
- */
- interface file {
- }
- interface File {
- /**
- * Fd returns the integer Unix file descriptor referencing the open file.
- * If f is closed, the file descriptor becomes invalid.
- * If f is garbage collected, a finalizer may close the file descriptor,
- * making it invalid; see [runtime.SetFinalizer] for more information on when
- * a finalizer might be run. On Unix systems this will cause the [File.SetDeadline]
- * methods to stop working.
- * Because file descriptors can be reused, the returned file descriptor may
- * only be closed through the [File.Close] method of f, or by its finalizer during
- * garbage collection. Otherwise, during garbage collection the finalizer
- * may close an unrelated file descriptor with the same (reused) number.
- *
- * As an alternative, see the f.SyscallConn method.
- */
- fd(): number
- }
- interface newFile {
- /**
- * NewFile returns a new File with the given file descriptor and
- * name. The returned value will be nil if fd is not a valid file
- * descriptor. On Unix systems, if the file descriptor is in
- * non-blocking mode, NewFile will attempt to return a pollable File
- * (one for which the SetDeadline methods work).
- *
- * After passing it to NewFile, fd may become invalid under the same
- * conditions described in the comments of the Fd method, and the same
- * constraints apply.
- */
- (fd: number, name: string): (File)
- }
- /**
- * newFileKind describes the kind of file to newFile.
- */
- interface newFileKind extends Number{}
- interface truncate {
- /**
- * Truncate changes the size of the named file.
- * If the file is a symbolic link, it changes the size of the link's target.
- * If there is an error, it will be of type *PathError.
- */
- (name: string, size: number): void
- }
- interface remove {
- /**
- * Remove removes the named file or (empty) directory.
- * If there is an error, it will be of type *PathError.
- */
- (name: string): void
- }
- interface link {
- /**
- * Link creates newname as a hard link to the oldname file.
- * If there is an error, it will be of type *LinkError.
- */
- (oldname: string, newname: string): void
- }
- interface symlink {
- /**
- * Symlink creates newname as a symbolic link to oldname.
- * On Windows, a symlink to a non-existent oldname creates a file symlink;
- * if oldname is later created as a directory the symlink will not work.
- * If there is an error, it will be of type *LinkError.
- */
- (oldname: string, newname: string): void
- }
- interface unixDirent {
- }
- interface unixDirent {
- name(): string
- }
- interface unixDirent {
- isDir(): boolean
- }
- interface unixDirent {
- type(): FileMode
- }
- interface unixDirent {
- info(): FileInfo
- }
- interface unixDirent {
- string(): string
- }
- interface getwd {
- /**
- * Getwd returns a rooted path name corresponding to the
- * current directory. If the current directory can be
- * reached via multiple paths (due to symbolic links),
- * Getwd may return any one of them.
- */
- (): string
- }
- interface mkdirAll {
- /**
- * MkdirAll creates a directory named path,
- * along with any necessary parents, and returns nil,
- * or else returns an error.
- * The permission bits perm (before umask) are used for all
- * directories that MkdirAll creates.
- * If path is already a directory, MkdirAll does nothing
- * and returns nil.
- */
- (path: string, perm: FileMode): void
- }
- interface removeAll {
- /**
- * RemoveAll removes path and any children it contains.
- * It removes everything it can but returns the first error
- * it encounters. If the path does not exist, RemoveAll
- * returns nil (no error).
- * If there is an error, it will be of type [*PathError].
- */
- (path: string): void
- }
- interface isPathSeparator {
- /**
- * IsPathSeparator reports whether c is a directory separator character.
- */
- (c: number): boolean
- }
- interface pipe {
- /**
- * Pipe returns a connected pair of Files; reads from r return bytes written to w.
- * It returns the files and an error, if any.
- */
- (): [(File), (File)]
- }
- interface getuid {
- /**
- * Getuid returns the numeric user id of the caller.
- *
- * On Windows, it returns -1.
- */
- (): number
- }
- interface geteuid {
- /**
- * Geteuid returns the numeric effective user id of the caller.
- *
- * On Windows, it returns -1.
- */
- (): number
- }
- interface getgid {
- /**
- * Getgid returns the numeric group id of the caller.
- *
- * On Windows, it returns -1.
- */
- (): number
- }
- interface getegid {
- /**
- * Getegid returns the numeric effective group id of the caller.
- *
- * On Windows, it returns -1.
- */
- (): number
- }
- interface getgroups {
- /**
- * Getgroups returns a list of the numeric ids of groups that the caller belongs to.
- *
- * On Windows, it returns [syscall.EWINDOWS]. See the [os/user] package
- * for a possible alternative.
- */
- (): Array
- }
- interface exit {
- /**
- * Exit causes the current program to exit with the given status code.
- * Conventionally, code zero indicates success, non-zero an error.
- * The program terminates immediately; deferred functions are not run.
- *
- * For portability, the status code should be in the range [0, 125].
- */
- (code: number): void
- }
- /**
- * rawConn implements syscall.RawConn.
- */
- interface rawConn {
- }
- interface rawConn {
- control(f: (_arg0: number) => void): void
- }
- interface rawConn {
- read(f: (_arg0: number) => boolean): void
- }
- interface rawConn {
- write(f: (_arg0: number) => boolean): void
- }
- interface stat {
- /**
- * Stat returns a [FileInfo] describing the named file.
- * If there is an error, it will be of type [*PathError].
- */
- (name: string): FileInfo
- }
- interface lstat {
- /**
- * Lstat returns a [FileInfo] describing the named file.
- * If the file is a symbolic link, the returned FileInfo
- * describes the symbolic link. Lstat makes no attempt to follow the link.
- * If there is an error, it will be of type [*PathError].
- *
- * On Windows, if the file is a reparse point that is a surrogate for another
- * named entity (such as a symbolic link or mounted folder), the returned
- * FileInfo describes the reparse point, and makes no attempt to resolve it.
- */
- (name: string): FileInfo
- }
- interface File {
- /**
- * Stat returns the [FileInfo] structure describing file.
- * If there is an error, it will be of type [*PathError].
- */
- stat(): FileInfo
- }
- interface hostname {
- /**
- * Hostname returns the host name reported by the kernel.
- */
- (): string
- }
- interface createTemp {
- /**
- * CreateTemp creates a new temporary file in the directory dir,
- * opens the file for reading and writing, and returns the resulting file.
- * The filename is generated by taking pattern and adding a random string to the end.
- * If pattern includes a "*", the random string replaces the last "*".
- * The file is created with mode 0o600 (before umask).
- * If dir is the empty string, CreateTemp uses the default directory for temporary files, as returned by [TempDir].
- * Multiple programs or goroutines calling CreateTemp simultaneously will not choose the same file.
- * The caller can use the file's Name method to find the pathname of the file.
- * It is the caller's responsibility to remove the file when it is no longer needed.
- */
- (dir: string, pattern: string): (File)
- }
- interface mkdirTemp {
- /**
- * MkdirTemp creates a new temporary directory in the directory dir
- * and returns the pathname of the new directory.
- * The new directory's name is generated by adding a random string to the end of pattern.
- * If pattern includes a "*", the random string replaces the last "*" instead.
- * The directory is created with mode 0o700 (before umask).
- * If dir is the empty string, MkdirTemp uses the default directory for temporary files, as returned by TempDir.
- * Multiple programs or goroutines calling MkdirTemp simultaneously will not choose the same directory.
- * It is the caller's responsibility to remove the directory when it is no longer needed.
- */
- (dir: string, pattern: string): string
- }
- interface getpagesize {
- /**
- * Getpagesize returns the underlying system's memory page size.
- */
- (): number
- }
- /**
- * File represents an open file descriptor.
- *
- * The methods of File are safe for concurrent use.
- */
- type _sDzXOPD = file
- interface File extends _sDzXOPD {
- }
- /**
- * A FileInfo describes a file and is returned by [Stat] and [Lstat].
- */
- interface FileInfo extends fs.FileInfo{}
- /**
- * A FileMode represents a file's mode and permission bits.
- * The bits have the same definition on all systems, so that
- * information about files can be moved from one system
- * to another portably. Not all bits apply to all systems.
- * The only required bit is [ModeDir] for directories.
- */
- interface FileMode extends fs.FileMode{}
- interface fileStat {
- name(): string
- }
- interface fileStat {
- isDir(): boolean
- }
- interface sameFile {
- /**
- * SameFile reports whether fi1 and fi2 describe the same file.
- * For example, on Unix this means that the device and inode fields
- * of the two underlying structures are identical; on other systems
- * the decision may be based on the path names.
- * SameFile only applies to results returned by this package's [Stat].
- * It returns false in other cases.
- */
- (fi1: FileInfo, fi2: FileInfo): boolean
- }
- /**
- * A fileStat is the implementation of FileInfo returned by Stat and Lstat.
- */
- interface fileStat {
- }
- interface fileStat {
- size(): number
- }
- interface fileStat {
- mode(): FileMode
- }
- interface fileStat {
- modTime(): time.Time
- }
- interface fileStat {
- sys(): any
- }
-}
-
-/**
- * Package filepath implements utility routines for manipulating filename paths
- * in a way compatible with the target operating system-defined file paths.
- *
- * The filepath package uses either forward slashes or backslashes,
- * depending on the operating system. To process paths such as URLs
- * that always use forward slashes regardless of the operating
- * system, see the [path] package.
- */
-namespace filepath {
- interface match {
- /**
- * Match reports whether name matches the shell file name pattern.
- * The pattern syntax is:
- *
- * ```
- * pattern:
- * { term }
- * term:
- * '*' matches any sequence of non-Separator characters
- * '?' matches any single non-Separator character
- * '[' [ '^' ] { character-range } ']'
- * character class (must be non-empty)
- * c matches character c (c != '*', '?', '\\', '[')
- * '\\' c matches character c
- *
- * character-range:
- * c matches character c (c != '\\', '-', ']')
- * '\\' c matches character c
- * lo '-' hi matches character c for lo <= c <= hi
- * ```
- *
- * Match requires pattern to match all of name, not just a substring.
- * The only possible returned error is [ErrBadPattern], when pattern
- * is malformed.
- *
- * On Windows, escaping is disabled. Instead, '\\' is treated as
- * path separator.
- */
- (pattern: string, name: string): boolean
- }
- interface glob {
- /**
- * Glob returns the names of all files matching pattern or nil
- * if there is no matching file. The syntax of patterns is the same
- * as in [Match]. The pattern may describe hierarchical names such as
- * /usr/*\/bin/ed (assuming the [Separator] is '/').
- *
- * Glob ignores file system errors such as I/O errors reading directories.
- * The only possible returned error is [ErrBadPattern], when pattern
- * is malformed.
- */
- (pattern: string): Array
- }
- interface clean {
- /**
- * Clean returns the shortest path name equivalent to path
- * by purely lexical processing. It applies the following rules
- * iteratively until no further processing can be done:
- *
- * 1. Replace multiple [Separator] elements with a single one.
- * 2. Eliminate each . path name element (the current directory).
- * 3. Eliminate each inner .. path name element (the parent directory)
- * ```
- * along with the non-.. element that precedes it.
- * ```
- * 4. Eliminate .. elements that begin a rooted path:
- * ```
- * that is, replace "/.." by "/" at the beginning of a path,
- * assuming Separator is '/'.
- * ```
- *
- * The returned path ends in a slash only if it represents a root directory,
- * such as "/" on Unix or `C:\` on Windows.
- *
- * Finally, any occurrences of slash are replaced by Separator.
- *
- * If the result of this process is an empty string, Clean
- * returns the string ".".
- *
- * On Windows, Clean does not modify the volume name other than to replace
- * occurrences of "/" with `\`.
- * For example, Clean("//host/share/../x") returns `\\host\share\x`.
- *
- * See also Rob Pike, “Lexical File Names in Plan 9 or
- * Getting Dot-Dot Right,”
- * https://9p.io/sys/doc/lexnames.html
- */
- (path: string): string
- }
- interface isLocal {
- /**
- * IsLocal reports whether path, using lexical analysis only, has all of these properties:
- *
- * ```
- * - is within the subtree rooted at the directory in which path is evaluated
- * - is not an absolute path
- * - is not empty
- * - on Windows, is not a reserved name such as "NUL"
- * ```
- *
- * If IsLocal(path) returns true, then
- * Join(base, path) will always produce a path contained within base and
- * Clean(path) will always produce an unrooted path with no ".." path elements.
- *
- * IsLocal is a purely lexical operation.
- * In particular, it does not account for the effect of any symbolic links
- * that may exist in the filesystem.
- */
- (path: string): boolean
- }
- interface localize {
- /**
- * Localize converts a slash-separated path into an operating system path.
- * The input path must be a valid path as reported by [io/fs.ValidPath].
- *
- * Localize returns an error if the path cannot be represented by the operating system.
- * For example, the path a\b is rejected on Windows, on which \ is a separator
- * character and cannot be part of a filename.
- *
- * The path returned by Localize will always be local, as reported by IsLocal.
- */
- (path: string): string
- }
- interface toSlash {
- /**
- * ToSlash returns the result of replacing each separator character
- * in path with a slash ('/') character. Multiple separators are
- * replaced by multiple slashes.
- */
- (path: string): string
- }
- interface fromSlash {
- /**
- * FromSlash returns the result of replacing each slash ('/') character
- * in path with a separator character. Multiple slashes are replaced
- * by multiple separators.
- *
- * See also the Localize function, which converts a slash-separated path
- * as used by the io/fs package to an operating system path.
- */
- (path: string): string
- }
- interface splitList {
- /**
- * SplitList splits a list of paths joined by the OS-specific [ListSeparator],
- * usually found in PATH or GOPATH environment variables.
- * Unlike strings.Split, SplitList returns an empty slice when passed an empty
- * string.
- */
- (path: string): Array
- }
- interface split {
- /**
- * Split splits path immediately following the final [Separator],
- * separating it into a directory and file name component.
- * If there is no Separator in path, Split returns an empty dir
- * and file set to path.
- * The returned values have the property that path = dir+file.
- */
- (path: string): [string, string]
- }
- interface join {
- /**
- * Join joins any number of path elements into a single path,
- * separating them with an OS specific [Separator]. Empty elements
- * are ignored. The result is Cleaned. However, if the argument
- * list is empty or all its elements are empty, Join returns
- * an empty string.
- * On Windows, the result will only be a UNC path if the first
- * non-empty element is a UNC path.
- */
- (...elem: string[]): string
- }
- interface ext {
- /**
- * Ext returns the file name extension used by path.
- * The extension is the suffix beginning at the final dot
- * in the final element of path; it is empty if there is
- * no dot.
- */
- (path: string): string
- }
- interface evalSymlinks {
- /**
- * EvalSymlinks returns the path name after the evaluation of any symbolic
- * links.
- * If path is relative the result will be relative to the current directory,
- * unless one of the components is an absolute symbolic link.
- * EvalSymlinks calls [Clean] on the result.
- */
- (path: string): string
- }
- interface isAbs {
- /**
- * IsAbs reports whether the path is absolute.
- */
- (path: string): boolean
- }
- interface abs {
- /**
- * Abs returns an absolute representation of path.
- * If the path is not absolute it will be joined with the current
- * working directory to turn it into an absolute path. The absolute
- * path name for a given file is not guaranteed to be unique.
- * Abs calls [Clean] on the result.
- */
- (path: string): string
- }
- interface rel {
- /**
- * Rel returns a relative path that is lexically equivalent to targpath when
- * joined to basepath with an intervening separator. That is,
- * [Join](basepath, Rel(basepath, targpath)) is equivalent to targpath itself.
- * On success, the returned path will always be relative to basepath,
- * even if basepath and targpath share no elements.
- * An error is returned if targpath can't be made relative to basepath or if
- * knowing the current working directory would be necessary to compute it.
- * Rel calls [Clean] on the result.
- */
- (basepath: string, targpath: string): string
- }
- /**
- * WalkFunc is the type of the function called by [Walk] to visit each
- * file or directory.
- *
- * The path argument contains the argument to Walk as a prefix.
- * That is, if Walk is called with root argument "dir" and finds a file
- * named "a" in that directory, the walk function will be called with
- * argument "dir/a".
- *
- * The directory and file are joined with Join, which may clean the
- * directory name: if Walk is called with the root argument "x/../dir"
- * and finds a file named "a" in that directory, the walk function will
- * be called with argument "dir/a", not "x/../dir/a".
- *
- * The info argument is the fs.FileInfo for the named path.
- *
- * The error result returned by the function controls how Walk continues.
- * If the function returns the special value [SkipDir], Walk skips the
- * current directory (path if info.IsDir() is true, otherwise path's
- * parent directory). If the function returns the special value [SkipAll],
- * Walk skips all remaining files and directories. Otherwise, if the function
- * returns a non-nil error, Walk stops entirely and returns that error.
- *
- * The err argument reports an error related to path, signaling that Walk
- * will not walk into that directory. The function can decide how to
- * handle that error; as described earlier, returning the error will
- * cause Walk to stop walking the entire tree.
- *
- * Walk calls the function with a non-nil err argument in two cases.
- *
- * First, if an [os.Lstat] on the root directory or any directory or file
- * in the tree fails, Walk calls the function with path set to that
- * directory or file's path, info set to nil, and err set to the error
- * from os.Lstat.
- *
- * Second, if a directory's Readdirnames method fails, Walk calls the
- * function with path set to the directory's path, info, set to an
- * [fs.FileInfo] describing the directory, and err set to the error from
- * Readdirnames.
- */
- interface WalkFunc {(path: string, info: fs.FileInfo, err: Error): void }
- interface walkDir {
- /**
- * WalkDir walks the file tree rooted at root, calling fn for each file or
- * directory in the tree, including root.
- *
- * All errors that arise visiting files and directories are filtered by fn:
- * see the [fs.WalkDirFunc] documentation for details.
- *
- * The files are walked in lexical order, which makes the output deterministic
- * but requires WalkDir to read an entire directory into memory before proceeding
- * to walk that directory.
- *
- * WalkDir does not follow symbolic links.
- *
- * WalkDir calls fn with paths that use the separator character appropriate
- * for the operating system. This is unlike [io/fs.WalkDir], which always
- * uses slash separated paths.
- */
- (root: string, fn: fs.WalkDirFunc): void
- }
- interface walk {
- /**
- * Walk walks the file tree rooted at root, calling fn for each file or
- * directory in the tree, including root.
- *
- * All errors that arise visiting files and directories are filtered by fn:
- * see the [WalkFunc] documentation for details.
- *
- * The files are walked in lexical order, which makes the output deterministic
- * but requires Walk to read an entire directory into memory before proceeding
- * to walk that directory.
- *
- * Walk does not follow symbolic links.
- *
- * Walk is less efficient than [WalkDir], introduced in Go 1.16,
- * which avoids calling os.Lstat on every visited file or directory.
- */
- (root: string, fn: WalkFunc): void
- }
- interface base {
- /**
- * Base returns the last element of path.
- * Trailing path separators are removed before extracting the last element.
- * If the path is empty, Base returns ".".
- * If the path consists entirely of separators, Base returns a single separator.
- */
- (path: string): string
- }
- interface dir {
- /**
- * Dir returns all but the last element of path, typically the path's directory.
- * After dropping the final element, Dir calls [Clean] on the path and trailing
- * slashes are removed.
- * If the path is empty, Dir returns ".".
- * If the path consists entirely of separators, Dir returns a single separator.
- * The returned path does not end in a separator unless it is the root directory.
- */
- (path: string): string
- }
- interface volumeName {
- /**
- * VolumeName returns leading volume name.
- * Given "C:\foo\bar" it returns "C:" on Windows.
- * Given "\\host\share\foo" it returns "\\host\share".
- * On other platforms it returns "".
- */
- (path: string): string
- }
- interface hasPrefix {
- /**
- * HasPrefix exists for historical compatibility and should not be used.
- *
- * Deprecated: HasPrefix does not respect path boundaries and
- * does not ignore case when required.
- */
- (p: string, prefix: string): boolean
- }
-}
-
-/**
- * Package validation provides configurable and extensible rules for validating data of various types.
- */
-namespace ozzo_validation {
- /**
- * Error interface represents an validation error
- */
- interface Error {
- [key:string]: any;
- error(): string
- code(): string
- message(): string
- setMessage(_arg0: string): Error
- params(): _TygojaDict
- setParams(_arg0: _TygojaDict): Error
- }
-}
-
-/**
- * Package dbx provides a set of DB-agnostic and easy-to-use query building methods for relational databases.
- */
-namespace dbx {
- /**
- * Builder supports building SQL statements in a DB-agnostic way.
- * Builder mainly provides two sets of query building methods: those building SELECT statements
- * and those manipulating DB data or schema (e.g. INSERT statements, CREATE TABLE statements).
- */
- interface Builder {
- [key:string]: any;
- /**
- * NewQuery creates a new Query object with the given SQL statement.
- * The SQL statement may contain parameter placeholders which can be bound with actual parameter
- * values before the statement is executed.
- */
- newQuery(_arg0: string): (Query)
- /**
- * Select returns a new SelectQuery object that can be used to build a SELECT statement.
- * The parameters to this method should be the list column names to be selected.
- * A column name may have an optional alias name. For example, Select("id", "my_name AS name").
- */
- select(..._arg0: string[]): (SelectQuery)
- /**
- * ModelQuery returns a new ModelQuery object that can be used to perform model insertion, update, and deletion.
- * The parameter to this method should be a pointer to the model struct that needs to be inserted, updated, or deleted.
- */
- model(_arg0: {
- }): (ModelQuery)
- /**
- * GeneratePlaceholder generates an anonymous parameter placeholder with the given parameter ID.
- */
- generatePlaceholder(_arg0: number): string
- /**
- * Quote quotes a string so that it can be embedded in a SQL statement as a string value.
- */
- quote(_arg0: string): string
- /**
- * QuoteSimpleTableName quotes a simple table name.
- * A simple table name does not contain any schema prefix.
- */
- quoteSimpleTableName(_arg0: string): string
- /**
- * QuoteSimpleColumnName quotes a simple column name.
- * A simple column name does not contain any table prefix.
- */
- quoteSimpleColumnName(_arg0: string): string
- /**
- * QueryBuilder returns the query builder supporting the current DB.
- */
- queryBuilder(): QueryBuilder
- /**
- * Insert creates a Query that represents an INSERT SQL statement.
- * The keys of cols are the column names, while the values of cols are the corresponding column
- * values to be inserted.
- */
- insert(table: string, cols: Params): (Query)
- /**
- * Upsert creates a Query that represents an UPSERT SQL statement.
- * Upsert inserts a row into the table if the primary key or unique index is not found.
- * Otherwise it will update the row with the new values.
- * The keys of cols are the column names, while the values of cols are the corresponding column
- * values to be inserted.
- */
- upsert(table: string, cols: Params, ...constraints: string[]): (Query)
- /**
- * Update creates a Query that represents an UPDATE SQL statement.
- * The keys of cols are the column names, while the values of cols are the corresponding new column
- * values. If the "where" expression is nil, the UPDATE SQL statement will have no WHERE clause
- * (be careful in this case as the SQL statement will update ALL rows in the table).
- */
- update(table: string, cols: Params, where: Expression): (Query)
- /**
- * Delete creates a Query that represents a DELETE SQL statement.
- * If the "where" expression is nil, the DELETE SQL statement will have no WHERE clause
- * (be careful in this case as the SQL statement will delete ALL rows in the table).
- */
- delete(table: string, where: Expression): (Query)
- /**
- * CreateTable creates a Query that represents a CREATE TABLE SQL statement.
- * The keys of cols are the column names, while the values of cols are the corresponding column types.
- * The optional "options" parameters will be appended to the generated SQL statement.
- */
- createTable(table: string, cols: _TygojaDict, ...options: string[]): (Query)
- /**
- * RenameTable creates a Query that can be used to rename a table.
- */
- renameTable(oldName: string, newName: string): (Query)
- /**
- * DropTable creates a Query that can be used to drop a table.
- */
- dropTable(table: string): (Query)
- /**
- * TruncateTable creates a Query that can be used to truncate a table.
- */
- truncateTable(table: string): (Query)
- /**
- * AddColumn creates a Query that can be used to add a column to a table.
- */
- addColumn(table: string, col: string, typ: string): (Query)
- /**
- * DropColumn creates a Query that can be used to drop a column from a table.
- */
- dropColumn(table: string, col: string): (Query)
- /**
- * RenameColumn creates a Query that can be used to rename a column in a table.
- */
- renameColumn(table: string, oldName: string, newName: string): (Query)
- /**
- * AlterColumn creates a Query that can be used to change the definition of a table column.
- */
- alterColumn(table: string, col: string, typ: string): (Query)
- /**
- * AddPrimaryKey creates a Query that can be used to specify primary key(s) for a table.
- * The "name" parameter specifies the name of the primary key constraint.
- */
- addPrimaryKey(table: string, name: string, ...cols: string[]): (Query)
- /**
- * DropPrimaryKey creates a Query that can be used to remove the named primary key constraint from a table.
- */
- dropPrimaryKey(table: string, name: string): (Query)
- /**
- * AddForeignKey creates a Query that can be used to add a foreign key constraint to a table.
- * The length of cols and refCols must be the same as they refer to the primary and referential columns.
- * The optional "options" parameters will be appended to the SQL statement. They can be used to
- * specify options such as "ON DELETE CASCADE".
- */
- addForeignKey(table: string, name: string, cols: Array, refCols: Array, refTable: string, ...options: string[]): (Query)
- /**
- * DropForeignKey creates a Query that can be used to remove the named foreign key constraint from a table.
- */
- dropForeignKey(table: string, name: string): (Query)
- /**
- * CreateIndex creates a Query that can be used to create an index for a table.
- */
- createIndex(table: string, name: string, ...cols: string[]): (Query)
- /**
- * CreateUniqueIndex creates a Query that can be used to create a unique index for a table.
- */
- createUniqueIndex(table: string, name: string, ...cols: string[]): (Query)
- /**
- * DropIndex creates a Query that can be used to remove the named index from a table.
- */
- dropIndex(table: string, name: string): (Query)
- }
- /**
- * BaseBuilder provides a basic implementation of the Builder interface.
- */
- interface BaseBuilder {
- }
- interface newBaseBuilder {
- /**
- * NewBaseBuilder creates a new BaseBuilder instance.
- */
- (db: DB, executor: Executor): (BaseBuilder)
- }
- interface BaseBuilder {
- /**
- * DB returns the DB instance that this builder is associated with.
- */
- db(): (DB)
- }
- interface BaseBuilder {
- /**
- * Executor returns the executor object (a DB instance or a transaction) for executing SQL statements.
- */
- executor(): Executor
- }
- interface BaseBuilder {
- /**
- * NewQuery creates a new Query object with the given SQL statement.
- * The SQL statement may contain parameter placeholders which can be bound with actual parameter
- * values before the statement is executed.
- */
- newQuery(sql: string): (Query)
- }
- interface BaseBuilder {
- /**
- * GeneratePlaceholder generates an anonymous parameter placeholder with the given parameter ID.
- */
- generatePlaceholder(_arg0: number): string
- }
- interface BaseBuilder {
- /**
- * Quote quotes a string so that it can be embedded in a SQL statement as a string value.
- */
- quote(s: string): string
- }
- interface BaseBuilder {
- /**
- * QuoteSimpleTableName quotes a simple table name.
- * A simple table name does not contain any schema prefix.
- */
- quoteSimpleTableName(s: string): string
- }
- interface BaseBuilder {
- /**
- * QuoteSimpleColumnName quotes a simple column name.
- * A simple column name does not contain any table prefix.
- */
- quoteSimpleColumnName(s: string): string
- }
- interface BaseBuilder {
- /**
- * Insert creates a Query that represents an INSERT SQL statement.
- * The keys of cols are the column names, while the values of cols are the corresponding column
- * values to be inserted.
- */
- insert(table: string, cols: Params): (Query)
- }
- interface BaseBuilder {
- /**
- * Upsert creates a Query that represents an UPSERT SQL statement.
- * Upsert inserts a row into the table if the primary key or unique index is not found.
- * Otherwise it will update the row with the new values.
- * The keys of cols are the column names, while the values of cols are the corresponding column
- * values to be inserted.
- */
- upsert(table: string, cols: Params, ...constraints: string[]): (Query)
- }
- interface BaseBuilder {
- /**
- * Update creates a Query that represents an UPDATE SQL statement.
- * The keys of cols are the column names, while the values of cols are the corresponding new column
- * values. If the "where" expression is nil, the UPDATE SQL statement will have no WHERE clause
- * (be careful in this case as the SQL statement will update ALL rows in the table).
- */
- update(table: string, cols: Params, where: Expression): (Query)
- }
- interface BaseBuilder {
- /**
- * Delete creates a Query that represents a DELETE SQL statement.
- * If the "where" expression is nil, the DELETE SQL statement will have no WHERE clause
- * (be careful in this case as the SQL statement will delete ALL rows in the table).
- */
- delete(table: string, where: Expression): (Query)
- }
- interface BaseBuilder {
- /**
- * CreateTable creates a Query that represents a CREATE TABLE SQL statement.
- * The keys of cols are the column names, while the values of cols are the corresponding column types.
- * The optional "options" parameters will be appended to the generated SQL statement.
- */
- createTable(table: string, cols: _TygojaDict, ...options: string[]): (Query)
- }
- interface BaseBuilder {
- /**
- * RenameTable creates a Query that can be used to rename a table.
- */
- renameTable(oldName: string, newName: string): (Query)
- }
- interface BaseBuilder {
- /**
- * DropTable creates a Query that can be used to drop a table.
- */
- dropTable(table: string): (Query)
- }
- interface BaseBuilder {
- /**
- * TruncateTable creates a Query that can be used to truncate a table.
- */
- truncateTable(table: string): (Query)
- }
- interface BaseBuilder {
- /**
- * AddColumn creates a Query that can be used to add a column to a table.
- */
- addColumn(table: string, col: string, typ: string): (Query)
- }
- interface BaseBuilder {
- /**
- * DropColumn creates a Query that can be used to drop a column from a table.
- */
- dropColumn(table: string, col: string): (Query)
- }
- interface BaseBuilder {
- /**
- * RenameColumn creates a Query that can be used to rename a column in a table.
- */
- renameColumn(table: string, oldName: string, newName: string): (Query)
- }
- interface BaseBuilder {
- /**
- * AlterColumn creates a Query that can be used to change the definition of a table column.
- */
- alterColumn(table: string, col: string, typ: string): (Query)
- }
- interface BaseBuilder {
- /**
- * AddPrimaryKey creates a Query that can be used to specify primary key(s) for a table.
- * The "name" parameter specifies the name of the primary key constraint.
- */
- addPrimaryKey(table: string, name: string, ...cols: string[]): (Query)
- }
- interface BaseBuilder {
- /**
- * DropPrimaryKey creates a Query that can be used to remove the named primary key constraint from a table.
- */
- dropPrimaryKey(table: string, name: string): (Query)
- }
- interface BaseBuilder {
- /**
- * AddForeignKey creates a Query that can be used to add a foreign key constraint to a table.
- * The length of cols and refCols must be the same as they refer to the primary and referential columns.
- * The optional "options" parameters will be appended to the SQL statement. They can be used to
- * specify options such as "ON DELETE CASCADE".
- */
- addForeignKey(table: string, name: string, cols: Array, refCols: Array, refTable: string, ...options: string[]): (Query)
- }
- interface BaseBuilder {
- /**
- * DropForeignKey creates a Query that can be used to remove the named foreign key constraint from a table.
- */
- dropForeignKey(table: string, name: string): (Query)
- }
- interface BaseBuilder {
- /**
- * CreateIndex creates a Query that can be used to create an index for a table.
- */
- createIndex(table: string, name: string, ...cols: string[]): (Query)
- }
- interface BaseBuilder {
- /**
- * CreateUniqueIndex creates a Query that can be used to create a unique index for a table.
- */
- createUniqueIndex(table: string, name: string, ...cols: string[]): (Query)
- }
- interface BaseBuilder {
- /**
- * DropIndex creates a Query that can be used to remove the named index from a table.
- */
- dropIndex(table: string, name: string): (Query)
- }
- /**
- * MssqlBuilder is the builder for SQL Server databases.
- */
- type _sLlglaO = BaseBuilder
- interface MssqlBuilder extends _sLlglaO {
- }
- /**
- * MssqlQueryBuilder is the query builder for SQL Server databases.
- */
- type _sIerFva = BaseQueryBuilder
- interface MssqlQueryBuilder extends _sIerFva {
- }
- interface newMssqlBuilder {
- /**
- * NewMssqlBuilder creates a new MssqlBuilder instance.
- */
- (db: DB, executor: Executor): Builder
- }
- interface MssqlBuilder {
- /**
- * QueryBuilder returns the query builder supporting the current DB.
- */
- queryBuilder(): QueryBuilder
- }
- interface MssqlBuilder {
- /**
- * Select returns a new SelectQuery object that can be used to build a SELECT statement.
- * The parameters to this method should be the list column names to be selected.
- * A column name may have an optional alias name. For example, Select("id", "my_name AS name").
- */
- select(...cols: string[]): (SelectQuery)
- }
- interface MssqlBuilder {
- /**
- * Model returns a new ModelQuery object that can be used to perform model-based DB operations.
- * The model passed to this method should be a pointer to a model struct.
- */
- model(model: {
- }): (ModelQuery)
- }
- interface MssqlBuilder {
- /**
- * QuoteSimpleTableName quotes a simple table name.
- * A simple table name does not contain any schema prefix.
- */
- quoteSimpleTableName(s: string): string
- }
- interface MssqlBuilder {
- /**
- * QuoteSimpleColumnName quotes a simple column name.
- * A simple column name does not contain any table prefix.
- */
- quoteSimpleColumnName(s: string): string
- }
- interface MssqlBuilder {
- /**
- * RenameTable creates a Query that can be used to rename a table.
- */
- renameTable(oldName: string, newName: string): (Query)
- }
- interface MssqlBuilder {
- /**
- * RenameColumn creates a Query that can be used to rename a column in a table.
- */
- renameColumn(table: string, oldName: string, newName: string): (Query)
- }
- interface MssqlBuilder {
- /**
- * AlterColumn creates a Query that can be used to change the definition of a table column.
- */
- alterColumn(table: string, col: string, typ: string): (Query)
- }
- interface MssqlQueryBuilder {
- /**
- * BuildOrderByAndLimit generates the ORDER BY and LIMIT clauses.
- */
- buildOrderByAndLimit(sql: string, cols: Array, limit: number, offset: number): string
- }
- /**
- * MysqlBuilder is the builder for MySQL databases.
- */
- type _sJRJGqZ = BaseBuilder
- interface MysqlBuilder extends _sJRJGqZ {
- }
- interface newMysqlBuilder {
- /**
- * NewMysqlBuilder creates a new MysqlBuilder instance.
- */
- (db: DB, executor: Executor): Builder
- }
- interface MysqlBuilder {
- /**
- * QueryBuilder returns the query builder supporting the current DB.
- */
- queryBuilder(): QueryBuilder
- }
- interface MysqlBuilder {
- /**
- * Select returns a new SelectQuery object that can be used to build a SELECT statement.
- * The parameters to this method should be the list column names to be selected.
- * A column name may have an optional alias name. For example, Select("id", "my_name AS name").
- */
- select(...cols: string[]): (SelectQuery)
- }
- interface MysqlBuilder {
- /**
- * Model returns a new ModelQuery object that can be used to perform model-based DB operations.
- * The model passed to this method should be a pointer to a model struct.
- */
- model(model: {
- }): (ModelQuery)
- }
- interface MysqlBuilder {
- /**
- * QuoteSimpleTableName quotes a simple table name.
- * A simple table name does not contain any schema prefix.
- */
- quoteSimpleTableName(s: string): string
- }
- interface MysqlBuilder {
- /**
- * QuoteSimpleColumnName quotes a simple column name.
- * A simple column name does not contain any table prefix.
- */
- quoteSimpleColumnName(s: string): string
- }
- interface MysqlBuilder {
- /**
- * Upsert creates a Query that represents an UPSERT SQL statement.
- * Upsert inserts a row into the table if the primary key or unique index is not found.
- * Otherwise it will update the row with the new values.
- * The keys of cols are the column names, while the values of cols are the corresponding column
- * values to be inserted.
- */
- upsert(table: string, cols: Params, ...constraints: string[]): (Query)
- }
- interface MysqlBuilder {
- /**
- * RenameColumn creates a Query that can be used to rename a column in a table.
- */
- renameColumn(table: string, oldName: string, newName: string): (Query)
- }
- interface MysqlBuilder {
- /**
- * DropPrimaryKey creates a Query that can be used to remove the named primary key constraint from a table.
- */
- dropPrimaryKey(table: string, name: string): (Query)
- }
- interface MysqlBuilder {
- /**
- * DropForeignKey creates a Query that can be used to remove the named foreign key constraint from a table.
- */
- dropForeignKey(table: string, name: string): (Query)
- }
- /**
- * OciBuilder is the builder for Oracle databases.
- */
- type _sHTbvIJ = BaseBuilder
- interface OciBuilder extends _sHTbvIJ {
- }
- /**
- * OciQueryBuilder is the query builder for Oracle databases.
- */
- type _sGNFgrc = BaseQueryBuilder
- interface OciQueryBuilder extends _sGNFgrc {
- }
- interface newOciBuilder {
- /**
- * NewOciBuilder creates a new OciBuilder instance.
- */
- (db: DB, executor: Executor): Builder
- }
- interface OciBuilder {
- /**
- * Select returns a new SelectQuery object that can be used to build a SELECT statement.
- * The parameters to this method should be the list column names to be selected.
- * A column name may have an optional alias name. For example, Select("id", "my_name AS name").
- */
- select(...cols: string[]): (SelectQuery)
- }
- interface OciBuilder {
- /**
- * Model returns a new ModelQuery object that can be used to perform model-based DB operations.
- * The model passed to this method should be a pointer to a model struct.
- */
- model(model: {
- }): (ModelQuery)
- }
- interface OciBuilder {
- /**
- * GeneratePlaceholder generates an anonymous parameter placeholder with the given parameter ID.
- */
- generatePlaceholder(i: number): string
- }
- interface OciBuilder {
- /**
- * QueryBuilder returns the query builder supporting the current DB.
- */
- queryBuilder(): QueryBuilder
- }
- interface OciBuilder {
- /**
- * DropIndex creates a Query that can be used to remove the named index from a table.
- */
- dropIndex(table: string, name: string): (Query)
- }
- interface OciBuilder {
- /**
- * RenameTable creates a Query that can be used to rename a table.
- */
- renameTable(oldName: string, newName: string): (Query)
- }
- interface OciBuilder {
- /**
- * AlterColumn creates a Query that can be used to change the definition of a table column.
- */
- alterColumn(table: string, col: string, typ: string): (Query)
- }
- interface OciQueryBuilder {
- /**
- * BuildOrderByAndLimit generates the ORDER BY and LIMIT clauses.
- */
- buildOrderByAndLimit(sql: string, cols: Array, limit: number, offset: number): string
- }
- /**
- * PgsqlBuilder is the builder for PostgreSQL databases.
- */
- type _sALdjlO = BaseBuilder
- interface PgsqlBuilder extends _sALdjlO {
- }
- interface newPgsqlBuilder {
- /**
- * NewPgsqlBuilder creates a new PgsqlBuilder instance.
- */
- (db: DB, executor: Executor): Builder
- }
- interface PgsqlBuilder {
- /**
- * Select returns a new SelectQuery object that can be used to build a SELECT statement.
- * The parameters to this method should be the list column names to be selected.
- * A column name may have an optional alias name. For example, Select("id", "my_name AS name").
- */
- select(...cols: string[]): (SelectQuery)
- }
- interface PgsqlBuilder {
- /**
- * Model returns a new ModelQuery object that can be used to perform model-based DB operations.
- * The model passed to this method should be a pointer to a model struct.
- */
- model(model: {
- }): (ModelQuery)
- }
- interface PgsqlBuilder {
- /**
- * GeneratePlaceholder generates an anonymous parameter placeholder with the given parameter ID.
- */
- generatePlaceholder(i: number): string
- }
- interface PgsqlBuilder {
- /**
- * QueryBuilder returns the query builder supporting the current DB.
- */
- queryBuilder(): QueryBuilder
- }
- interface PgsqlBuilder {
- /**
- * Upsert creates a Query that represents an UPSERT SQL statement.
- * Upsert inserts a row into the table if the primary key or unique index is not found.
- * Otherwise it will update the row with the new values.
- * The keys of cols are the column names, while the values of cols are the corresponding column
- * values to be inserted.
- */
- upsert(table: string, cols: Params, ...constraints: string[]): (Query)
- }
- interface PgsqlBuilder {
- /**
- * DropIndex creates a Query that can be used to remove the named index from a table.
- */
- dropIndex(table: string, name: string): (Query)
- }
- interface PgsqlBuilder {
- /**
- * RenameTable creates a Query that can be used to rename a table.
- */
- renameTable(oldName: string, newName: string): (Query)
- }
- interface PgsqlBuilder {
- /**
- * AlterColumn creates a Query that can be used to change the definition of a table column.
- */
- alterColumn(table: string, col: string, typ: string): (Query)
- }
- /**
- * SqliteBuilder is the builder for SQLite databases.
- */
- type _spUmBhh = BaseBuilder
- interface SqliteBuilder extends _spUmBhh {
- }
- interface newSqliteBuilder {
- /**
- * NewSqliteBuilder creates a new SqliteBuilder instance.
- */
- (db: DB, executor: Executor): Builder
- }
- interface SqliteBuilder {
- /**
- * QueryBuilder returns the query builder supporting the current DB.
- */
- queryBuilder(): QueryBuilder
- }
- interface SqliteBuilder {
- /**
- * Select returns a new SelectQuery object that can be used to build a SELECT statement.
- * The parameters to this method should be the list column names to be selected.
- * A column name may have an optional alias name. For example, Select("id", "my_name AS name").
- */
- select(...cols: string[]): (SelectQuery)
- }
- interface SqliteBuilder {
- /**
- * Model returns a new ModelQuery object that can be used to perform model-based DB operations.
- * The model passed to this method should be a pointer to a model struct.
- */
- model(model: {
- }): (ModelQuery)
- }
- interface SqliteBuilder {
- /**
- * QuoteSimpleTableName quotes a simple table name.
- * A simple table name does not contain any schema prefix.
- */
- quoteSimpleTableName(s: string): string
- }
- interface SqliteBuilder {
- /**
- * QuoteSimpleColumnName quotes a simple column name.
- * A simple column name does not contain any table prefix.
- */
- quoteSimpleColumnName(s: string): string
- }
- interface SqliteBuilder {
- /**
- * DropIndex creates a Query that can be used to remove the named index from a table.
- */
- dropIndex(table: string, name: string): (Query)
- }
- interface SqliteBuilder {
- /**
- * TruncateTable creates a Query that can be used to truncate a table.
- */
- truncateTable(table: string): (Query)
- }
- interface SqliteBuilder {
- /**
- * RenameTable creates a Query that can be used to rename a table.
- */
- renameTable(oldName: string, newName: string): (Query)
- }
- interface SqliteBuilder {
- /**
- * AlterColumn creates a Query that can be used to change the definition of a table column.
- */
- alterColumn(table: string, col: string, typ: string): (Query)
- }
- interface SqliteBuilder {
- /**
- * AddPrimaryKey creates a Query that can be used to specify primary key(s) for a table.
- * The "name" parameter specifies the name of the primary key constraint.
- */
- addPrimaryKey(table: string, name: string, ...cols: string[]): (Query)
- }
- interface SqliteBuilder {
- /**
- * DropPrimaryKey creates a Query that can be used to remove the named primary key constraint from a table.
- */
- dropPrimaryKey(table: string, name: string): (Query)
- }
- interface SqliteBuilder {
- /**
- * AddForeignKey creates a Query that can be used to add a foreign key constraint to a table.
- * The length of cols and refCols must be the same as they refer to the primary and referential columns.
- * The optional "options" parameters will be appended to the SQL statement. They can be used to
- * specify options such as "ON DELETE CASCADE".
- */
- addForeignKey(table: string, name: string, cols: Array, refCols: Array, refTable: string, ...options: string[]): (Query)
- }
- interface SqliteBuilder {
- /**
- * DropForeignKey creates a Query that can be used to remove the named foreign key constraint from a table.
- */
- dropForeignKey(table: string, name: string): (Query)
- }
- /**
- * StandardBuilder is the builder that is used by DB for an unknown driver.
- */
- type _sWjnuHQ = BaseBuilder
- interface StandardBuilder extends _sWjnuHQ {
- }
- interface newStandardBuilder {
- /**
- * NewStandardBuilder creates a new StandardBuilder instance.
- */
- (db: DB, executor: Executor): Builder
- }
- interface StandardBuilder {
- /**
- * QueryBuilder returns the query builder supporting the current DB.
- */
- queryBuilder(): QueryBuilder
- }
- interface StandardBuilder {
- /**
- * Select returns a new SelectQuery object that can be used to build a SELECT statement.
- * The parameters to this method should be the list column names to be selected.
- * A column name may have an optional alias name. For example, Select("id", "my_name AS name").
- */
- select(...cols: string[]): (SelectQuery)
- }
- interface StandardBuilder {
- /**
- * Model returns a new ModelQuery object that can be used to perform model-based DB operations.
- * The model passed to this method should be a pointer to a model struct.
- */
- model(model: {
- }): (ModelQuery)
- }
- /**
- * LogFunc logs a message for each SQL statement being executed.
- * This method takes one or multiple parameters. If a single parameter
- * is provided, it will be treated as the log message. If multiple parameters
- * are provided, they will be passed to fmt.Sprintf() to generate the log message.
- */
- interface LogFunc {(format: string, ...a: {
- }[]): void }
- /**
- * PerfFunc is called when a query finishes execution.
- * The query execution time is passed to this function so that the DB performance
- * can be profiled. The "ns" parameter gives the number of nanoseconds that the
- * SQL statement takes to execute, while the "execute" parameter indicates whether
- * the SQL statement is executed or queried (usually SELECT statements).
- */
- interface PerfFunc {(ns: number, sql: string, execute: boolean): void }
- /**
- * QueryLogFunc is called each time when performing a SQL query.
- * The "t" parameter gives the time that the SQL statement takes to execute,
- * while rows and err are the result of the query.
- */
- interface QueryLogFunc {(ctx: context.Context, t: time.Duration, sql: string, rows: sql.Rows, err: Error): void }
- /**
- * ExecLogFunc is called each time when a SQL statement is executed.
- * The "t" parameter gives the time that the SQL statement takes to execute,
- * while result and err refer to the result of the execution.
- */
- interface ExecLogFunc {(ctx: context.Context, t: time.Duration, sql: string, result: sql.Result, err: Error): void }
- /**
- * BuilderFunc creates a Builder instance using the given DB instance and Executor.
- */
- interface BuilderFunc {(_arg0: DB, _arg1: Executor): Builder }
- /**
- * DB enhances sql.DB by providing a set of DB-agnostic query building methods.
- * DB allows easier query building and population of data into Go variables.
- */
- type _swIUbPb = Builder
- interface DB extends _swIUbPb {
- /**
- * FieldMapper maps struct fields to DB columns. Defaults to DefaultFieldMapFunc.
- */
- fieldMapper: FieldMapFunc
- /**
- * TableMapper maps structs to table names. Defaults to GetTableName.
- */
- tableMapper: TableMapFunc
- /**
- * LogFunc logs the SQL statements being executed. Defaults to nil, meaning no logging.
- */
- logFunc: LogFunc
- /**
- * PerfFunc logs the SQL execution time. Defaults to nil, meaning no performance profiling.
- * Deprecated: Please use QueryLogFunc and ExecLogFunc instead.
- */
- perfFunc: PerfFunc
- /**
- * QueryLogFunc is called each time when performing a SQL query that returns data.
- */
- queryLogFunc: QueryLogFunc
- /**
- * ExecLogFunc is called each time when a SQL statement is executed.
- */
- execLogFunc: ExecLogFunc
- }
- /**
- * Errors represents a list of errors.
- */
- interface Errors extends Array{}
- interface newFromDB {
- /**
- * NewFromDB encapsulates an existing database connection.
- */
- (sqlDB: sql.DB, driverName: string): (DB)
- }
- interface open {
- /**
- * Open opens a database specified by a driver name and data source name (DSN).
- * Note that Open does not check if DSN is specified correctly. It doesn't try to establish a DB connection either.
- * Please refer to sql.Open() for more information.
- */
- (driverName: string, dsn: string): (DB)
- }
- interface mustOpen {
- /**
- * MustOpen opens a database and establishes a connection to it.
- * Please refer to sql.Open() and sql.Ping() for more information.
- */
- (driverName: string, dsn: string): (DB)
- }
- interface DB {
- /**
- * Clone makes a shallow copy of DB.
- */
- clone(): (DB)
- }
- interface DB {
- /**
- * WithContext returns a new instance of DB associated with the given context.
- */
- withContext(ctx: context.Context): (DB)
- }
- interface DB {
- /**
- * Context returns the context associated with the DB instance.
- * It returns nil if no context is associated.
- */
- context(): context.Context
- }
- interface DB {
- /**
- * DB returns the sql.DB instance encapsulated by dbx.DB.
- */
- db(): (sql.DB)
- }
- interface DB {
- /**
- * Close closes the database, releasing any open resources.
- * It is rare to Close a DB, as the DB handle is meant to be
- * long-lived and shared between many goroutines.
- */
- close(): void
- }
- interface DB {
- /**
- * Begin starts a transaction.
- */
- begin(): (Tx)
- }
- interface DB {
- /**
- * BeginTx starts a transaction with the given context and transaction options.
- */
- beginTx(ctx: context.Context, opts: sql.TxOptions): (Tx)
- }
- interface DB {
- /**
- * Wrap encapsulates an existing transaction.
- */
- wrap(sqlTx: sql.Tx): (Tx)
- }
- interface DB {
- /**
- * Transactional starts a transaction and executes the given function.
- * If the function returns an error, the transaction will be rolled back.
- * Otherwise, the transaction will be committed.
- */
- transactional(f: (_arg0: Tx) => void): void
- }
- interface DB {
- /**
- * TransactionalContext starts a transaction and executes the given function with the given context and transaction options.
- * If the function returns an error, the transaction will be rolled back.
- * Otherwise, the transaction will be committed.
- */
- transactionalContext(ctx: context.Context, opts: sql.TxOptions, f: (_arg0: Tx) => void): void
- }
- interface DB {
- /**
- * DriverName returns the name of the DB driver.
- */
- driverName(): string
- }
- interface DB {
- /**
- * QuoteTableName quotes the given table name appropriately.
- * If the table name contains DB schema prefix, it will be handled accordingly.
- * This method will do nothing if the table name is already quoted or if it contains parenthesis.
- */
- quoteTableName(s: string): string
- }
- interface DB {
- /**
- * QuoteColumnName quotes the given column name appropriately.
- * If the table name contains table name prefix, it will be handled accordingly.
- * This method will do nothing if the column name is already quoted or if it contains parenthesis.
- */
- quoteColumnName(s: string): string
- }
- interface Errors {
- /**
- * Error returns the error string of Errors.
- */
- error(): string
- }
- /**
- * Expression represents a DB expression that can be embedded in a SQL statement.
- */
- interface Expression {
- [key:string]: any;
- /**
- * Build converts an expression into a SQL fragment.
- * If the expression contains binding parameters, they will be added to the given Params.
- */
- build(_arg0: DB, _arg1: Params): string
- }
- /**
- * HashExp represents a hash expression.
- *
- * A hash expression is a map whose keys are DB column names which need to be filtered according
- * to the corresponding values. For example, HashExp{"level": 2, "dept": 10} will generate
- * the SQL: "level"=2 AND "dept"=10.
- *
- * HashExp also handles nil values and slice values. For example, HashExp{"level": []interface{}{1, 2}, "dept": nil}
- * will generate: "level" IN (1, 2) AND "dept" IS NULL.
- */
- interface HashExp extends _TygojaDict{}
- interface newExp {
- /**
- * NewExp generates an expression with the specified SQL fragment and the optional binding parameters.
- */
- (e: string, ...params: Params[]): Expression
- }
- interface not {
- /**
- * Not generates a NOT expression which prefixes "NOT" to the specified expression.
- */
- (e: Expression): Expression
- }
- interface and {
- /**
- * And generates an AND expression which concatenates the given expressions with "AND".
- */
- (...exps: Expression[]): Expression
- }
- interface or {
- /**
- * Or generates an OR expression which concatenates the given expressions with "OR".
- */
- (...exps: Expression[]): Expression
- }
- interface _in {
- /**
- * In generates an IN expression for the specified column and the list of allowed values.
- * If values is empty, a SQL "0=1" will be generated which represents a false expression.
- */
- (col: string, ...values: {
- }[]): Expression
- }
- interface notIn {
- /**
- * NotIn generates an NOT IN expression for the specified column and the list of disallowed values.
- * If values is empty, an empty string will be returned indicating a true expression.
- */
- (col: string, ...values: {
- }[]): Expression
- }
- interface like {
- /**
- * Like generates a LIKE expression for the specified column and the possible strings that the column should be like.
- * If multiple values are present, the column should be like *all* of them. For example, Like("name", "key", "word")
- * will generate a SQL expression: "name" LIKE "%key%" AND "name" LIKE "%word%".
- *
- * By default, each value will be surrounded by "%" to enable partial matching. If a value contains special characters
- * such as "%", "\", "_", they will also be properly escaped.
- *
- * You may call Escape() and/or Match() to change the default behavior. For example, Like("name", "key").Match(false, true)
- * generates "name" LIKE "key%".
- */
- (col: string, ...values: string[]): (LikeExp)
- }
- interface notLike {
- /**
- * NotLike generates a NOT LIKE expression.
- * For example, NotLike("name", "key", "word") will generate a SQL expression:
- * "name" NOT LIKE "%key%" AND "name" NOT LIKE "%word%". Please see Like() for more details.
- */
- (col: string, ...values: string[]): (LikeExp)
- }
- interface orLike {
- /**
- * OrLike generates an OR LIKE expression.
- * This is similar to Like() except that the column should be like one of the possible values.
- * For example, OrLike("name", "key", "word") will generate a SQL expression:
- * "name" LIKE "%key%" OR "name" LIKE "%word%". Please see Like() for more details.
- */
- (col: string, ...values: string[]): (LikeExp)
- }
- interface orNotLike {
- /**
- * OrNotLike generates an OR NOT LIKE expression.
- * For example, OrNotLike("name", "key", "word") will generate a SQL expression:
- * "name" NOT LIKE "%key%" OR "name" NOT LIKE "%word%". Please see Like() for more details.
- */
- (col: string, ...values: string[]): (LikeExp)
- }
- interface exists {
- /**
- * Exists generates an EXISTS expression by prefixing "EXISTS" to the given expression.
- */
- (exp: Expression): Expression
- }
- interface notExists {
- /**
- * NotExists generates an EXISTS expression by prefixing "NOT EXISTS" to the given expression.
- */
- (exp: Expression): Expression
- }
- interface between {
- /**
- * Between generates a BETWEEN expression.
- * For example, Between("age", 10, 30) generates: "age" BETWEEN 10 AND 30
- */
- (col: string, from: {
- }, to: {
- }): Expression
- }
- interface notBetween {
- /**
- * NotBetween generates a NOT BETWEEN expression.
- * For example, NotBetween("age", 10, 30) generates: "age" NOT BETWEEN 10 AND 30
- */
- (col: string, from: {
- }, to: {
- }): Expression
- }
- /**
- * Exp represents an expression with a SQL fragment and a list of optional binding parameters.
- */
- interface Exp {
- }
- interface Exp {
- /**
- * Build converts an expression into a SQL fragment.
- */
- build(db: DB, params: Params): string
- }
- interface HashExp {
- /**
- * Build converts an expression into a SQL fragment.
- */
- build(db: DB, params: Params): string
- }
- /**
- * NotExp represents an expression that should prefix "NOT" to a specified expression.
- */
- interface NotExp {
- }
- interface NotExp {
- /**
- * Build converts an expression into a SQL fragment.
- */
- build(db: DB, params: Params): string
- }
- /**
- * AndOrExp represents an expression that concatenates multiple expressions using either "AND" or "OR".
- */
- interface AndOrExp {
- }
- interface AndOrExp {
- /**
- * Build converts an expression into a SQL fragment.
- */
- build(db: DB, params: Params): string
- }
- /**
- * InExp represents an "IN" or "NOT IN" expression.
- */
- interface InExp {
- }
- interface InExp {
- /**
- * Build converts an expression into a SQL fragment.
- */
- build(db: DB, params: Params): string
- }
- /**
- * LikeExp represents a variant of LIKE expressions.
- */
- interface LikeExp {
- /**
- * Like stores the LIKE operator. It can be "LIKE", "NOT LIKE".
- * It may also be customized as something like "ILIKE".
- */
- like: string
- }
- interface LikeExp {
- /**
- * Escape specifies how a LIKE expression should be escaped.
- * Each string at position 2i represents a special character and the string at position 2i+1 is
- * the corresponding escaped version.
- */
- escape(...chars: string[]): (LikeExp)
- }
- interface LikeExp {
- /**
- * Match specifies whether to do wildcard matching on the left and/or right of given strings.
- */
- match(left: boolean, right: boolean): (LikeExp)
- }
- interface LikeExp {
- /**
- * Build converts an expression into a SQL fragment.
- */
- build(db: DB, params: Params): string
- }
- /**
- * ExistsExp represents an EXISTS or NOT EXISTS expression.
- */
- interface ExistsExp {
- }
- interface ExistsExp {
- /**
- * Build converts an expression into a SQL fragment.
- */
- build(db: DB, params: Params): string
- }
- /**
- * BetweenExp represents a BETWEEN or a NOT BETWEEN expression.
- */
- interface BetweenExp {
- }
- interface BetweenExp {
- /**
- * Build converts an expression into a SQL fragment.
- */
- build(db: DB, params: Params): string
- }
- interface enclose {
- /**
- * Enclose surrounds the provided nonempty expression with parenthesis "()".
- */
- (exp: Expression): Expression
- }
- /**
- * EncloseExp represents a parenthesis enclosed expression.
- */
- interface EncloseExp {
- }
- interface EncloseExp {
- /**
- * Build converts an expression into a SQL fragment.
- */
- build(db: DB, params: Params): string
- }
- /**
- * TableModel is the interface that should be implemented by models which have unconventional table names.
- */
- interface TableModel {
- [key:string]: any;
- tableName(): string
- }
- /**
- * ModelQuery represents a query associated with a struct model.
- */
- interface ModelQuery {
- }
- interface newModelQuery {
- (model: {
- }, fieldMapFunc: FieldMapFunc, db: DB, builder: Builder): (ModelQuery)
- }
- interface ModelQuery {
- /**
- * Context returns the context associated with the query.
- */
- context(): context.Context
- }
- interface ModelQuery {
- /**
- * WithContext associates a context with the query.
- */
- withContext(ctx: context.Context): (ModelQuery)
- }
- interface ModelQuery {
- /**
- * Exclude excludes the specified struct fields from being inserted/updated into the DB table.
- */
- exclude(...attrs: string[]): (ModelQuery)
- }
- interface ModelQuery {
- /**
- * Insert inserts a row in the table using the struct model associated with this query.
- *
- * By default, it inserts *all* public fields into the table, including those nil or empty ones.
- * You may pass a list of the fields to this method to indicate that only those fields should be inserted.
- * You may also call Exclude to exclude some fields from being inserted.
- *
- * If a model has an empty primary key, it is considered auto-incremental and the corresponding struct
- * field will be filled with the generated primary key value after a successful insertion.
- */
- insert(...attrs: string[]): void
- }
- interface ModelQuery {
- /**
- * Update updates a row in the table using the struct model associated with this query.
- * The row being updated has the same primary key as specified by the model.
- *
- * By default, it updates *all* public fields in the table, including those nil or empty ones.
- * You may pass a list of the fields to this method to indicate that only those fields should be updated.
- * You may also call Exclude to exclude some fields from being updated.
- */
- update(...attrs: string[]): void
- }
- interface ModelQuery {
- /**
- * Delete deletes a row in the table using the primary key specified by the struct model associated with this query.
- */
- delete(): void
- }
- /**
- * ExecHookFunc executes before op allowing custom handling like auto fail/retry.
- */
- interface ExecHookFunc {(q: Query, op: () => void): void }
- /**
- * OneHookFunc executes right before the query populate the row result from One() call (aka. op).
- */
- interface OneHookFunc {(q: Query, a: {
- }, op: (b: {
- }) => void): void }
- /**
- * AllHookFunc executes right before the query populate the row result from All() call (aka. op).
- */
- interface AllHookFunc {(q: Query, sliceA: {
- }, op: (sliceB: {
- }) => void): void }
- /**
- * Params represents a list of parameter values to be bound to a SQL statement.
- * The map keys are the parameter names while the map values are the corresponding parameter values.
- */
- interface Params extends _TygojaDict{}
- /**
- * Executor prepares, executes, or queries a SQL statement.
- */
- interface Executor {
- [key:string]: any;
- /**
- * Exec executes a SQL statement
- */
- exec(query: string, ...args: {
- }[]): sql.Result
- /**
- * ExecContext executes a SQL statement with the given context
- */
- execContext(ctx: context.Context, query: string, ...args: {
- }[]): sql.Result
- /**
- * Query queries a SQL statement
- */
- query(query: string, ...args: {
- }[]): (sql.Rows)
- /**
- * QueryContext queries a SQL statement with the given context
- */
- queryContext(ctx: context.Context, query: string, ...args: {
- }[]): (sql.Rows)
- /**
- * Prepare creates a prepared statement
- */
- prepare(query: string): (sql.Stmt)
- }
- /**
- * Query represents a SQL statement to be executed.
- */
- interface Query {
- /**
- * FieldMapper maps struct field names to DB column names.
- */
- fieldMapper: FieldMapFunc
- /**
- * LastError contains the last error (if any) of the query.
- * LastError is cleared by Execute(), Row(), Rows(), One(), and All().
- */
- lastError: Error
- /**
- * LogFunc is used to log the SQL statement being executed.
- */
- logFunc: LogFunc
- /**
- * PerfFunc is used to log the SQL execution time. It is ignored if nil.
- * Deprecated: Please use QueryLogFunc and ExecLogFunc instead.
- */
- perfFunc: PerfFunc
- /**
- * QueryLogFunc is called each time when performing a SQL query that returns data.
- */
- queryLogFunc: QueryLogFunc
- /**
- * ExecLogFunc is called each time when a SQL statement is executed.
- */
- execLogFunc: ExecLogFunc
- }
- interface newQuery {
- /**
- * NewQuery creates a new Query with the given SQL statement.
- */
- (db: DB, executor: Executor, sql: string): (Query)
- }
- interface Query {
- /**
- * SQL returns the original SQL used to create the query.
- * The actual SQL (RawSQL) being executed is obtained by replacing the named
- * parameter placeholders with anonymous ones.
- */
- sql(): string
- }
- interface Query {
- /**
- * Context returns the context associated with the query.
- */
- context(): context.Context
- }
- interface Query {
- /**
- * WithContext associates a context with the query.
- */
- withContext(ctx: context.Context): (Query)
- }
- interface Query {
- /**
- * WithExecHook associates the provided exec hook function with the query.
- *
- * It is called for every Query resolver (Execute(), One(), All(), Row(), Column()),
- * allowing you to implement auto fail/retry or any other additional handling.
- */
- withExecHook(fn: ExecHookFunc): (Query)
- }
- interface Query {
- /**
- * WithOneHook associates the provided hook function with the query,
- * called on q.One(), allowing you to implement custom struct scan based
- * on the One() argument and/or result.
- */
- withOneHook(fn: OneHookFunc): (Query)
- }
- interface Query {
- /**
- * WithOneHook associates the provided hook function with the query,
- * called on q.All(), allowing you to implement custom slice scan based
- * on the All() argument and/or result.
- */
- withAllHook(fn: AllHookFunc): (Query)
- }
- interface Query {
- /**
- * Params returns the parameters to be bound to the SQL statement represented by this query.
- */
- params(): Params
- }
- interface Query {
- /**
- * Prepare creates a prepared statement for later queries or executions.
- * Close() should be called after finishing all queries.
- */
- prepare(): (Query)
- }
- interface Query {
- /**
- * Close closes the underlying prepared statement.
- * Close does nothing if the query has not been prepared before.
- */
- close(): void
- }
- interface Query {
- /**
- * Bind sets the parameters that should be bound to the SQL statement.
- * The parameter placeholders in the SQL statement are in the format of "{:ParamName}".
- */
- bind(params: Params): (Query)
- }
- interface Query {
- /**
- * Execute executes the SQL statement without retrieving data.
- */
- execute(): sql.Result
- }
- interface Query {
- /**
- * One executes the SQL statement and populates the first row of the result into a struct or NullStringMap.
- * Refer to Rows.ScanStruct() and Rows.ScanMap() for more details on how to specify
- * the variable to be populated.
- * Note that when the query has no rows in the result set, an sql.ErrNoRows will be returned.
- */
- one(a: {
- }): void
- }
- interface Query {
- /**
- * All executes the SQL statement and populates all the resulting rows into a slice of struct or NullStringMap.
- * The slice must be given as a pointer. Each slice element must be either a struct or a NullStringMap.
- * Refer to Rows.ScanStruct() and Rows.ScanMap() for more details on how each slice element can be.
- * If the query returns no row, the slice will be an empty slice (not nil).
- */
- all(slice: {
- }): void
- }
- interface Query {
- /**
- * Row executes the SQL statement and populates the first row of the result into a list of variables.
- * Note that the number of the variables should match to that of the columns in the query result.
- * Note that when the query has no rows in the result set, an sql.ErrNoRows will be returned.
- */
- row(...a: {
- }[]): void
- }
- interface Query {
- /**
- * Column executes the SQL statement and populates the first column of the result into a slice.
- * Note that the parameter must be a pointer to a slice.
- */
- column(a: {
- }): void
- }
- interface Query {
- /**
- * Rows executes the SQL statement and returns a Rows object to allow retrieving data row by row.
- */
- rows(): (Rows)
- }
- /**
- * QueryBuilder builds different clauses for a SELECT SQL statement.
- */
- interface QueryBuilder {
- [key:string]: any;
- /**
- * BuildSelect generates a SELECT clause from the given selected column names.
- */
- buildSelect(cols: Array, distinct: boolean, option: string): string
- /**
- * BuildFrom generates a FROM clause from the given tables.
- */
- buildFrom(tables: Array): string
- /**
- * BuildGroupBy generates a GROUP BY clause from the given group-by columns.
- */
- buildGroupBy(cols: Array): string
- /**
- * BuildJoin generates a JOIN clause from the given join information.
- */
- buildJoin(_arg0: Array, _arg1: Params): string
- /**
- * BuildWhere generates a WHERE clause from the given expression.
- */
- buildWhere(_arg0: Expression, _arg1: Params): string
- /**
- * BuildHaving generates a HAVING clause from the given expression.
- */
- buildHaving(_arg0: Expression, _arg1: Params): string
- /**
- * BuildOrderByAndLimit generates the ORDER BY and LIMIT clauses.
- */
- buildOrderByAndLimit(_arg0: string, _arg1: Array, _arg2: number, _arg3: number): string
- /**
- * BuildUnion generates a UNION clause from the given union information.
- */
- buildUnion(_arg0: Array, _arg1: Params): string
- }
- /**
- * BaseQueryBuilder provides a basic implementation of QueryBuilder.
- */
- interface BaseQueryBuilder {
- }
- interface newBaseQueryBuilder {
- /**
- * NewBaseQueryBuilder creates a new BaseQueryBuilder instance.
- */
- (db: DB): (BaseQueryBuilder)
- }
- interface BaseQueryBuilder {
- /**
- * DB returns the DB instance associated with the query builder.
- */
- db(): (DB)
- }
- interface BaseQueryBuilder {
- /**
- * BuildSelect generates a SELECT clause from the given selected column names.
- */
- buildSelect(cols: Array, distinct: boolean, option: string): string
- }
- interface BaseQueryBuilder {
- /**
- * BuildFrom generates a FROM clause from the given tables.
- */
- buildFrom(tables: Array): string
- }
- interface BaseQueryBuilder {
- /**
- * BuildJoin generates a JOIN clause from the given join information.
- */
- buildJoin(joins: Array, params: Params): string
- }
- interface BaseQueryBuilder {
- /**
- * BuildWhere generates a WHERE clause from the given expression.
- */
- buildWhere(e: Expression, params: Params): string
- }
- interface BaseQueryBuilder {
- /**
- * BuildHaving generates a HAVING clause from the given expression.
- */
- buildHaving(e: Expression, params: Params): string
- }
- interface BaseQueryBuilder {
- /**
- * BuildGroupBy generates a GROUP BY clause from the given group-by columns.
- */
- buildGroupBy(cols: Array): string
- }
- interface BaseQueryBuilder {
- /**
- * BuildOrderByAndLimit generates the ORDER BY and LIMIT clauses.
- */
- buildOrderByAndLimit(sql: string, cols: Array, limit: number, offset: number): string
- }
- interface BaseQueryBuilder {
- /**
- * BuildUnion generates a UNION clause from the given union information.
- */
- buildUnion(unions: Array, params: Params): string
- }
- interface BaseQueryBuilder {
- /**
- * BuildOrderBy generates the ORDER BY clause.
- */
- buildOrderBy(cols: Array): string
- }
- interface BaseQueryBuilder {
- /**
- * BuildLimit generates the LIMIT clause.
- */
- buildLimit(limit: number, offset: number): string
- }
- /**
- * VarTypeError indicates a variable type error when trying to populating a variable with DB result.
- */
- interface VarTypeError extends String{}
- interface VarTypeError {
- /**
- * Error returns the error message.
- */
- error(): string
- }
- /**
- * NullStringMap is a map of sql.NullString that can be used to hold DB query result.
- * The map keys correspond to the DB column names, while the map values are their corresponding column values.
- */
- interface NullStringMap extends _TygojaDict{}
- /**
- * Rows enhances sql.Rows by providing additional data query methods.
- * Rows can be obtained by calling Query.Rows(). It is mainly used to populate data row by row.
- */
- type _sguxiye = sql.Rows
- interface Rows extends _sguxiye {
- }
- interface Rows {
- /**
- * ScanMap populates the current row of data into a NullStringMap.
- * Note that the NullStringMap must not be nil, or it will panic.
- * The NullStringMap will be populated using column names as keys and their values as
- * the corresponding element values.
- */
- scanMap(a: NullStringMap): void
- }
- interface Rows {
- /**
- * ScanStruct populates the current row of data into a struct.
- * The struct must be given as a pointer.
- *
- * ScanStruct associates struct fields with DB table columns through a field mapping function.
- * It populates a struct field with the data of its associated column.
- * Note that only exported struct fields will be populated.
- *
- * By default, DefaultFieldMapFunc() is used to map struct fields to table columns.
- * This function separates each word in a field name with a underscore and turns every letter into lower case.
- * For example, "LastName" is mapped to "last_name", "MyID" is mapped to "my_id", and so on.
- * To change the default behavior, set DB.FieldMapper with your custom mapping function.
- * You may also set Query.FieldMapper to change the behavior for particular queries.
- */
- scanStruct(a: {
- }): void
- }
- /**
- * BuildHookFunc defines a callback function that is executed on Query creation.
- */
- interface BuildHookFunc {(q: Query): void }
- /**
- * SelectQuery represents a DB-agnostic SELECT query.
- * It can be built into a DB-specific query by calling the Build() method.
- */
- interface SelectQuery {
- /**
- * FieldMapper maps struct field names to DB column names.
- */
- fieldMapper: FieldMapFunc
- /**
- * TableMapper maps structs to DB table names.
- */
- tableMapper: TableMapFunc
- }
- /**
- * JoinInfo contains the specification for a JOIN clause.
- */
- interface JoinInfo {
- join: string
- table: string
- on: Expression
- }
- /**
- * UnionInfo contains the specification for a UNION clause.
- */
- interface UnionInfo {
- all: boolean
- query?: Query
- }
- interface newSelectQuery {
- /**
- * NewSelectQuery creates a new SelectQuery instance.
- */
- (builder: Builder, db: DB): (SelectQuery)
- }
- interface SelectQuery {
- /**
- * WithBuildHook runs the provided hook function with the query created on Build().
- */
- withBuildHook(fn: BuildHookFunc): (SelectQuery)
- }
- interface SelectQuery {
- /**
- * Context returns the context associated with the query.
- */
- context(): context.Context
- }
- interface SelectQuery {
- /**
- * WithContext associates a context with the query.
- */
- withContext(ctx: context.Context): (SelectQuery)
- }
- interface SelectQuery {
- /**
- * PreFragment sets SQL fragment that should be prepended before the select query (e.g. WITH clause).
- */
- preFragment(fragment: string): (SelectQuery)
- }
- interface SelectQuery {
- /**
- * PostFragment sets SQL fragment that should be appended at the end of the select query.
- */
- postFragment(fragment: string): (SelectQuery)
- }
- interface SelectQuery {
- /**
- * Select specifies the columns to be selected.
- * Column names will be automatically quoted.
- */
- select(...cols: string[]): (SelectQuery)
- }
- interface SelectQuery {
- /**
- * AndSelect adds additional columns to be selected.
- * Column names will be automatically quoted.
- */
- andSelect(...cols: string[]): (SelectQuery)
- }
- interface SelectQuery {
- /**
- * Distinct specifies whether to select columns distinctively.
- * By default, distinct is false.
- */
- distinct(v: boolean): (SelectQuery)
- }
- interface SelectQuery {
- /**
- * SelectOption specifies additional option that should be append to "SELECT".
- */
- selectOption(option: string): (SelectQuery)
- }
- interface SelectQuery {
- /**
- * From specifies which tables to select from.
- * Table names will be automatically quoted.
- */
- from(...tables: string[]): (SelectQuery)
- }
- interface SelectQuery {
- /**
- * Where specifies the WHERE condition.
- */
- where(e: Expression): (SelectQuery)
- }
- interface SelectQuery {
- /**
- * AndWhere concatenates a new WHERE condition with the existing one (if any) using "AND".
- */
- andWhere(e: Expression): (SelectQuery)
- }
- interface SelectQuery {
- /**
- * OrWhere concatenates a new WHERE condition with the existing one (if any) using "OR".
- */
- orWhere(e: Expression): (SelectQuery)
- }
- interface SelectQuery {
- /**
- * Join specifies a JOIN clause.
- * The "typ" parameter specifies the JOIN type (e.g. "INNER JOIN", "LEFT JOIN").
- */
- join(typ: string, table: string, on: Expression): (SelectQuery)
- }
- interface SelectQuery {
- /**
- * InnerJoin specifies an INNER JOIN clause.
- * This is a shortcut method for Join.
- */
- innerJoin(table: string, on: Expression): (SelectQuery)
- }
- interface SelectQuery {
- /**
- * LeftJoin specifies a LEFT JOIN clause.
- * This is a shortcut method for Join.
- */
- leftJoin(table: string, on: Expression): (SelectQuery)
- }
- interface SelectQuery {
- /**
- * RightJoin specifies a RIGHT JOIN clause.
- * This is a shortcut method for Join.
- */
- rightJoin(table: string, on: Expression): (SelectQuery)
- }
- interface SelectQuery {
- /**
- * OrderBy specifies the ORDER BY clause.
- * Column names will be properly quoted. A column name can contain "ASC" or "DESC" to indicate its ordering direction.
- */
- orderBy(...cols: string[]): (SelectQuery)
- }
- interface SelectQuery {
- /**
- * AndOrderBy appends additional columns to the existing ORDER BY clause.
- * Column names will be properly quoted. A column name can contain "ASC" or "DESC" to indicate its ordering direction.
- */
- andOrderBy(...cols: string[]): (SelectQuery)
- }
- interface SelectQuery {
- /**
- * GroupBy specifies the GROUP BY clause.
- * Column names will be properly quoted.
- */
- groupBy(...cols: string[]): (SelectQuery)
- }
- interface SelectQuery {
- /**
- * AndGroupBy appends additional columns to the existing GROUP BY clause.
- * Column names will be properly quoted.
- */
- andGroupBy(...cols: string[]): (SelectQuery)
- }
- interface SelectQuery {
- /**
- * Having specifies the HAVING clause.
- */
- having(e: Expression): (SelectQuery)
- }
- interface SelectQuery {
- /**
- * AndHaving concatenates a new HAVING condition with the existing one (if any) using "AND".
- */
- andHaving(e: Expression): (SelectQuery)
- }
- interface SelectQuery {
- /**
- * OrHaving concatenates a new HAVING condition with the existing one (if any) using "OR".
- */
- orHaving(e: Expression): (SelectQuery)
- }
- interface SelectQuery {
- /**
- * Union specifies a UNION clause.
- */
- union(q: Query): (SelectQuery)
- }
- interface SelectQuery {
- /**
- * UnionAll specifies a UNION ALL clause.
- */
- unionAll(q: Query): (SelectQuery)
- }
- interface SelectQuery {
- /**
- * Limit specifies the LIMIT clause.
- * A negative limit means no limit.
- */
- limit(limit: number): (SelectQuery)
- }
- interface SelectQuery {
- /**
- * Offset specifies the OFFSET clause.
- * A negative offset means no offset.
- */
- offset(offset: number): (SelectQuery)
- }
- interface SelectQuery {
- /**
- * Bind specifies the parameter values to be bound to the query.
- */
- bind(params: Params): (SelectQuery)
- }
- interface SelectQuery {
- /**
- * AndBind appends additional parameters to be bound to the query.
- */
- andBind(params: Params): (SelectQuery)
- }
- interface SelectQuery {
- /**
- * Build builds the SELECT query and returns an executable Query object.
- */
- build(): (Query)
- }
- interface SelectQuery {
- /**
- * One executes the SELECT query and populates the first row of the result into the specified variable.
- *
- * If the query does not specify a "from" clause, the method will try to infer the name of the table
- * to be selected from by calling getTableName() which will return either the variable type name
- * or the TableName() method if the variable implements the TableModel interface.
- *
- * Note that when the query has no rows in the result set, an sql.ErrNoRows will be returned.
- */
- one(a: {
- }): void
- }
- interface SelectQuery {
- /**
- * Model selects the row with the specified primary key and populates the model with the row data.
- *
- * The model variable should be a pointer to a struct. If the query does not specify a "from" clause,
- * it will use the model struct to determine which table to select data from. It will also use the model
- * to infer the name of the primary key column. Only simple primary key is supported. For composite primary keys,
- * please use Where() to specify the filtering condition.
- */
- model(pk: {
- }, model: {
- }): void
- }
- interface SelectQuery {
- /**
- * All executes the SELECT query and populates all rows of the result into a slice.
- *
- * Note that the slice must be passed in as a pointer.
- *
- * If the query does not specify a "from" clause, the method will try to infer the name of the table
- * to be selected from by calling getTableName() which will return either the type name of the slice elements
- * or the TableName() method if the slice element implements the TableModel interface.
- */
- all(slice: {
- }): void
- }
- interface SelectQuery {
- /**
- * Rows builds and executes the SELECT query and returns a Rows object for data retrieval purpose.
- * This is a shortcut to SelectQuery.Build().Rows()
- */
- rows(): (Rows)
- }
- interface SelectQuery {
- /**
- * Row builds and executes the SELECT query and populates the first row of the result into the specified variables.
- * This is a shortcut to SelectQuery.Build().Row()
- */
- row(...a: {
- }[]): void
- }
- interface SelectQuery {
- /**
- * Column builds and executes the SELECT statement and populates the first column of the result into a slice.
- * Note that the parameter must be a pointer to a slice.
- * This is a shortcut to SelectQuery.Build().Column()
- */
- column(a: {
- }): void
- }
- /**
- * QueryInfo represents a debug/info struct with exported SelectQuery fields.
- */
- interface QueryInfo {
- preFragment: string
- postFragment: string
- builder: Builder
- selects: Array
- distinct: boolean
- selectOption: string
- from: Array
- where: Expression
- join: Array
- orderBy: Array
- groupBy: Array
- having: Expression
- union: Array
- limit: number
- offset: number
- params: Params
- context: context.Context
- buildHook: BuildHookFunc
- }
- interface SelectQuery {
- /**
- * Info exports common SelectQuery fields allowing to inspect the
- * current select query options.
- */
- info(): (QueryInfo)
- }
- /**
- * FieldMapFunc converts a struct field name into a DB column name.
- */
- interface FieldMapFunc {(_arg0: string): string }
- /**
- * TableMapFunc converts a sample struct into a DB table name.
- */
- interface TableMapFunc {(a: {
- }): string }
- interface structInfo {
- }
- type _sPncttL = structInfo
- interface structValue extends _sPncttL {
- }
- interface fieldInfo {
- }
- interface structInfoMapKey {
- }
- /**
- * PostScanner is an optional interface used by ScanStruct.
- */
- interface PostScanner {
- [key:string]: any;
- /**
- * PostScan executes right after the struct has been populated
- * with the DB values, allowing you to further normalize or validate
- * the loaded data.
- */
- postScan(): void
- }
- interface defaultFieldMapFunc {
- /**
- * DefaultFieldMapFunc maps a field name to a DB column name.
- * The mapping rule set by this method is that words in a field name will be separated by underscores
- * and the name will be turned into lower case. For example, "FirstName" maps to "first_name", and "MyID" becomes "my_id".
- * See DB.FieldMapper for more details.
- */
- (f: string): string
- }
- interface getTableName {
- /**
- * GetTableName implements the default way of determining the table name corresponding to the given model struct
- * or slice of structs. To get the actual table name for a model, you should use DB.TableMapFunc() instead.
- * Do not call this method in a model's TableName() method because it will cause infinite loop.
- */
- (a: {
- }): string
- }
- /**
- * Tx enhances sql.Tx with additional querying methods.
- */
- type _sbhRiou = Builder
- interface Tx extends _sbhRiou {
- }
- interface Tx {
- /**
- * Commit commits the transaction.
- */
- commit(): void
- }
- interface Tx {
- /**
- * Rollback aborts the transaction.
- */
- rollback(): void
- }
-}
-
-namespace security {
- interface s256Challenge {
- /**
- * S256Challenge creates base64 encoded sha256 challenge string derived from code.
- * The padding of the result base64 string is stripped per [RFC 7636].
- *
- * [RFC 7636]: https://datatracker.ietf.org/doc/html/rfc7636#section-4.2
- */
- (code: string): string
- }
- interface md5 {
- /**
- * MD5 creates md5 hash from the provided plain text.
- */
- (text: string): string
- }
- interface sha256 {
- /**
- * SHA256 creates sha256 hash as defined in FIPS 180-4 from the provided text.
- */
- (text: string): string
- }
- interface sha512 {
- /**
- * SHA512 creates sha512 hash as defined in FIPS 180-4 from the provided text.
- */
- (text: string): string
- }
- interface hs256 {
- /**
- * HS256 creates a HMAC hash with sha256 digest algorithm.
- */
- (text: string, secret: string): string
- }
- interface hs512 {
- /**
- * HS512 creates a HMAC hash with sha512 digest algorithm.
- */
- (text: string, secret: string): string
- }
- interface equal {
- /**
- * Equal compares two hash strings for equality without leaking timing information.
- */
- (hash1: string, hash2: string): boolean
- }
- // @ts-ignore
- import crand = rand
- interface encrypt {
- /**
- * Encrypt encrypts "data" with the specified "key" (must be valid 32 char AES key).
- *
- * This method uses AES-256-GCM block cypher mode.
- */
- (data: string|Array, key: string): string
- }
- interface decrypt {
- /**
- * Decrypt decrypts encrypted text with key (must be valid 32 chars AES key).
- *
- * This method uses AES-256-GCM block cypher mode.
- */
- (cipherText: string, key: string): string|Array
- }
- interface parseUnverifiedJWT {
- /**
- * ParseUnverifiedJWT parses JWT and returns its claims
- * but DOES NOT verify the signature.
- *
- * It verifies only the exp, iat and nbf claims.
- */
- (token: string): jwt.MapClaims
- }
- interface parseJWT {
- /**
- * ParseJWT verifies and parses JWT and returns its claims.
- */
- (token: string, verificationKey: string): jwt.MapClaims
- }
- interface newJWT {
- /**
- * NewJWT generates and returns new HS256 signed JWT.
- */
- (payload: jwt.MapClaims, signingKey: string, duration: time.Duration): string
- }
- // @ts-ignore
- import cryptoRand = rand
- // @ts-ignore
- import mathRand = rand
- interface randomString {
- /**
- * RandomString generates a cryptographically random string with the specified length.
- *
- * The generated string matches [A-Za-z0-9]+ and it's transparent to URL-encoding.
- */
- (length: number): string
- }
- interface randomStringWithAlphabet {
- /**
- * RandomStringWithAlphabet generates a cryptographically random string
- * with the specified length and characters set.
- *
- * It panics if for some reason rand.Int returns a non-nil error.
- */
- (length: number, alphabet: string): string
- }
- interface pseudorandomString {
- /**
- * PseudorandomString generates a pseudorandom string with the specified length.
- *
- * The generated string matches [A-Za-z0-9]+ and it's transparent to URL-encoding.
- *
- * For a cryptographically random string (but a little bit slower) use RandomString instead.
- */
- (length: number): string
- }
- interface pseudorandomStringWithAlphabet {
- /**
- * PseudorandomStringWithAlphabet generates a pseudorandom string
- * with the specified length and characters set.
- *
- * For a cryptographically random (but a little bit slower) use RandomStringWithAlphabet instead.
- */
- (length: number, alphabet: string): string
- }
- interface randomStringByRegex {
- /**
- * RandomStringByRegex generates a random string matching the regex pattern.
- * If optFlags is not set, fallbacks to [syntax.Perl].
- *
- * NB! While the source of the randomness comes from [crypto/rand] this method
- * is not recommended to be used on its own in critical secure contexts because
- * the generated length could vary too much on the used pattern and may not be
- * as secure as simply calling [security.RandomString].
- * If you still insist on using it for such purposes, consider at least
- * a large enough minimum length for the generated string, e.g. `[a-z0-9]{30}`.
- *
- * This function is inspired by github.com/pipe01/revregexp, github.com/lucasjones/reggen and other similar packages.
- */
- (pattern: string, ...optFlags: syntax.Flags[]): string
- }
-}
-
-namespace filesystem {
- /**
- * FileReader defines an interface for a file resource reader.
- */
- interface FileReader {
- [key:string]: any;
- open(): io.ReadSeekCloser
- }
- /**
- * File defines a single file [io.ReadSeekCloser] resource.
- *
- * The file could be from a local path, multipart/form-data header, etc.
- */
- interface File {
- reader: FileReader
- name: string
- originalName: string
- size: number
- }
- interface File {
- /**
- * AsMap implements [core.mapExtractor] and returns a value suitable
- * to be used in an API rule expression.
- */
- asMap(): _TygojaDict
- }
- interface newFileFromPath {
- /**
- * NewFileFromPath creates a new File instance from the provided local file path.
- */
- (path: string): (File)
- }
- interface newFileFromBytes {
- /**
- * NewFileFromBytes creates a new File instance from the provided byte slice.
- */
- (b: string|Array, name: string): (File)
- }
- interface newFileFromMultipart {
- /**
- * NewFileFromMultipart creates a new File from the provided multipart header.
- */
- (mh: multipart.FileHeader): (File)
- }
- interface newFileFromURL {
- /**
- * NewFileFromURL creates a new File from the provided url by
- * downloading the resource and load it as BytesReader.
- *
- * Example
- *
- * ```
- * ctx, cancel := context.WithTimeout(context.Background(), 30*time.Second)
- * defer cancel()
- *
- * file, err := filesystem.NewFileFromURL(ctx, "https://example.com/image.png")
- * ```
- */
- (ctx: context.Context, url: string): (File)
- }
- /**
- * MultipartReader defines a FileReader from [multipart.FileHeader].
- */
- interface MultipartReader {
- header?: multipart.FileHeader
- }
- interface MultipartReader {
- /**
- * Open implements the [filesystem.FileReader] interface.
- */
- open(): io.ReadSeekCloser
- }
- /**
- * PathReader defines a FileReader from a local file path.
- */
- interface PathReader {
- path: string
- }
- interface PathReader {
- /**
- * Open implements the [filesystem.FileReader] interface.
- */
- open(): io.ReadSeekCloser
- }
- /**
- * BytesReader defines a FileReader from bytes content.
- */
- interface BytesReader {
- bytes: string|Array
- }
- interface BytesReader {
- /**
- * Open implements the [filesystem.FileReader] interface.
- */
- open(): io.ReadSeekCloser
- }
- type _sgrUUXz = bytes.Reader
- interface bytesReadSeekCloser extends _sgrUUXz {
- }
- interface bytesReadSeekCloser {
- /**
- * Close implements the [io.ReadSeekCloser] interface.
- */
- close(): void
- }
- /**
- * openFuncAsReader defines a FileReader from a bare Open function.
- */
- interface openFuncAsReader {(): io.ReadSeekCloser }
- interface openFuncAsReader {
- /**
- * Open implements the [filesystem.FileReader] interface.
- */
- open(): io.ReadSeekCloser
- }
- interface System {
- }
- interface newS3 {
- /**
- * NewS3 initializes an S3 filesystem instance.
- *
- * NB! Make sure to call `Close()` after you are done working with it.
- */
- (bucketName: string, region: string, endpoint: string, accessKey: string, secretKey: string, s3ForcePathStyle: boolean): (System)
- }
- interface newLocal {
- /**
- * NewLocal initializes a new local filesystem instance.
- *
- * NB! Make sure to call `Close()` after you are done working with it.
- */
- (dirPath: string): (System)
- }
- interface System {
- /**
- * SetContext assigns the specified context to the current filesystem.
- */
- setContext(ctx: context.Context): void
- }
- interface System {
- /**
- * Close releases any resources used for the related filesystem.
- */
- close(): void
- }
- interface System {
- /**
- * Exists checks if file with fileKey path exists or not.
- */
- exists(fileKey: string): boolean
- }
- interface System {
- /**
- * Attributes returns the attributes for the file with fileKey path.
- *
- * If the file doesn't exist it returns ErrNotFound.
- */
- attributes(fileKey: string): (blob.Attributes)
- }
- interface System {
- /**
- * GetReader returns a file content reader for the given fileKey.
- *
- * NB! Make sure to call Close() on the file after you are done working with it.
- *
- * If the file doesn't exist returns ErrNotFound.
- */
- getReader(fileKey: string): (blob.Reader)
- }
- interface System {
- /**
- * Deprecated: Please use GetReader(fileKey) instead.
- */
- getFile(fileKey: string): (blob.Reader)
- }
- interface System {
- /**
- * GetReuploadableFile constructs a new reuploadable File value
- * from the associated fileKey blob.Reader.
- *
- * If preserveName is false then the returned File.Name will have
- * a new randomly generated suffix, otherwise it will reuse the original one.
- *
- * This method could be useful in case you want to clone an existing
- * Record file and assign it to a new Record (e.g. in a Record duplicate action).
- *
- * If you simply want to copy an existing file to a new location you
- * could check the Copy(srcKey, dstKey) method.
- */
- getReuploadableFile(fileKey: string, preserveName: boolean): (File)
- }
- interface System {
- /**
- * Copy copies the file stored at srcKey to dstKey.
- *
- * If srcKey file doesn't exist, it returns ErrNotFound.
- *
- * If dstKey file already exists, it is overwritten.
- */
- copy(srcKey: string, dstKey: string): void
- }
- interface System {
- /**
- * List returns a flat list with info for all files under the specified prefix.
- */
- list(prefix: string): Array<(blob.ListObject | undefined)>
- }
- interface System {
- /**
- * Upload writes content into the fileKey location.
- */
- upload(content: string|Array, fileKey: string): void
- }
- interface System {
- /**
- * UploadFile uploads the provided File to the fileKey location.
- */
- uploadFile(file: File, fileKey: string): void
- }
- interface System {
- /**
- * UploadMultipart uploads the provided multipart file to the fileKey location.
- */
- uploadMultipart(fh: multipart.FileHeader, fileKey: string): void
- }
- interface System {
- /**
- * Delete deletes stored file at fileKey location.
- *
- * If the file doesn't exist returns ErrNotFound.
- */
- delete(fileKey: string): void
- }
- interface System {
- /**
- * DeletePrefix deletes everything starting with the specified prefix.
- *
- * The prefix could be subpath (ex. "/a/b/") or filename prefix (ex. "/a/b/file_").
- */
- deletePrefix(prefix: string): Array
- }
- interface System {
- /**
- * Checks if the provided dir prefix doesn't have any files.
- *
- * A trailing slash will be appended to a non-empty dir string argument
- * to ensure that the checked prefix is a "directory".
- *
- * Returns "false" in case the has at least one file, otherwise - "true".
- */
- isEmptyDir(dir: string): boolean
- }
- interface System {
- /**
- * Serve serves the file at fileKey location to an HTTP response.
- *
- * If the `download` query parameter is used the file will be always served for
- * download no matter of its type (aka. with "Content-Disposition: attachment").
- *
- * Internally this method uses [http.ServeContent] so Range requests,
- * If-Match, If-Unmodified-Since, etc. headers are handled transparently.
- */
- serve(res: http.ResponseWriter, req: http.Request, fileKey: string, name: string): void
- }
- interface System {
- /**
- * CreateThumb creates a new thumb image for the file at originalKey location.
- * The new thumb file is stored at thumbKey location.
- *
- * thumbSize is in the format:
- * - 0xH (eg. 0x100) - resize to H height preserving the aspect ratio
- * - Wx0 (eg. 300x0) - resize to W width preserving the aspect ratio
- * - WxH (eg. 300x100) - resize and crop to WxH viewbox (from center)
- * - WxHt (eg. 300x100t) - resize and crop to WxH viewbox (from top)
- * - WxHb (eg. 300x100b) - resize and crop to WxH viewbox (from bottom)
- * - WxHf (eg. 300x100f) - fit inside a WxH viewbox (without cropping)
- */
- createThumb(originalKey: string, thumbKey: string, thumbSize: string): void
- }
-}
-
-/**
- * Package exec runs external commands. It wraps os.StartProcess to make it
- * easier to remap stdin and stdout, connect I/O with pipes, and do other
- * adjustments.
- *
- * Unlike the "system" library call from C and other languages, the
- * os/exec package intentionally does not invoke the system shell and
- * does not expand any glob patterns or handle other expansions,
- * pipelines, or redirections typically done by shells. The package
- * behaves more like C's "exec" family of functions. To expand glob
- * patterns, either call the shell directly, taking care to escape any
- * dangerous input, or use the [path/filepath] package's Glob function.
- * To expand environment variables, use package os's ExpandEnv.
- *
- * Note that the examples in this package assume a Unix system.
- * They may not run on Windows, and they do not run in the Go Playground
- * used by golang.org and godoc.org.
- *
- * # Executables in the current directory
- *
- * The functions [Command] and [LookPath] look for a program
- * in the directories listed in the current path, following the
- * conventions of the host operating system.
- * Operating systems have for decades included the current
- * directory in this search, sometimes implicitly and sometimes
- * configured explicitly that way by default.
- * Modern practice is that including the current directory
- * is usually unexpected and often leads to security problems.
- *
- * To avoid those security problems, as of Go 1.19, this package will not resolve a program
- * using an implicit or explicit path entry relative to the current directory.
- * That is, if you run [LookPath]("go"), it will not successfully return
- * ./go on Unix nor .\go.exe on Windows, no matter how the path is configured.
- * Instead, if the usual path algorithms would result in that answer,
- * these functions return an error err satisfying [errors.Is](err, [ErrDot]).
- *
- * For example, consider these two program snippets:
- *
- * ```
- * path, err := exec.LookPath("prog")
- * if err != nil {
- * log.Fatal(err)
- * }
- * use(path)
- * ```
- *
- * and
- *
- * ```
- * cmd := exec.Command("prog")
- * if err := cmd.Run(); err != nil {
- * log.Fatal(err)
- * }
- * ```
- *
- * These will not find and run ./prog or .\prog.exe,
- * no matter how the current path is configured.
- *
- * Code that always wants to run a program from the current directory
- * can be rewritten to say "./prog" instead of "prog".
- *
- * Code that insists on including results from relative path entries
- * can instead override the error using an errors.Is check:
- *
- * ```
- * path, err := exec.LookPath("prog")
- * if errors.Is(err, exec.ErrDot) {
- * err = nil
- * }
- * if err != nil {
- * log.Fatal(err)
- * }
- * use(path)
- * ```
- *
- * and
- *
- * ```
- * cmd := exec.Command("prog")
- * if errors.Is(cmd.Err, exec.ErrDot) {
- * cmd.Err = nil
- * }
- * if err := cmd.Run(); err != nil {
- * log.Fatal(err)
- * }
- * ```
- *
- * Setting the environment variable GODEBUG=execerrdot=0
- * disables generation of ErrDot entirely, temporarily restoring the pre-Go 1.19
- * behavior for programs that are unable to apply more targeted fixes.
- * A future version of Go may remove support for this variable.
- *
- * Before adding such overrides, make sure you understand the
- * security implications of doing so.
- * See https://go.dev/blog/path-security for more information.
- */
-namespace exec {
- interface command {
- /**
- * Command returns the [Cmd] struct to execute the named program with
- * the given arguments.
- *
- * It sets only the Path and Args in the returned structure.
- *
- * If name contains no path separators, Command uses [LookPath] to
- * resolve name to a complete path if possible. Otherwise it uses name
- * directly as Path.
- *
- * The returned Cmd's Args field is constructed from the command name
- * followed by the elements of arg, so arg should not include the
- * command name itself. For example, Command("echo", "hello").
- * Args[0] is always name, not the possibly resolved Path.
- *
- * On Windows, processes receive the whole command line as a single string
- * and do their own parsing. Command combines and quotes Args into a command
- * line string with an algorithm compatible with applications using
- * CommandLineToArgvW (which is the most common way). Notable exceptions are
- * msiexec.exe and cmd.exe (and thus, all batch files), which have a different
- * unquoting algorithm. In these or other similar cases, you can do the
- * quoting yourself and provide the full command line in SysProcAttr.CmdLine,
- * leaving Args empty.
- */
- (name: string, ...arg: string[]): (Cmd)
- }
-}
-
-/**
- * Package core is the backbone of PocketBase.
- *
- * It defines the main PocketBase App interface and its base implementation.
- */
-namespace core {
- /**
- * App defines the main PocketBase app interface.
- *
- * Note that the interface is not intended to be implemented manually by users
- * and instead they should use core.BaseApp (either directly or as embedded field in a custom struct).
- *
- * This interface exists to make testing easier and to allow users to
- * create common and pluggable helpers and methods that doesn't rely
- * on a specific wrapped app struct (hence the large interface size).
- */
- interface App {
- [key:string]: any;
- /**
- * UnsafeWithoutHooks returns a shallow copy of the current app WITHOUT any registered hooks.
- *
- * NB! Note that using the returned app instance may cause data integrity errors
- * since the Record validations and data normalizations (including files uploads)
- * rely on the app hooks to work.
- */
- unsafeWithoutHooks(): App
- /**
- * Logger returns the default app logger.
- *
- * If the application is not bootstrapped yet, fallbacks to slog.Default().
- */
- logger(): (slog.Logger)
- /**
- * IsBootstrapped checks if the application was initialized
- * (aka. whether Bootstrap() was called).
- */
- isBootstrapped(): boolean
- /**
- * IsTransactional checks if the current app instance is part of a transaction.
- */
- isTransactional(): boolean
- /**
- * TxInfo returns the transaction associated with the current app instance (if any).
- *
- * Could be used if you want to execute indirectly a function after
- * the related app transaction completes using `app.TxInfo().OnAfterFunc(callback)`.
- */
- txInfo(): (TxAppInfo)
- /**
- * Bootstrap initializes the application
- * (aka. create data dir, open db connections, load settings, etc.).
- *
- * It will call ResetBootstrapState() if the application was already bootstrapped.
- */
- bootstrap(): void
- /**
- * ResetBootstrapState releases the initialized core app resources
- * (closing db connections, stopping cron ticker, etc.).
- */
- resetBootstrapState(): void
- /**
- * DataDir returns the app data directory path.
- */
- dataDir(): string
- /**
- * EncryptionEnv returns the name of the app secret env key
- * (currently used primarily for optional settings encryption but this may change in the future).
- */
- encryptionEnv(): string
- /**
- * IsDev returns whether the app is in dev mode.
- *
- * When enabled logs, executed sql statements, etc. are printed to the stderr.
- */
- isDev(): boolean
- /**
- * Settings returns the loaded app settings.
- */
- settings(): (Settings)
- /**
- * Store returns the app runtime store.
- */
- store(): (store.Store)
- /**
- * Cron returns the app cron instance.
- */
- cron(): (cron.Cron)
- /**
- * SubscriptionsBroker returns the app realtime subscriptions broker instance.
- */
- subscriptionsBroker(): (subscriptions.Broker)
- /**
- * NewMailClient creates and returns a new SMTP or Sendmail client
- * based on the current app settings.
- */
- newMailClient(): mailer.Mailer
- /**
- * NewFilesystem creates a new local or S3 filesystem instance
- * for managing regular app files (ex. record uploads)
- * based on the current app settings.
- *
- * NB! Make sure to call Close() on the returned result
- * after you are done working with it.
- */
- newFilesystem(): (filesystem.System)
- /**
- * NewBackupsFilesystem creates a new local or S3 filesystem instance
- * for managing app backups based on the current app settings.
- *
- * NB! Make sure to call Close() on the returned result
- * after you are done working with it.
- */
- newBackupsFilesystem(): (filesystem.System)
- /**
- * ReloadSettings reinitializes and reloads the stored application settings.
- */
- reloadSettings(): void
- /**
- * CreateBackup creates a new backup of the current app pb_data directory.
- *
- * Backups can be stored on S3 if it is configured in app.Settings().Backups.
- *
- * Please refer to the godoc of the specific CoreApp implementation
- * for details on the backup procedures.
- */
- createBackup(ctx: context.Context, name: string): void
- /**
- * RestoreBackup restores the backup with the specified name and restarts
- * the current running application process.
- *
- * The safely perform the restore it is recommended to have free disk space
- * for at least 2x the size of the restored pb_data backup.
- *
- * Please refer to the godoc of the specific CoreApp implementation
- * for details on the restore procedures.
- *
- * NB! This feature is experimental and currently is expected to work only on UNIX based systems.
- */
- restoreBackup(ctx: context.Context, name: string): void
- /**
- * Restart restarts (aka. replaces) the current running application process.
- *
- * NB! It relies on execve which is supported only on UNIX based systems.
- */
- restart(): void
- /**
- * RunSystemMigrations applies all new migrations registered in the [core.SystemMigrations] list.
- */
- runSystemMigrations(): void
- /**
- * RunAppMigrations applies all new migrations registered in the [CoreAppMigrations] list.
- */
- runAppMigrations(): void
- /**
- * RunAllMigrations applies all system and app migrations
- * (aka. from both [core.SystemMigrations] and [CoreAppMigrations]).
- */
- runAllMigrations(): void
- /**
- * DB returns the default app data.db builder instance.
- *
- * To minimize SQLITE_BUSY errors, it automatically routes the
- * SELECT queries to the underlying concurrent db pool and everything else
- * to the nonconcurrent one.
- *
- * For more finer control over the used connections pools you can
- * call directly ConcurrentDB() or NonconcurrentDB().
- */
- db(): dbx.Builder
- /**
- * ConcurrentDB returns the concurrent app data.db builder instance.
- *
- * This method is used mainly internally for executing db read
- * operations in a concurrent/non-blocking manner.
- *
- * Most users should use simply DB() as it will automatically
- * route the query execution to ConcurrentDB() or NonconcurrentDB().
- *
- * In a transaction the ConcurrentDB() and NonconcurrentDB() refer to the same *dbx.TX instance.
- */
- concurrentDB(): dbx.Builder
- /**
- * NonconcurrentDB returns the nonconcurrent app data.db builder instance.
- *
- * The returned db instance is limited only to a single open connection,
- * meaning that it can process only 1 db operation at a time (other queries queue up).
- *
- * This method is used mainly internally and in the tests to execute write
- * (save/delete) db operations as it helps with minimizing the SQLITE_BUSY errors.
- *
- * Most users should use simply DB() as it will automatically
- * route the query execution to ConcurrentDB() or NonconcurrentDB().
- *
- * In a transaction the ConcurrentDB() and NonconcurrentDB() refer to the same *dbx.TX instance.
- */
- nonconcurrentDB(): dbx.Builder
- /**
- * AuxDB returns the app auxiliary.db builder instance.
- *
- * To minimize SQLITE_BUSY errors, it automatically routes the
- * SELECT queries to the underlying concurrent db pool and everything else
- * to the nonconcurrent one.
- *
- * For more finer control over the used connections pools you can
- * call directly AuxConcurrentDB() or AuxNonconcurrentDB().
- */
- auxDB(): dbx.Builder
- /**
- * AuxConcurrentDB returns the concurrent app auxiliary.db builder instance.
- *
- * This method is used mainly internally for executing db read
- * operations in a concurrent/non-blocking manner.
- *
- * Most users should use simply AuxDB() as it will automatically
- * route the query execution to AuxConcurrentDB() or AuxNonconcurrentDB().
- *
- * In a transaction the AuxConcurrentDB() and AuxNonconcurrentDB() refer to the same *dbx.TX instance.
- */
- auxConcurrentDB(): dbx.Builder
- /**
- * AuxNonconcurrentDB returns the nonconcurrent app auxiliary.db builder instance.
- *
- * The returned db instance is limited only to a single open connection,
- * meaning that it can process only 1 db operation at a time (other queries queue up).
- *
- * This method is used mainly internally and in the tests to execute write
- * (save/delete) db operations as it helps with minimizing the SQLITE_BUSY errors.
- *
- * Most users should use simply AuxDB() as it will automatically
- * route the query execution to AuxConcurrentDB() or AuxNonconcurrentDB().
- *
- * In a transaction the AuxConcurrentDB() and AuxNonconcurrentDB() refer to the same *dbx.TX instance.
- */
- auxNonconcurrentDB(): dbx.Builder
- /**
- * HasTable checks if a table (or view) with the provided name exists (case insensitive).
- * in the data.db.
- */
- hasTable(tableName: string): boolean
- /**
- * AuxHasTable checks if a table (or view) with the provided name exists (case insensitive)
- * in the auxiliary.db.
- */
- auxHasTable(tableName: string): boolean
- /**
- * TableColumns returns all column names of a single table by its name.
- */
- tableColumns(tableName: string): Array
- /**
- * TableInfo returns the "table_info" pragma result for the specified table.
- */
- tableInfo(tableName: string): Array<(TableInfoRow | undefined)>
- /**
- * TableIndexes returns a name grouped map with all non empty index of the specified table.
- *
- * Note: This method doesn't return an error on nonexisting table.
- */
- tableIndexes(tableName: string): _TygojaDict
- /**
- * DeleteTable drops the specified table.
- *
- * This method is a no-op if a table with the provided name doesn't exist.
- *
- * NB! Be aware that this method is vulnerable to SQL injection and the
- * "tableName" argument must come only from trusted input!
- */
- deleteTable(tableName: string): void
- /**
- * DeleteView drops the specified view name.
- *
- * This method is a no-op if a view with the provided name doesn't exist.
- *
- * NB! Be aware that this method is vulnerable to SQL injection and the
- * "name" argument must come only from trusted input!
- */
- deleteView(name: string): void
- /**
- * SaveView creates (or updates already existing) persistent SQL view.
- *
- * NB! Be aware that this method is vulnerable to SQL injection and the
- * "selectQuery" argument must come only from trusted input!
- */
- saveView(name: string, selectQuery: string): void
- /**
- * CreateViewFields creates a new FieldsList from the provided select query.
- *
- * There are some caveats:
- * - The select query must have an "id" column.
- * - Wildcard ("*") columns are not supported to avoid accidentally leaking sensitive data.
- */
- createViewFields(selectQuery: string): FieldsList
- /**
- * FindRecordByViewFile returns the original Record of the provided view collection file.
- */
- findRecordByViewFile(viewCollectionModelOrIdentifier: any, fileFieldName: string, filename: string): (Record)
- /**
- * Vacuum executes VACUUM on the data.db in order to reclaim unused data db disk space.
- */
- vacuum(): void
- /**
- * AuxVacuum executes VACUUM on the auxiliary.db in order to reclaim unused auxiliary db disk space.
- */
- auxVacuum(): void
- /**
- * ModelQuery creates a new preconfigured select data.db query with preset
- * SELECT, FROM and other common fields based on the provided model.
- */
- modelQuery(model: Model): (dbx.SelectQuery)
- /**
- * AuxModelQuery creates a new preconfigured select auxiliary.db query with preset
- * SELECT, FROM and other common fields based on the provided model.
- */
- auxModelQuery(model: Model): (dbx.SelectQuery)
- /**
- * Delete deletes the specified model from the regular app database.
- */
- delete(model: Model): void
- /**
- * Delete deletes the specified model from the regular app database
- * (the context could be used to limit the query execution).
- */
- deleteWithContext(ctx: context.Context, model: Model): void
- /**
- * AuxDelete deletes the specified model from the auxiliary database.
- */
- auxDelete(model: Model): void
- /**
- * AuxDeleteWithContext deletes the specified model from the auxiliary database
- * (the context could be used to limit the query execution).
- */
- auxDeleteWithContext(ctx: context.Context, model: Model): void
- /**
- * Save validates and saves the specified model into the regular app database.
- *
- * If you don't want to run validations, use [App.SaveNoValidate()].
- */
- save(model: Model): void
- /**
- * SaveWithContext is the same as [App.Save()] but allows specifying a context to limit the db execution.
- *
- * If you don't want to run validations, use [App.SaveNoValidateWithContext()].
- */
- saveWithContext(ctx: context.Context, model: Model): void
- /**
- * SaveNoValidate saves the specified model into the regular app database without performing validations.
- *
- * If you want to also run validations before persisting, use [App.Save()].
- */
- saveNoValidate(model: Model): void
- /**
- * SaveNoValidateWithContext is the same as [App.SaveNoValidate()]
- * but allows specifying a context to limit the db execution.
- *
- * If you want to also run validations before persisting, use [App.SaveWithContext()].
- */
- saveNoValidateWithContext(ctx: context.Context, model: Model): void
- /**
- * AuxSave validates and saves the specified model into the auxiliary app database.
- *
- * If you don't want to run validations, use [App.AuxSaveNoValidate()].
- */
- auxSave(model: Model): void
- /**
- * AuxSaveWithContext is the same as [App.AuxSave()] but allows specifying a context to limit the db execution.
- *
- * If you don't want to run validations, use [App.AuxSaveNoValidateWithContext()].
- */
- auxSaveWithContext(ctx: context.Context, model: Model): void
- /**
- * AuxSaveNoValidate saves the specified model into the auxiliary app database without performing validations.
- *
- * If you want to also run validations before persisting, use [App.AuxSave()].
- */
- auxSaveNoValidate(model: Model): void
- /**
- * AuxSaveNoValidateWithContext is the same as [App.AuxSaveNoValidate()]
- * but allows specifying a context to limit the db execution.
- *
- * If you want to also run validations before persisting, use [App.AuxSaveWithContext()].
- */
- auxSaveNoValidateWithContext(ctx: context.Context, model: Model): void
- /**
- * Validate triggers the OnModelValidate hook for the specified model.
- */
- validate(model: Model): void
- /**
- * ValidateWithContext is the same as Validate but allows specifying the ModelEvent context.
- */
- validateWithContext(ctx: context.Context, model: Model): void
- /**
- * RunInTransaction wraps fn into a transaction for the regular app database.
- *
- * It is safe to nest RunInTransaction calls as long as you use the callback's txApp.
- */
- runInTransaction(fn: (txApp: App) => void): void
- /**
- * AuxRunInTransaction wraps fn into a transaction for the auxiliary app database.
- *
- * It is safe to nest RunInTransaction calls as long as you use the callback's txApp.
- */
- auxRunInTransaction(fn: (txApp: App) => void): void
- /**
- * LogQuery returns a new Log select query.
- */
- logQuery(): (dbx.SelectQuery)
- /**
- * FindLogById finds a single Log entry by its id.
- */
- findLogById(id: string): (Log)
- /**
- * LogsStatsItem returns hourly grouped logs statistics.
- */
- logsStats(expr: dbx.Expression): Array<(LogsStatsItem | undefined)>
- /**
- * DeleteOldLogs delete all logs that are created before createdBefore.
- */
- deleteOldLogs(createdBefore: time.Time): void
- /**
- * CollectionQuery returns a new Collection select query.
- */
- collectionQuery(): (dbx.SelectQuery)
- /**
- * FindCollections finds all collections by the given type(s).
- *
- * If collectionTypes is not set, it returns all collections.
- *
- * Example:
- *
- * ```
- * app.FindAllCollections() // all collections
- * app.FindAllCollections("auth", "view") // only auth and view collections
- * ```
- */
- findAllCollections(...collectionTypes: string[]): Array<(Collection | undefined)>
- /**
- * ReloadCachedCollections fetches all collections and caches them into the app store.
- */
- reloadCachedCollections(): void
- /**
- * FindCollectionByNameOrId finds a single collection by its name (case insensitive) or id.s
- */
- findCollectionByNameOrId(nameOrId: string): (Collection)
- /**
- * FindCachedCollectionByNameOrId is similar to [App.FindCollectionByNameOrId]
- * but retrieves the Collection from the app cache instead of making a db call.
- *
- * NB! This method is suitable for read-only Collection operations.
- *
- * Returns [sql.ErrNoRows] if no Collection is found for consistency
- * with the [App.FindCollectionByNameOrId] method.
- *
- * If you plan making changes to the returned Collection model,
- * use [App.FindCollectionByNameOrId] instead.
- *
- * Caveats:
- *
- * ```
- * - The returned Collection should be used only for read-only operations.
- * Avoid directly modifying the returned cached Collection as it will affect
- * the global cached value even if you don't persist the changes in the database!
- * - If you are updating a Collection in a transaction and then call this method before commit,
- * it'll return the cached Collection state and not the one from the uncommitted transaction.
- * - The cache is automatically updated on collections db change (create/update/delete).
- * To manually reload the cache you can call [App.ReloadCachedCollections]
- * ```
- */
- findCachedCollectionByNameOrId(nameOrId: string): (Collection)
- /**
- * FindCollectionReferences returns information for all relation
- * fields referencing the provided collection.
- *
- * If the provided collection has reference to itself then it will be
- * also included in the result. To exclude it, pass the collection id
- * as the excludeIds argument.
- */
- findCollectionReferences(collection: Collection, ...excludeIds: string[]): _TygojaDict
- /**
- * FindCachedCollectionReferences is similar to [App.FindCollectionReferences]
- * but retrieves the Collection from the app cache instead of making a db call.
- *
- * NB! This method is suitable for read-only Collection operations.
- *
- * If you plan making changes to the returned Collection model,
- * use [App.FindCollectionReferences] instead.
- *
- * Caveats:
- *
- * ```
- * - The returned Collection should be used only for read-only operations.
- * Avoid directly modifying the returned cached Collection as it will affect
- * the global cached value even if you don't persist the changes in the database!
- * - If you are updating a Collection in a transaction and then call this method before commit,
- * it'll return the cached Collection state and not the one from the uncommitted transaction.
- * - The cache is automatically updated on collections db change (create/update/delete).
- * To manually reload the cache you can call [App.ReloadCachedCollections].
- * ```
- */
- findCachedCollectionReferences(collection: Collection, ...excludeIds: string[]): _TygojaDict
- /**
- * IsCollectionNameUnique checks that there is no existing collection
- * with the provided name (case insensitive!).
- *
- * Note: case insensitive check because the name is used also as
- * table name for the records.
- */
- isCollectionNameUnique(name: string, ...excludeIds: string[]): boolean
- /**
- * TruncateCollection deletes all records associated with the provided collection.
- *
- * The truncate operation is executed in a single transaction,
- * aka. either everything is deleted or none.
- *
- * Note that this method will also trigger the records related
- * cascade and file delete actions.
- */
- truncateCollection(collection: Collection): void
- /**
- * ImportCollections imports the provided collections data in a single transaction.
- *
- * For existing matching collections, the imported data is unmarshaled on top of the existing model.
- *
- * NB! If deleteMissing is true, ALL NON-SYSTEM COLLECTIONS AND SCHEMA FIELDS,
- * that are not present in the imported configuration, WILL BE DELETED
- * (this includes their related records data).
- */
- importCollections(toImport: Array<_TygojaDict>, deleteMissing: boolean): void
- /**
- * ImportCollectionsByMarshaledJSON is the same as [ImportCollections]
- * but accept marshaled json array as import data (usually used for the autogenerated snapshots).
- */
- importCollectionsByMarshaledJSON(rawSliceOfMaps: string|Array, deleteMissing: boolean): void
- /**
- * SyncRecordTableSchema compares the two provided collections
- * and applies the necessary related record table changes.
- *
- * If oldCollection is null, then only newCollection is used to create the record table.
- *
- * This method is automatically invoked as part of a collection create/update/delete operation.
- */
- syncRecordTableSchema(newCollection: Collection, oldCollection: Collection): void
- /**
- * FindAllExternalAuthsByRecord returns all ExternalAuth models
- * linked to the provided auth record.
- */
- findAllExternalAuthsByRecord(authRecord: Record): Array<(ExternalAuth | undefined)>
- /**
- * FindAllExternalAuthsByCollection returns all ExternalAuth models
- * linked to the provided auth collection.
- */
- findAllExternalAuthsByCollection(collection: Collection): Array<(ExternalAuth | undefined)>
- /**
- * FindFirstExternalAuthByExpr returns the first available (the most recent created)
- * ExternalAuth model that satisfies the non-nil expression.
- */
- findFirstExternalAuthByExpr(expr: dbx.Expression): (ExternalAuth)
- /**
- * FindAllMFAsByRecord returns all MFA models linked to the provided auth record.
- */
- findAllMFAsByRecord(authRecord: Record): Array<(MFA | undefined)>
- /**
- * FindAllMFAsByCollection returns all MFA models linked to the provided collection.
- */
- findAllMFAsByCollection(collection: Collection): Array<(MFA | undefined)>
- /**
- * FindMFAById returns a single MFA model by its id.
- */
- findMFAById(id: string): (MFA)
- /**
- * DeleteAllMFAsByRecord deletes all MFA models associated with the provided record.
- *
- * Returns a combined error with the failed deletes.
- */
- deleteAllMFAsByRecord(authRecord: Record): void
- /**
- * DeleteExpiredMFAs deletes the expired MFAs for all auth collections.
- */
- deleteExpiredMFAs(): void
- /**
- * FindAllOTPsByRecord returns all OTP models linked to the provided auth record.
- */
- findAllOTPsByRecord(authRecord: Record): Array<(OTP | undefined)>
- /**
- * FindAllOTPsByCollection returns all OTP models linked to the provided collection.
- */
- findAllOTPsByCollection(collection: Collection): Array<(OTP | undefined)>
- /**
- * FindOTPById returns a single OTP model by its id.
- */
- findOTPById(id: string): (OTP)
- /**
- * DeleteAllOTPsByRecord deletes all OTP models associated with the provided record.
- *
- * Returns a combined error with the failed deletes.
- */
- deleteAllOTPsByRecord(authRecord: Record): void
- /**
- * DeleteExpiredOTPs deletes the expired OTPs for all auth collections.
- */
- deleteExpiredOTPs(): void
- /**
- * FindAllAuthOriginsByRecord returns all AuthOrigin models linked to the provided auth record (in DESC order).
- */
- findAllAuthOriginsByRecord(authRecord: Record): Array<(AuthOrigin | undefined)>
- /**
- * FindAllAuthOriginsByCollection returns all AuthOrigin models linked to the provided collection (in DESC order).
- */
- findAllAuthOriginsByCollection(collection: Collection): Array<(AuthOrigin | undefined)>
- /**
- * FindAuthOriginById returns a single AuthOrigin model by its id.
- */
- findAuthOriginById(id: string): (AuthOrigin)
- /**
- * FindAuthOriginByRecordAndFingerprint returns a single AuthOrigin model
- * by its authRecord relation and fingerprint.
- */
- findAuthOriginByRecordAndFingerprint(authRecord: Record, fingerprint: string): (AuthOrigin)
- /**
- * DeleteAllAuthOriginsByRecord deletes all AuthOrigin models associated with the provided record.
- *
- * Returns a combined error with the failed deletes.
- */
- deleteAllAuthOriginsByRecord(authRecord: Record): void
- /**
- * RecordQuery returns a new Record select query from a collection model, id or name.
- *
- * In case a collection id or name is provided and that collection doesn't
- * actually exists, the generated query will be created with a cancelled context
- * and will fail once an executor (Row(), One(), All(), etc.) is called.
- */
- recordQuery(collectionModelOrIdentifier: any): (dbx.SelectQuery)
- /**
- * FindRecordById finds the Record model by its id.
- */
- findRecordById(collectionModelOrIdentifier: any, recordId: string, ...optFilters: ((q: dbx.SelectQuery) => void)[]): (Record)
- /**
- * FindRecordsByIds finds all records by the specified ids.
- * If no records are found, returns an empty slice.
- */
- findRecordsByIds(collectionModelOrIdentifier: any, recordIds: Array, ...optFilters: ((q: dbx.SelectQuery) => void)[]): Array<(Record | undefined)>
- /**
- * FindAllRecords finds all records matching specified db expressions.
- *
- * Returns all collection records if no expression is provided.
- *
- * Returns an empty slice if no records are found.
- *
- * Example:
- *
- * ```
- * // no extra expressions
- * app.FindAllRecords("example")
- *
- * // with extra expressions
- * expr1 := dbx.HashExp{"email": "test@example.com"}
- * expr2 := dbx.NewExp("LOWER(username) = {:username}", dbx.Params{"username": "test"})
- * app.FindAllRecords("example", expr1, expr2)
- * ```
- */
- findAllRecords(collectionModelOrIdentifier: any, ...exprs: dbx.Expression[]): Array<(Record | undefined)>
- /**
- * FindFirstRecordByData returns the first found record matching
- * the provided key-value pair.
- */
- findFirstRecordByData(collectionModelOrIdentifier: any, key: string, value: any): (Record)
- /**
- * FindRecordsByFilter returns limit number of records matching the
- * provided string filter.
- *
- * NB! Use the last "params" argument to bind untrusted user variables!
- *
- * The filter argument is optional and can be empty string to target
- * all available records.
- *
- * The sort argument is optional and can be empty string OR the same format
- * used in the web APIs, ex. "-created,title".
- *
- * If the limit argument is <= 0, no limit is applied to the query and
- * all matching records are returned.
- *
- * Returns an empty slice if no records are found.
- *
- * Example:
- *
- * ```
- * app.FindRecordsByFilter(
- * "posts",
- * "title ~ {:title} && visible = {:visible}",
- * "-created",
- * 10,
- * 0,
- * dbx.Params{"title": "lorem ipsum", "visible": true}
- * )
- * ```
- */
- findRecordsByFilter(collectionModelOrIdentifier: any, filter: string, sort: string, limit: number, offset: number, ...params: dbx.Params[]): Array<(Record | undefined)>
- /**
- * FindFirstRecordByFilter returns the first available record matching the provided filter (if any).
- *
- * NB! Use the last params argument to bind untrusted user variables!
- *
- * Returns sql.ErrNoRows if no record is found.
- *
- * Example:
- *
- * ```
- * app.FindFirstRecordByFilter("posts", "")
- * app.FindFirstRecordByFilter("posts", "slug={:slug} && status='public'", dbx.Params{"slug": "test"})
- * ```
- */
- findFirstRecordByFilter(collectionModelOrIdentifier: any, filter: string, ...params: dbx.Params[]): (Record)
- /**
- * CountRecords returns the total number of records in a collection.
- */
- countRecords(collectionModelOrIdentifier: any, ...exprs: dbx.Expression[]): number
- /**
- * FindAuthRecordByToken finds the auth record associated with the provided JWT
- * (auth, file, verifyEmail, changeEmail, passwordReset types).
- *
- * Optionally specify a list of validTypes to check tokens only from those types.
- *
- * Returns an error if the JWT is invalid, expired or not associated to an auth collection record.
- */
- findAuthRecordByToken(token: string, ...validTypes: string[]): (Record)
- /**
- * FindAuthRecordByEmail finds the auth record associated with the provided email.
- *
- * Returns an error if it is not an auth collection or the record is not found.
- */
- findAuthRecordByEmail(collectionModelOrIdentifier: any, email: string): (Record)
- /**
- * CanAccessRecord checks if a record is allowed to be accessed by the
- * specified requestInfo and accessRule.
- *
- * Rule and db checks are ignored in case requestInfo.Auth is a superuser.
- *
- * The returned error indicate that something unexpected happened during
- * the check (eg. invalid rule or db query error).
- *
- * The method always return false on invalid rule or db query error.
- *
- * Example:
- *
- * ```
- * requestInfo, _ := e.RequestInfo()
- * record, _ := app.FindRecordById("example", "RECORD_ID")
- * rule := types.Pointer("@request.auth.id != '' || status = 'public'")
- * // ... or use one of the record collection's rule, eg. record.Collection().ViewRule
- *
- * if ok, _ := app.CanAccessRecord(record, requestInfo, rule); ok { ... }
- * ```
- */
- canAccessRecord(record: Record, requestInfo: RequestInfo, accessRule: string): boolean
- /**
- * ExpandRecord expands the relations of a single Record model.
- *
- * If optFetchFunc is not set, then a default function will be used
- * that returns all relation records.
- *
- * Returns a map with the failed expand parameters and their errors.
- */
- expandRecord(record: Record, expands: Array, optFetchFunc: ExpandFetchFunc): _TygojaDict
- /**
- * ExpandRecords expands the relations of the provided Record models list.
- *
- * If optFetchFunc is not set, then a default function will be used
- * that returns all relation records.
- *
- * Returns a map with the failed expand parameters and their errors.
- */
- expandRecords(records: Array<(Record | undefined)>, expands: Array, optFetchFunc: ExpandFetchFunc): _TygojaDict
- /**
- * OnBootstrap hook is triggered when initializing the main application
- * resources (db, app settings, etc).
- */
- onBootstrap(): (hook.Hook)
- /**
- * OnServe hook is triggered when the app web server is started
- * (after starting the TCP listener but before initializing the blocking serve task),
- * allowing you to adjust its options and attach new routes or middlewares.
- */
- onServe(): (hook.Hook)
- /**
- * OnTerminate hook is triggered when the app is in the process
- * of being terminated (ex. on SIGTERM signal).
- *
- * Note that the app could be terminated abruptly without awaiting the hook completion.
- */
- onTerminate(): (hook.Hook)
- /**
- * OnBackupCreate hook is triggered on each [App.CreateBackup] call.
- */
- onBackupCreate(): (hook.Hook)
- /**
- * OnBackupRestore hook is triggered before app backup restore (aka. [App.RestoreBackup] call).
- *
- * Note that by default on success the application is restarted and the after state of the hook is ignored.
- */
- onBackupRestore(): (hook.Hook)
- /**
- * OnModelValidate is triggered every time when a model is being validated
- * (e.g. triggered by App.Validate() or App.Save()).
- *
- * For convenience, if you want to listen to only the Record models
- * events without doing manual type assertion, you can attach to the OnRecord* proxy hooks.
- *
- * If the optional "tags" list (Collection id/name, Model table name, etc.) is specified,
- * then all event handlers registered via the created hook will be
- * triggered and called only if their event data origin matches the tags.
- */
- onModelValidate(...tags: string[]): (hook.TaggedHook)
- /**
- * OnModelCreate is triggered every time when a new model is being created
- * (e.g. triggered by App.Save()).
- *
- * Operations BEFORE the e.Next() execute before the model validation
- * and the INSERT DB statement.
- *
- * Operations AFTER the e.Next() execute after the model validation
- * and the INSERT DB statement.
- *
- * Note that successful execution doesn't guarantee that the model
- * is persisted in the database since its wrapping transaction may
- * not have been committed yet.
- * If you want to listen to only the actual persisted events, you can
- * bind to [OnModelAfterCreateSuccess] or [OnModelAfterCreateError] hooks.
- *
- * For convenience, if you want to listen to only the Record models
- * events without doing manual type assertion, you can attach to the OnRecord* proxy hooks.
- *
- * If the optional "tags" list (Collection id/name, Model table name, etc.) is specified,
- * then all event handlers registered via the created hook will be
- * triggered and called only if their event data origin matches the tags.
- */
- onModelCreate(...tags: string[]): (hook.TaggedHook)
- /**
- * OnModelCreateExecute is triggered after successful Model validation
- * and right before the model INSERT DB statement execution.
- *
- * Usually it is triggered as part of the App.Save() in the following firing order:
- * OnModelCreate {
- * ```
- * -> OnModelValidate (skipped with App.SaveNoValidate())
- * -> OnModelCreateExecute
- * ```
- * }
- *
- * Note that successful execution doesn't guarantee that the model
- * is persisted in the database since its wrapping transaction may have been
- * committed yet.
- * If you want to listen to only the actual persisted events,
- * you can bind to [OnModelAfterCreateSuccess] or [OnModelAfterCreateError] hooks.
- *
- * For convenience, if you want to listen to only the Record models
- * events without doing manual type assertion, you can attach to the OnRecord* proxy hooks.
- *
- * If the optional "tags" list (Collection id/name, Model table name, etc.) is specified,
- * then all event handlers registered via the created hook will be
- * triggered and called only if their event data origin matches the tags.
- */
- onModelCreateExecute(...tags: string[]): (hook.TaggedHook)
- /**
- * OnModelAfterCreateSuccess is triggered after each successful
- * Model DB create persistence.
- *
- * Note that when a Model is persisted as part of a transaction,
- * this hook is delayed and executed only AFTER the transaction has been committed.
- * This hook is NOT triggered in case the transaction rollbacks
- * (aka. when the model wasn't persisted).
- *
- * For convenience, if you want to listen to only the Record models
- * events without doing manual type assertion, you can attach to the OnRecord* proxy hooks.
- *
- * If the optional "tags" list (Collection id/name, Model table name, etc.) is specified,
- * then all event handlers registered via the created hook will be
- * triggered and called only if their event data origin matches the tags.
- */
- onModelAfterCreateSuccess(...tags: string[]): (hook.TaggedHook)
- /**
- * OnModelAfterCreateError is triggered after each failed
- * Model DB create persistence.
- *
- * Note that the execution of this hook is either immediate or delayed
- * depending on the error:
- * ```
- * - "immediate" on App.Save() failure
- * - "delayed" on transaction rollback
- * ```
- *
- * For convenience, if you want to listen to only the Record models
- * events without doing manual type assertion, you can attach to the OnRecord* proxy hooks.
- *
- * If the optional "tags" list (Collection id/name, Model table name, etc.) is specified,
- * then all event handlers registered via the created hook will be
- * triggered and called only if their event data origin matches the tags.
- */
- onModelAfterCreateError(...tags: string[]): (hook.TaggedHook)
- /**
- * OnModelUpdate is triggered every time when a new model is being updated
- * (e.g. triggered by App.Save()).
- *
- * Operations BEFORE the e.Next() execute before the model validation
- * and the UPDATE DB statement.
- *
- * Operations AFTER the e.Next() execute after the model validation
- * and the UPDATE DB statement.
- *
- * Note that successful execution doesn't guarantee that the model
- * is persisted in the database since its wrapping transaction may
- * not have been committed yet.
- * If you want to listen to only the actual persisted events, you can
- * bind to [OnModelAfterUpdateSuccess] or [OnModelAfterUpdateError] hooks.
- *
- * For convenience, if you want to listen to only the Record models
- * events without doing manual type assertion, you can attach to the OnRecord* proxy hooks.
- *
- * If the optional "tags" list (Collection id/name, Model table name, etc.) is specified,
- * then all event handlers registered via the created hook will be
- * triggered and called only if their event data origin matches the tags.
- */
- onModelUpdate(...tags: string[]): (hook.TaggedHook)
- /**
- * OnModelUpdateExecute is triggered after successful Model validation
- * and right before the model UPDATE DB statement execution.
- *
- * Usually it is triggered as part of the App.Save() in the following firing order:
- * OnModelUpdate {
- * ```
- * -> OnModelValidate (skipped with App.SaveNoValidate())
- * -> OnModelUpdateExecute
- * ```
- * }
- *
- * Note that successful execution doesn't guarantee that the model
- * is persisted in the database since its wrapping transaction may have been
- * committed yet.
- * If you want to listen to only the actual persisted events,
- * you can bind to [OnModelAfterUpdateSuccess] or [OnModelAfterUpdateError] hooks.
- *
- * For convenience, if you want to listen to only the Record models
- * events without doing manual type assertion, you can attach to the OnRecord* proxy hooks.
- *
- * If the optional "tags" list (Collection id/name, Model table name, etc.) is specified,
- * then all event handlers registered via the created hook will be
- * triggered and called only if their event data origin matches the tags.
- */
- onModelUpdateExecute(...tags: string[]): (hook.TaggedHook)
- /**
- * OnModelAfterUpdateSuccess is triggered after each successful
- * Model DB update persistence.
- *
- * Note that when a Model is persisted as part of a transaction,
- * this hook is delayed and executed only AFTER the transaction has been committed.
- * This hook is NOT triggered in case the transaction rollbacks
- * (aka. when the model changes weren't persisted).
- *
- * For convenience, if you want to listen to only the Record models
- * events without doing manual type assertion, you can attach to the OnRecord* proxy hooks.
- *
- * If the optional "tags" list (Collection id/name, Model table name, etc.) is specified,
- * then all event handlers registered via the created hook will be
- * triggered and called only if their event data origin matches the tags.
- */
- onModelAfterUpdateSuccess(...tags: string[]): (hook.TaggedHook)
- /**
- * OnModelAfterUpdateError is triggered after each failed
- * Model DB update persistence.
- *
- * Note that the execution of this hook is either immediate or delayed
- * depending on the error:
- * ```
- * - "immediate" on App.Save() failure
- * - "delayed" on transaction rollback
- * ```
- *
- * For convenience, if you want to listen to only the Record models
- * events without doing manual type assertion, you can attach to the OnRecord* proxy hooks.
- *
- * If the optional "tags" list (Collection id/name, Model table name, etc.) is specified,
- * then all event handlers registered via the created hook will be
- * triggered and called only if their event data origin matches the tags.
- */
- onModelAfterUpdateError(...tags: string[]): (hook.TaggedHook)
- /**
- * OnModelDelete is triggered every time when a new model is being deleted
- * (e.g. triggered by App.Delete()).
- *
- * Note that successful execution doesn't guarantee that the model
- * is deleted from the database since its wrapping transaction may
- * not have been committed yet.
- * If you want to listen to only the actual persisted deleted events, you can
- * bind to [OnModelAfterDeleteSuccess] or [OnModelAfterDeleteError] hooks.
- *
- * For convenience, if you want to listen to only the Record models
- * events without doing manual type assertion, you can attach to the OnRecord* proxy hooks.
- *
- * If the optional "tags" list (Collection id/name, Model table name, etc.) is specified,
- * then all event handlers registered via the created hook will be
- * triggered and called only if their event data origin matches the tags.
- */
- onModelDelete(...tags: string[]): (hook.TaggedHook)
- /**
- * OnModelUpdateExecute is triggered right before the model
- * DELETE DB statement execution.
- *
- * Usually it is triggered as part of the App.Delete() in the following firing order:
- * OnModelDelete {
- * ```
- * -> (internal delete checks)
- * -> OnModelDeleteExecute
- * ```
- * }
- *
- * Note that successful execution doesn't guarantee that the model
- * is deleted from the database since its wrapping transaction may
- * not have been committed yet.
- * If you want to listen to only the actual persisted deleted events, you can
- * bind to [OnModelAfterDeleteSuccess] or [OnModelAfterDeleteError] hooks.
- *
- * For convenience, if you want to listen to only the Record models
- * events without doing manual type assertion, you can attach to the OnRecord* proxy hooks.
- *
- * If the optional "tags" list (Collection id/name, Model table name, etc.) is specified,
- * then all event handlers registered via the created hook will be
- * triggered and called only if their event data origin matches the tags.
- */
- onModelDeleteExecute(...tags: string[]): (hook.TaggedHook)
- /**
- * OnModelAfterDeleteSuccess is triggered after each successful
- * Model DB delete persistence.
- *
- * Note that when a Model is deleted as part of a transaction,
- * this hook is delayed and executed only AFTER the transaction has been committed.
- * This hook is NOT triggered in case the transaction rollbacks
- * (aka. when the model delete wasn't persisted).
- *
- * For convenience, if you want to listen to only the Record models
- * events without doing manual type assertion, you can attach to the OnRecord* proxy hooks.
- *
- * If the optional "tags" list (Collection id/name, Model table name, etc.) is specified,
- * then all event handlers registered via the created hook will be
- * triggered and called only if their event data origin matches the tags.
- */
- onModelAfterDeleteSuccess(...tags: string[]): (hook.TaggedHook)
- /**
- * OnModelAfterDeleteError is triggered after each failed
- * Model DB delete persistence.
- *
- * Note that the execution of this hook is either immediate or delayed
- * depending on the error:
- * ```
- * - "immediate" on App.Delete() failure
- * - "delayed" on transaction rollback
- * ```
- *
- * For convenience, if you want to listen to only the Record models
- * events without doing manual type assertion, you can attach to the OnRecord* proxy hooks.
- *
- * If the optional "tags" list (Collection id/name, Model table name, etc.) is specified,
- * then all event handlers registered via the created hook will be
- * triggered and called only if their event data origin matches the tags.
- */
- onModelAfterDeleteError(...tags: string[]): (hook.TaggedHook)
- /**
- * OnRecordEnrich is triggered every time when a record is enriched
- * (as part of the builtin Record responses, during realtime message seriazation, or when [apis.EnrichRecord] is invoked).
- *
- * It could be used for example to redact/hide or add computed temporary
- * Record model props only for the specific request info. For example:
- *
- * app.OnRecordEnrich("posts").BindFunc(func(e core.*RecordEnrichEvent) {
- * ```
- * // hide one or more fields
- * e.Record.Hide("role")
- *
- * // add new custom field for registered users
- * if e.RequestInfo.Auth != nil && e.RequestInfo.Auth.Collection().Name == "users" {
- * e.Record.WithCustomData(true) // for security requires explicitly allowing it
- * e.Record.Set("computedScore", e.Record.GetInt("score") * e.RequestInfo.Auth.GetInt("baseScore"))
- * }
- *
- * return e.Next()
- * ```
- * })
- *
- * If the optional "tags" list (Collection ids or names) is specified,
- * then all event handlers registered via the created hook will be
- * triggered and called only if their event data origin matches the tags.
- */
- onRecordEnrich(...tags: string[]): (hook.TaggedHook)
- /**
- * OnRecordValidate is a Record proxy model hook of [OnModelValidate].
- *
- * If the optional "tags" list (Collection ids or names) is specified,
- * then all event handlers registered via the created hook will be
- * triggered and called only if their event data origin matches the tags.
- */
- onRecordValidate(...tags: string[]): (hook.TaggedHook)
- /**
- * OnRecordCreate is a Record proxy model hook of [OnModelCreate].
- *
- * If the optional "tags" list (Collection ids or names) is specified,
- * then all event handlers registered via the created hook will be
- * triggered and called only if their event data origin matches the tags.
- */
- onRecordCreate(...tags: string[]): (hook.TaggedHook)
- /**
- * OnRecordCreateExecute is a Record proxy model hook of [OnModelCreateExecute].
- *
- * If the optional "tags" list (Collection ids or names) is specified,
- * then all event handlers registered via the created hook will be
- * triggered and called only if their event data origin matches the tags.
- */
- onRecordCreateExecute(...tags: string[]): (hook.TaggedHook)
- /**
- * OnRecordAfterCreateSuccess is a Record proxy model hook of [OnModelAfterCreateSuccess].
- *
- * If the optional "tags" list (Collection ids or names) is specified,
- * then all event handlers registered via the created hook will be
- * triggered and called only if their event data origin matches the tags.
- */
- onRecordAfterCreateSuccess(...tags: string[]): (hook.TaggedHook)
- /**
- * OnRecordAfterCreateError is a Record proxy model hook of [OnModelAfterCreateError].
- *
- * If the optional "tags" list (Collection ids or names) is specified,
- * then all event handlers registered via the created hook will be
- * triggered and called only if their event data origin matches the tags.
- */
- onRecordAfterCreateError(...tags: string[]): (hook.TaggedHook)
- /**
- * OnRecordUpdate is a Record proxy model hook of [OnModelUpdate].
- *
- * If the optional "tags" list (Collection ids or names) is specified,
- * then all event handlers registered via the created hook will be
- * triggered and called only if their event data origin matches the tags.
- */
- onRecordUpdate(...tags: string[]): (hook.TaggedHook)
- /**
- * OnRecordUpdateExecute is a Record proxy model hook of [OnModelUpdateExecute].
- *
- * If the optional "tags" list (Collection ids or names) is specified,
- * then all event handlers registered via the created hook will be
- * triggered and called only if their event data origin matches the tags.
- */
- onRecordUpdateExecute(...tags: string[]): (hook.TaggedHook)
- /**
- * OnRecordAfterUpdateSuccess is a Record proxy model hook of [OnModelAfterUpdateSuccess].
- *
- * If the optional "tags" list (Collection ids or names) is specified,
- * then all event handlers registered via the created hook will be
- * triggered and called only if their event data origin matches the tags.
- */
- onRecordAfterUpdateSuccess(...tags: string[]): (hook.TaggedHook)
- /**
- * OnRecordAfterUpdateError is a Record proxy model hook of [OnModelAfterUpdateError].
- *
- * If the optional "tags" list (Collection ids or names) is specified,
- * then all event handlers registered via the created hook will be
- * triggered and called only if their event data origin matches the tags.
- */
- onRecordAfterUpdateError(...tags: string[]): (hook.TaggedHook)
- /**
- * OnRecordDelete is a Record proxy model hook of [OnModelDelete].
- *
- * If the optional "tags" list (Collection ids or names) is specified,
- * then all event handlers registered via the created hook will be
- * triggered and called only if their event data origin matches the tags.
- */
- onRecordDelete(...tags: string[]): (hook.TaggedHook)
- /**
- * OnRecordDeleteExecute is a Record proxy model hook of [OnModelDeleteExecute].
- *
- * If the optional "tags" list (Collection ids or names) is specified,
- * then all event handlers registered via the created hook will be
- * triggered and called only if their event data origin matches the tags.
- */
- onRecordDeleteExecute(...tags: string[]): (hook.TaggedHook)
- /**
- * OnRecordAfterDeleteSuccess is a Record proxy model hook of [OnModelAfterDeleteSuccess].
- *
- * If the optional "tags" list (Collection ids or names) is specified,
- * then all event handlers registered via the created hook will be
- * triggered and called only if their event data origin matches the tags.
- */
- onRecordAfterDeleteSuccess(...tags: string[]): (hook.TaggedHook)
- /**
- * OnRecordAfterDeleteError is a Record proxy model hook of [OnModelAfterDeleteError].
- *
- * If the optional "tags" list (Collection ids or names) is specified,
- * then all event handlers registered via the created hook will be
- * triggered and called only if their event data origin matches the tags.
- */
- onRecordAfterDeleteError(...tags: string[]): (hook.TaggedHook)
- /**
- * OnCollectionValidate is a Collection proxy model hook of [OnModelValidate].
- *
- * If the optional "tags" list (Collection ids or names) is specified,
- * then all event handlers registered via the created hook will be
- * triggered and called only if their event data origin matches the tags.
- */
- onCollectionValidate(...tags: string[]): (hook.TaggedHook)
- /**
- * OnCollectionCreate is a Collection proxy model hook of [OnModelCreate].
- *
- * If the optional "tags" list (Collection ids or names) is specified,
- * then all event handlers registered via the created hook will be
- * triggered and called only if their event data origin matches the tags.
- */
- onCollectionCreate(...tags: string[]): (hook.TaggedHook)
- /**
- * OnCollectionCreateExecute is a Collection proxy model hook of [OnModelCreateExecute].
- *
- * If the optional "tags" list (Collection ids or names) is specified,
- * then all event handlers registered via the created hook will be
- * triggered and called only if their event data origin matches the tags.
- */
- onCollectionCreateExecute(...tags: string[]): (hook.TaggedHook)
- /**
- * OnCollectionAfterCreateSuccess is a Collection proxy model hook of [OnModelAfterCreateSuccess].
- *
- * If the optional "tags" list (Collection ids or names) is specified,
- * then all event handlers registered via the created hook will be
- * triggered and called only if their event data origin matches the tags.
- */
- onCollectionAfterCreateSuccess(...tags: string[]): (hook.TaggedHook)
- /**
- * OnCollectionAfterCreateError is a Collection proxy model hook of [OnModelAfterCreateError].
- *
- * If the optional "tags" list (Collection ids or names) is specified,
- * then all event handlers registered via the created hook will be
- * triggered and called only if their event data origin matches the tags.
- */
- onCollectionAfterCreateError(...tags: string[]): (hook.TaggedHook)
- /**
- * OnCollectionUpdate is a Collection proxy model hook of [OnModelUpdate].
- *
- * If the optional "tags" list (Collection ids or names) is specified,
- * then all event handlers registered via the created hook will be
- * triggered and called only if their event data origin matches the tags.
- */
- onCollectionUpdate(...tags: string[]): (hook.TaggedHook)
- /**
- * OnCollectionUpdateExecute is a Collection proxy model hook of [OnModelUpdateExecute].
- *
- * If the optional "tags" list (Collection ids or names) is specified,
- * then all event handlers registered via the created hook will be
- * triggered and called only if their event data origin matches the tags.
- */
- onCollectionUpdateExecute(...tags: string[]): (hook.TaggedHook)
- /**
- * OnCollectionAfterUpdateSuccess is a Collection proxy model hook of [OnModelAfterUpdateSuccess].
- *
- * If the optional "tags" list (Collection ids or names) is specified,
- * then all event handlers registered via the created hook will be
- * triggered and called only if their event data origin matches the tags.
- */
- onCollectionAfterUpdateSuccess(...tags: string[]): (hook.TaggedHook)
- /**
- * OnCollectionAfterUpdateError is a Collection proxy model hook of [OnModelAfterUpdateError].
- *
- * If the optional "tags" list (Collection ids or names) is specified,
- * then all event handlers registered via the created hook will be
- * triggered and called only if their event data origin matches the tags.
- */
- onCollectionAfterUpdateError(...tags: string[]): (hook.TaggedHook)
- /**
- * OnCollectionDelete is a Collection proxy model hook of [OnModelDelete].
- *
- * If the optional "tags" list (Collection ids or names) is specified,
- * then all event handlers registered via the created hook will be
- * triggered and called only if their event data origin matches the tags.
- */
- onCollectionDelete(...tags: string[]): (hook.TaggedHook)
- /**
- * OnCollectionDeleteExecute is a Collection proxy model hook of [OnModelDeleteExecute].
- *
- * If the optional "tags" list (Collection ids or names) is specified,
- * then all event handlers registered via the created hook will be
- * triggered and called only if their event data origin matches the tags.
- */
- onCollectionDeleteExecute(...tags: string[]): (hook.TaggedHook)
- /**
- * OnCollectionAfterDeleteSuccess is a Collection proxy model hook of [OnModelAfterDeleteSuccess].
- *
- * If the optional "tags" list (Collection ids or names) is specified,
- * then all event handlers registered via the created hook will be
- * triggered and called only if their event data origin matches the tags.
- */
- onCollectionAfterDeleteSuccess(...tags: string[]): (hook.TaggedHook)
- /**
- * OnCollectionAfterDeleteError is a Collection proxy model hook of [OnModelAfterDeleteError].
- *
- * If the optional "tags" list (Collection ids or names) is specified,
- * then all event handlers registered via the created hook will be
- * triggered and called only if their event data origin matches the tags.
- */
- onCollectionAfterDeleteError(...tags: string[]): (hook.TaggedHook)
- /**
- * OnMailerSend hook is triggered every time when a new email is
- * being send using the [App.NewMailClient()] instance.
- *
- * It allows intercepting the email message or to use a custom mailer client.
- */
- onMailerSend(): (hook.Hook)
- /**
- * OnMailerRecordAuthAlertSend hook is triggered when
- * sending a new device login auth alert email, allowing you to
- * intercept and customize the email message that is being sent.
- *
- * If the optional "tags" list (Collection ids or names) is specified,
- * then all event handlers registered via the created hook will be
- * triggered and called only if their event data origin matches the tags.
- */
- onMailerRecordAuthAlertSend(...tags: string[]): (hook.TaggedHook)
- /**
- * OnMailerBeforeRecordResetPasswordSend hook is triggered when
- * sending a password reset email to an auth record, allowing
- * you to intercept and customize the email message that is being sent.
- *
- * If the optional "tags" list (Collection ids or names) is specified,
- * then all event handlers registered via the created hook will be
- * triggered and called only if their event data origin matches the tags.
- */
- onMailerRecordPasswordResetSend(...tags: string[]): (hook.TaggedHook)
- /**
- * OnMailerBeforeRecordVerificationSend hook is triggered when
- * sending a verification email to an auth record, allowing
- * you to intercept and customize the email message that is being sent.
- *
- * If the optional "tags" list (Collection ids or names) is specified,
- * then all event handlers registered via the created hook will be
- * triggered and called only if their event data origin matches the tags.
- */
- onMailerRecordVerificationSend(...tags: string[]): (hook.TaggedHook)
- /**
- * OnMailerRecordEmailChangeSend hook is triggered when sending a
- * confirmation new address email to an auth record, allowing
- * you to intercept and customize the email message that is being sent.
- *
- * If the optional "tags" list (Collection ids or names) is specified,
- * then all event handlers registered via the created hook will be
- * triggered and called only if their event data origin matches the tags.
- */
- onMailerRecordEmailChangeSend(...tags: string[]): (hook.TaggedHook)
- /**
- * OnMailerRecordOTPSend hook is triggered when sending an OTP email
- * to an auth record, allowing you to intercept and customize the
- * email message that is being sent.
- *
- * If the optional "tags" list (Collection ids or names) is specified,
- * then all event handlers registered via the created hook will be
- * triggered and called only if their event data origin matches the tags.
- */
- onMailerRecordOTPSend(...tags: string[]): (hook.TaggedHook)
- /**
- * OnRealtimeConnectRequest hook is triggered when establishing the SSE client connection.
- *
- * Any execution after e.Next() of a hook handler happens after the client disconnects.
- */
- onRealtimeConnectRequest(): (hook.Hook)
- /**
- * OnRealtimeMessageSend hook is triggered when sending an SSE message to a client.
- */
- onRealtimeMessageSend(): (hook.Hook)
- /**
- * OnRealtimeSubscribeRequest hook is triggered when updating the
- * client subscriptions, allowing you to further validate and
- * modify the submitted change.
- */
- onRealtimeSubscribeRequest(): (hook.Hook)
- /**
- * OnSettingsListRequest hook is triggered on each API Settings list request.
- *
- * Could be used to validate or modify the response before returning it to the client.
- */
- onSettingsListRequest(): (hook.Hook)
- /**
- * OnSettingsUpdateRequest hook is triggered on each API Settings update request.
- *
- * Could be used to additionally validate the request data or
- * implement completely different persistence behavior.
- */
- onSettingsUpdateRequest(): (hook.Hook)
- /**
- * OnSettingsReload hook is triggered every time when the App.Settings()
- * is being replaced with a new state.
- *
- * Calling App.Settings() after e.Next() returns the new state.
- */
- onSettingsReload(): (hook.Hook)
- /**
- * OnFileDownloadRequest hook is triggered before each API File download request.
- *
- * Could be used to validate or modify the file response before
- * returning it to the client.
- */
- onFileDownloadRequest(...tags: string[]): (hook.TaggedHook)
- /**
- * OnFileBeforeTokenRequest hook is triggered on each auth file token API request.
- *
- * If the optional "tags" list (Collection ids or names) is specified,
- * then all event handlers registered via the created hook will be
- * triggered and called only if their event data origin matches the tags.
- */
- onFileTokenRequest(...tags: string[]): (hook.TaggedHook)
- /**
- * OnRecordAuthRequest hook is triggered on each successful API
- * record authentication request (sign-in, token refresh, etc.).
- *
- * Could be used to additionally validate or modify the authenticated
- * record data and token.
- *
- * If the optional "tags" list (Collection ids or names) is specified,
- * then all event handlers registered via the created hook will be
- * triggered and called only if their event data origin matches the tags.
- */
- onRecordAuthRequest(...tags: string[]): (hook.TaggedHook)
- /**
- * OnRecordAuthWithPasswordRequest hook is triggered on each
- * Record auth with password API request.
- *
- * [RecordAuthWithPasswordRequestEvent.Record] could be nil if no matching identity is found, allowing
- * you to manually locate a different Record model (by reassigning [RecordAuthWithPasswordRequestEvent.Record]).
- *
- * If the optional "tags" list (Collection ids or names) is specified,
- * then all event handlers registered via the created hook will be
- * triggered and called only if their event data origin matches the tags.
- */
- onRecordAuthWithPasswordRequest(...tags: string[]): (hook.TaggedHook)
- /**
- * OnRecordAuthWithOAuth2Request hook is triggered on each Record
- * OAuth2 sign-in/sign-up API request (after token exchange and before external provider linking).
- *
- * If [RecordAuthWithOAuth2RequestEvent.Record] is not set, then the OAuth2
- * request will try to create a new auth Record.
- *
- * To assign or link a different existing record model you can
- * change the [RecordAuthWithOAuth2RequestEvent.Record] field.
- *
- * If the optional "tags" list (Collection ids or names) is specified,
- * then all event handlers registered via the created hook will be
- * triggered and called only if their event data origin matches the tags.
- */
- onRecordAuthWithOAuth2Request(...tags: string[]): (hook.TaggedHook)
- /**
- * OnRecordAuthRefreshRequest hook is triggered on each Record
- * auth refresh API request (right before generating a new auth token).
- *
- * Could be used to additionally validate the request data or implement
- * completely different auth refresh behavior.
- *
- * If the optional "tags" list (Collection ids or names) is specified,
- * then all event handlers registered via the created hook will be
- * triggered and called only if their event data origin matches the tags.
- */
- onRecordAuthRefreshRequest(...tags: string[]): (hook.TaggedHook)
- /**
- * OnRecordRequestPasswordResetRequest hook is triggered on
- * each Record request password reset API request.
- *
- * Could be used to additionally validate the request data or implement
- * completely different password reset behavior.
- *
- * If the optional "tags" list (Collection ids or names) is specified,
- * then all event handlers registered via the created hook will be
- * triggered and called only if their event data origin matches the tags.
- */
- onRecordRequestPasswordResetRequest(...tags: string[]): (hook.TaggedHook)
- /**
- * OnRecordConfirmPasswordResetRequest hook is triggered on
- * each Record confirm password reset API request.
- *
- * Could be used to additionally validate the request data or implement
- * completely different persistence behavior.
- *
- * If the optional "tags" list (Collection ids or names) is specified,
- * then all event handlers registered via the created hook will be
- * triggered and called only if their event data origin matches the tags.
- */
- onRecordConfirmPasswordResetRequest(...tags: string[]): (hook.TaggedHook)
- /**
- * OnRecordRequestVerificationRequest hook is triggered on
- * each Record request verification API request.
- *
- * Could be used to additionally validate the loaded request data or implement
- * completely different verification behavior.
- *
- * If the optional "tags" list (Collection ids or names) is specified,
- * then all event handlers registered via the created hook will be
- * triggered and called only if their event data origin matches the tags.
- */
- onRecordRequestVerificationRequest(...tags: string[]): (hook.TaggedHook)
- /**
- * OnRecordConfirmVerificationRequest hook is triggered on each
- * Record confirm verification API request.
- *
- * Could be used to additionally validate the request data or implement
- * completely different persistence behavior.
- *
- * If the optional "tags" list (Collection ids or names) is specified,
- * then all event handlers registered via the created hook will be
- * triggered and called only if their event data origin matches the tags.
- */
- onRecordConfirmVerificationRequest(...tags: string[]): (hook.TaggedHook)
- /**
- * OnRecordRequestEmailChangeRequest hook is triggered on each
- * Record request email change API request.
- *
- * Could be used to additionally validate the request data or implement
- * completely different request email change behavior.
- *
- * If the optional "tags" list (Collection ids or names) is specified,
- * then all event handlers registered via the created hook will be
- * triggered and called only if their event data origin matches the tags.
- */
- onRecordRequestEmailChangeRequest(...tags: string[]): (hook.TaggedHook)
- /**
- * OnRecordConfirmEmailChangeRequest hook is triggered on each
- * Record confirm email change API request.
- *
- * Could be used to additionally validate the request data or implement
- * completely different persistence behavior.
- *
- * If the optional "tags" list (Collection ids or names) is specified,
- * then all event handlers registered via the created hook will be
- * triggered and called only if their event data origin matches the tags.
- */
- onRecordConfirmEmailChangeRequest(...tags: string[]): (hook.TaggedHook)
- /**
- * OnRecordRequestOTPRequest hook is triggered on each Record
- * request OTP API request.
- *
- * [RecordCreateOTPRequestEvent.Record] could be nil if no matching identity is found, allowing
- * you to manually create or locate a different Record model (by reassigning [RecordCreateOTPRequestEvent.Record]).
- *
- * If the optional "tags" list (Collection ids or names) is specified,
- * then all event handlers registered via the created hook will be
- * triggered and called only if their event data origin matches the tags.
- */
- onRecordRequestOTPRequest(...tags: string[]): (hook.TaggedHook)
- /**
- * OnRecordAuthWithOTPRequest hook is triggered on each Record
- * auth with OTP API request.
- *
- * If the optional "tags" list (Collection ids or names) is specified,
- * then all event handlers registered via the created hook will be
- * triggered and called only if their event data origin matches the tags.
- */
- onRecordAuthWithOTPRequest(...tags: string[]): (hook.TaggedHook)
- /**
- * OnRecordsListRequest hook is triggered on each API Records list request.
- *
- * Could be used to validate or modify the response before returning it to the client.
- *
- * If the optional "tags" list (Collection ids or names) is specified,
- * then all event handlers registered via the created hook will be
- * triggered and called only if their event data origin matches the tags.
- */
- onRecordsListRequest(...tags: string[]): (hook.TaggedHook)
- /**
- * OnRecordViewRequest hook is triggered on each API Record view request.
- *
- * Could be used to validate or modify the response before returning it to the client.
- *
- * If the optional "tags" list (Collection ids or names) is specified,
- * then all event handlers registered via the created hook will be
- * triggered and called only if their event data origin matches the tags.
- */
- onRecordViewRequest(...tags: string[]): (hook.TaggedHook)
- /**
- * OnRecordCreateRequest hook is triggered on each API Record create request.
- *
- * Could be used to additionally validate the request data or implement
- * completely different persistence behavior.
- *
- * If the optional "tags" list (Collection ids or names) is specified,
- * then all event handlers registered via the created hook will be
- * triggered and called only if their event data origin matches the tags.
- */
- onRecordCreateRequest(...tags: string[]): (hook.TaggedHook)
- /**
- * OnRecordUpdateRequest hook is triggered on each API Record update request.
- *
- * Could be used to additionally validate the request data or implement
- * completely different persistence behavior.
- *
- * If the optional "tags" list (Collection ids or names) is specified,
- * then all event handlers registered via the created hook will be
- * triggered and called only if their event data origin matches the tags.
- */
- onRecordUpdateRequest(...tags: string[]): (hook.TaggedHook)
- /**
- * OnRecordDeleteRequest hook is triggered on each API Record delete request.
- *
- * Could be used to additionally validate the request data or implement
- * completely different delete behavior.
- *
- * If the optional "tags" list (Collection ids or names) is specified,
- * then all event handlers registered via the created hook will be
- * triggered and called only if their event data origin matches the tags.
- */
- onRecordDeleteRequest(...tags: string[]): (hook.TaggedHook)
- /**
- * OnCollectionsListRequest hook is triggered on each API Collections list request.
- *
- * Could be used to validate or modify the response before returning it to the client.
- */
- onCollectionsListRequest(): (hook.Hook)
- /**
- * OnCollectionViewRequest hook is triggered on each API Collection view request.
- *
- * Could be used to validate or modify the response before returning it to the client.
- */
- onCollectionViewRequest(): (hook.Hook)
- /**
- * OnCollectionCreateRequest hook is triggered on each API Collection create request.
- *
- * Could be used to additionally validate the request data or implement
- * completely different persistence behavior.
- */
- onCollectionCreateRequest(): (hook.Hook)
- /**
- * OnCollectionUpdateRequest hook is triggered on each API Collection update request.
- *
- * Could be used to additionally validate the request data or implement
- * completely different persistence behavior.
- */
- onCollectionUpdateRequest(): (hook.Hook)
- /**
- * OnCollectionDeleteRequest hook is triggered on each API Collection delete request.
- *
- * Could be used to additionally validate the request data or implement
- * completely different delete behavior.
- */
- onCollectionDeleteRequest(): (hook.Hook)
- /**
- * OnCollectionsBeforeImportRequest hook is triggered on each API
- * collections import request.
- *
- * Could be used to additionally validate the imported collections or
- * to implement completely different import behavior.
- */
- onCollectionsImportRequest(): (hook.Hook)
- /**
- * OnBatchRequest hook is triggered on each API batch request.
- *
- * Could be used to additionally validate or modify the submitted batch requests.
- */
- onBatchRequest(): (hook.Hook)
- }
- // @ts-ignore
- import validation = ozzo_validation
- /**
- * AuthOrigin defines a Record proxy for working with the authOrigins collection.
- */
- type _sUmzkLl = Record
- interface AuthOrigin extends _sUmzkLl {
- }
- interface newAuthOrigin {
- /**
- * NewAuthOrigin instantiates and returns a new blank *AuthOrigin model.
- *
- * Example usage:
- *
- * ```
- * origin := core.NewOrigin(app)
- * origin.SetRecordRef(user.Id)
- * origin.SetCollectionRef(user.Collection().Id)
- * origin.SetFingerprint("...")
- * app.Save(origin)
- * ```
- */
- (app: App): (AuthOrigin)
- }
- interface AuthOrigin {
- /**
- * PreValidate implements the [PreValidator] interface and checks
- * whether the proxy is properly loaded.
- */
- preValidate(ctx: context.Context, app: App): void
- }
- interface AuthOrigin {
- /**
- * ProxyRecord returns the proxied Record model.
- */
- proxyRecord(): (Record)
- }
- interface AuthOrigin {
- /**
- * SetProxyRecord loads the specified record model into the current proxy.
- */
- setProxyRecord(record: Record): void
- }
- interface AuthOrigin {
- /**
- * CollectionRef returns the "collectionRef" field value.
- */
- collectionRef(): string
- }
- interface AuthOrigin {
- /**
- * SetCollectionRef updates the "collectionRef" record field value.
- */
- setCollectionRef(collectionId: string): void
- }
- interface AuthOrigin {
- /**
- * RecordRef returns the "recordRef" record field value.
- */
- recordRef(): string
- }
- interface AuthOrigin {
- /**
- * SetRecordRef updates the "recordRef" record field value.
- */
- setRecordRef(recordId: string): void
- }
- interface AuthOrigin {
- /**
- * Fingerprint returns the "fingerprint" record field value.
- */
- fingerprint(): string
- }
- interface AuthOrigin {
- /**
- * SetFingerprint updates the "fingerprint" record field value.
- */
- setFingerprint(fingerprint: string): void
- }
- interface AuthOrigin {
- /**
- * Created returns the "created" record field value.
- */
- created(): types.DateTime
- }
- interface AuthOrigin {
- /**
- * Updated returns the "updated" record field value.
- */
- updated(): types.DateTime
- }
- interface BaseApp {
- /**
- * FindAllAuthOriginsByRecord returns all AuthOrigin models linked to the provided auth record (in DESC order).
- */
- findAllAuthOriginsByRecord(authRecord: Record): Array<(AuthOrigin | undefined)>
- }
- interface BaseApp {
- /**
- * FindAllAuthOriginsByCollection returns all AuthOrigin models linked to the provided collection (in DESC order).
- */
- findAllAuthOriginsByCollection(collection: Collection): Array<(AuthOrigin | undefined)>
- }
- interface BaseApp {
- /**
- * FindAuthOriginById returns a single AuthOrigin model by its id.
- */
- findAuthOriginById(id: string): (AuthOrigin)
- }
- interface BaseApp {
- /**
- * FindAuthOriginByRecordAndFingerprint returns a single AuthOrigin model
- * by its authRecord relation and fingerprint.
- */
- findAuthOriginByRecordAndFingerprint(authRecord: Record, fingerprint: string): (AuthOrigin)
- }
- interface BaseApp {
- /**
- * DeleteAllAuthOriginsByRecord deletes all AuthOrigin models associated with the provided record.
- *
- * Returns a combined error with the failed deletes.
- */
- deleteAllAuthOriginsByRecord(authRecord: Record): void
- }
- /**
- * FilesManager defines an interface with common methods that files manager models should implement.
- */
- interface FilesManager {
- [key:string]: any;
- /**
- * BaseFilesPath returns the storage dir path used by the interface instance.
- */
- baseFilesPath(): string
- }
- /**
- * DBConnectFunc defines a database connection initialization function.
- */
- interface DBConnectFunc {(dbPath: string): (dbx.DB) }
- /**
- * BaseAppConfig defines a BaseApp configuration option
- */
- interface BaseAppConfig {
- dbConnect: DBConnectFunc
- dataDir: string
- encryptionEnv: string
- queryTimeout: time.Duration
- dataMaxOpenConns: number
- dataMaxIdleConns: number
- auxMaxOpenConns: number
- auxMaxIdleConns: number
- isDev: boolean
- }
- /**
- * BaseApp implements CoreApp and defines the base PocketBase app structure.
- */
- interface BaseApp {
- }
- interface newBaseApp {
- /**
- * NewBaseApp creates and returns a new BaseApp instance
- * configured with the provided arguments.
- *
- * To initialize the app, you need to call `app.Bootstrap()`.
- */
- (config: BaseAppConfig): (BaseApp)
- }
- interface BaseApp {
- /**
- * UnsafeWithoutHooks returns a shallow copy of the current app WITHOUT any registered hooks.
- *
- * NB! Note that using the returned app instance may cause data integrity errors
- * since the Record validations and data normalizations (including files uploads)
- * rely on the app hooks to work.
- */
- unsafeWithoutHooks(): App
- }
- interface BaseApp {
- /**
- * Logger returns the default app logger.
- *
- * If the application is not bootstrapped yet, fallbacks to slog.Default().
- */
- logger(): (slog.Logger)
- }
- interface BaseApp {
- /**
- * TxInfo returns the transaction associated with the current app instance (if any).
- *
- * Could be used if you want to execute indirectly a function after
- * the related app transaction completes using `app.TxInfo().OnAfterFunc(callback)`.
- */
- txInfo(): (TxAppInfo)
- }
- interface BaseApp {
- /**
- * IsTransactional checks if the current app instance is part of a transaction.
- */
- isTransactional(): boolean
- }
- interface BaseApp {
- /**
- * IsBootstrapped checks if the application was initialized
- * (aka. whether Bootstrap() was called).
- */
- isBootstrapped(): boolean
- }
- interface BaseApp {
- /**
- * Bootstrap initializes the application
- * (aka. create data dir, open db connections, load settings, etc.).
- *
- * It will call ResetBootstrapState() if the application was already bootstrapped.
- */
- bootstrap(): void
- }
- interface closer {
- [key:string]: any;
- close(): void
- }
- interface BaseApp {
- /**
- * ResetBootstrapState releases the initialized core app resources
- * (closing db connections, stopping cron ticker, etc.).
- */
- resetBootstrapState(): void
- }
- interface BaseApp {
- /**
- * DB returns the default app data.db builder instance.
- *
- * To minimize SQLITE_BUSY errors, it automatically routes the
- * SELECT queries to the underlying concurrent db pool and everything
- * else to the nonconcurrent one.
- *
- * For more finer control over the used connections pools you can
- * call directly ConcurrentDB() or NonconcurrentDB().
- */
- db(): dbx.Builder
- }
- interface BaseApp {
- /**
- * ConcurrentDB returns the concurrent app data.db builder instance.
- *
- * This method is used mainly internally for executing db read
- * operations in a concurrent/non-blocking manner.
- *
- * Most users should use simply DB() as it will automatically
- * route the query execution to ConcurrentDB() or NonconcurrentDB().
- *
- * In a transaction the ConcurrentDB() and NonconcurrentDB() refer to the same *dbx.TX instance.
- */
- concurrentDB(): dbx.Builder
- }
- interface BaseApp {
- /**
- * NonconcurrentDB returns the nonconcurrent app data.db builder instance.
- *
- * The returned db instance is limited only to a single open connection,
- * meaning that it can process only 1 db operation at a time (other queries queue up).
- *
- * This method is used mainly internally and in the tests to execute write
- * (save/delete) db operations as it helps with minimizing the SQLITE_BUSY errors.
- *
- * Most users should use simply DB() as it will automatically
- * route the query execution to ConcurrentDB() or NonconcurrentDB().
- *
- * In a transaction the ConcurrentDB() and NonconcurrentDB() refer to the same *dbx.TX instance.
- */
- nonconcurrentDB(): dbx.Builder
- }
- interface BaseApp {
- /**
- * AuxDB returns the app auxiliary.db builder instance.
- *
- * To minimize SQLITE_BUSY errors, it automatically routes the
- * SELECT queries to the underlying concurrent db pool and everything
- * else to the nonconcurrent one.
- *
- * For more finer control over the used connections pools you can
- * call directly AuxConcurrentDB() or AuxNonconcurrentDB().
- */
- auxDB(): dbx.Builder
- }
- interface BaseApp {
- /**
- * AuxConcurrentDB returns the concurrent app auxiliary.db builder instance.
- *
- * This method is used mainly internally for executing db read
- * operations in a concurrent/non-blocking manner.
- *
- * Most users should use simply AuxDB() as it will automatically
- * route the query execution to AuxConcurrentDB() or AuxNonconcurrentDB().
- *
- * In a transaction the AuxConcurrentDB() and AuxNonconcurrentDB() refer to the same *dbx.TX instance.
- */
- auxConcurrentDB(): dbx.Builder
- }
- interface BaseApp {
- /**
- * AuxNonconcurrentDB returns the nonconcurrent app auxiliary.db builder instance.
- *
- * The returned db instance is limited only to a single open connection,
- * meaning that it can process only 1 db operation at a time (other queries queue up).
- *
- * This method is used mainly internally and in the tests to execute write
- * (save/delete) db operations as it helps with minimizing the SQLITE_BUSY errors.
- *
- * Most users should use simply AuxDB() as it will automatically
- * route the query execution to AuxConcurrentDB() or AuxNonconcurrentDB().
- *
- * In a transaction the AuxConcurrentDB() and AuxNonconcurrentDB() refer to the same *dbx.TX instance.
- */
- auxNonconcurrentDB(): dbx.Builder
- }
- interface BaseApp {
- /**
- * DataDir returns the app data directory path.
- */
- dataDir(): string
- }
- interface BaseApp {
- /**
- * EncryptionEnv returns the name of the app secret env key
- * (currently used primarily for optional settings encryption but this may change in the future).
- */
- encryptionEnv(): string
- }
- interface BaseApp {
- /**
- * IsDev returns whether the app is in dev mode.
- *
- * When enabled logs, executed sql statements, etc. are printed to the stderr.
- */
- isDev(): boolean
- }
- interface BaseApp {
- /**
- * Settings returns the loaded app settings.
- */
- settings(): (Settings)
- }
- interface BaseApp {
- /**
- * Store returns the app runtime store.
- */
- store(): (store.Store)
- }
- interface BaseApp {
- /**
- * Cron returns the app cron instance.
- */
- cron(): (cron.Cron)
- }
- interface BaseApp {
- /**
- * SubscriptionsBroker returns the app realtime subscriptions broker instance.
- */
- subscriptionsBroker(): (subscriptions.Broker)
- }
- interface BaseApp {
- /**
- * NewMailClient creates and returns a new SMTP or Sendmail client
- * based on the current app settings.
- */
- newMailClient(): mailer.Mailer
- }
- interface BaseApp {
- /**
- * NewFilesystem creates a new local or S3 filesystem instance
- * for managing regular app files (ex. record uploads)
- * based on the current app settings.
- *
- * NB! Make sure to call Close() on the returned result
- * after you are done working with it.
- */
- newFilesystem(): (filesystem.System)
- }
- interface BaseApp {
- /**
- * NewBackupsFilesystem creates a new local or S3 filesystem instance
- * for managing app backups based on the current app settings.
- *
- * NB! Make sure to call Close() on the returned result
- * after you are done working with it.
- */
- newBackupsFilesystem(): (filesystem.System)
- }
- interface BaseApp {
- /**
- * Restart restarts (aka. replaces) the current running application process.
- *
- * NB! It relies on execve which is supported only on UNIX based systems.
- */
- restart(): void
- }
- interface BaseApp {
- /**
- * RunSystemMigrations applies all new migrations registered in the [core.SystemMigrations] list.
- */
- runSystemMigrations(): void
- }
- interface BaseApp {
- /**
- * RunAppMigrations applies all new migrations registered in the [CoreAppMigrations] list.
- */
- runAppMigrations(): void
- }
- interface BaseApp {
- /**
- * RunAllMigrations applies all system and app migrations
- * (aka. from both [core.SystemMigrations] and [CoreAppMigrations]).
- */
- runAllMigrations(): void
- }
- interface BaseApp {
- onBootstrap(): (hook.Hook)
- }
- interface BaseApp {
- onServe(): (hook.Hook)
- }
- interface BaseApp {
- onTerminate(): (hook.Hook)
- }
- interface BaseApp {
- onBackupCreate(): (hook.Hook)
- }
- interface BaseApp {
- onBackupRestore(): (hook.Hook)
- }
- interface BaseApp {
- onModelCreate(...tags: string[]): (hook.TaggedHook)
- }
- interface BaseApp {
- onModelCreateExecute(...tags: string[]): (hook.TaggedHook)
- }
- interface BaseApp {
- onModelAfterCreateSuccess(...tags: string[]): (hook.TaggedHook)
- }
- interface BaseApp {
- onModelAfterCreateError(...tags: string[]): (hook.TaggedHook)
- }
- interface BaseApp {
- onModelUpdate(...tags: string[]): (hook.TaggedHook)
- }
- interface BaseApp {
- onModelUpdateExecute(...tags: string[]): (hook.TaggedHook)
- }
- interface BaseApp {
- onModelAfterUpdateSuccess(...tags: string[]): (hook.TaggedHook)
- }
- interface BaseApp {
- onModelAfterUpdateError(...tags: string[]): (hook.TaggedHook)
- }
- interface BaseApp {
- onModelValidate(...tags: string[]): (hook.TaggedHook)
- }
- interface BaseApp {
- onModelDelete(...tags: string[]): (hook.TaggedHook)
- }
- interface BaseApp {
- onModelDeleteExecute(...tags: string[]): (hook.TaggedHook)
- }
- interface BaseApp {
- onModelAfterDeleteSuccess(...tags: string[]): (hook.TaggedHook)
- }
- interface BaseApp {
- onModelAfterDeleteError(...tags: string[]): (hook.TaggedHook)
- }
- interface BaseApp {
- onRecordEnrich(...tags: string[]): (hook.TaggedHook)
- }
- interface BaseApp {
- onRecordValidate(...tags: string[]): (hook.TaggedHook)
- }
- interface BaseApp {
- onRecordCreate(...tags: string[]): (hook.TaggedHook)
- }
- interface BaseApp {
- onRecordCreateExecute(...tags: string[]): (hook.TaggedHook)
- }
- interface BaseApp {
- onRecordAfterCreateSuccess(...tags: string[]): (hook.TaggedHook)
- }
- interface BaseApp {
- onRecordAfterCreateError(...tags: string[]): (hook.TaggedHook)
- }
- interface BaseApp {
- onRecordUpdate(...tags: string[]): (hook.TaggedHook)
- }
- interface BaseApp {
- onRecordUpdateExecute(...tags: string[]): (hook.TaggedHook)
- }
- interface BaseApp {
- onRecordAfterUpdateSuccess(...tags: string[]): (hook.TaggedHook)
- }
- interface BaseApp {
- onRecordAfterUpdateError(...tags: string[]): (hook.TaggedHook)
- }
- interface BaseApp {
- onRecordDelete(...tags: string[]): (hook.TaggedHook)
- }
- interface BaseApp {
- onRecordDeleteExecute(...tags: string[]): (hook.TaggedHook)
- }
- interface BaseApp {
- onRecordAfterDeleteSuccess(...tags: string[]): (hook.TaggedHook)
- }
- interface BaseApp {
- onRecordAfterDeleteError(...tags: string[]): (hook.TaggedHook)
- }
- interface BaseApp {
- onCollectionValidate(...tags: string[]): (hook.TaggedHook)
- }
- interface BaseApp {
- onCollectionCreate(...tags: string[]): (hook.TaggedHook)
- }
- interface BaseApp {
- onCollectionCreateExecute(...tags: string[]): (hook.TaggedHook)
- }
- interface BaseApp {
- onCollectionAfterCreateSuccess(...tags: string[]): (hook.TaggedHook)
- }
- interface BaseApp {
- onCollectionAfterCreateError(...tags: string[]): (hook.TaggedHook)
- }
- interface BaseApp {
- onCollectionUpdate(...tags: string[]): (hook.TaggedHook