@oneuptime/common 14.0.102 → 14.0.103
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/Models/DatabaseModels/Index.js +6 -0
- package/Models/DatabaseModels/LogSavedView.d.mts +1 -0
- package/Models/DatabaseModels/LogSavedView.d.ts +1 -0
- package/Models/DatabaseModels/LogSavedView.js +43 -1
- package/Models/DatabaseModels/NetworkControllerConnection.d.mts +1 -0
- package/Models/DatabaseModels/NetworkControllerConnection.d.ts +1 -0
- package/Models/DatabaseModels/NetworkControllerConnection.js +21 -0
- package/Models/DatabaseModels/Project.d.mts +3 -0
- package/Models/DatabaseModels/Project.d.ts +3 -0
- package/Models/DatabaseModels/Project.js +124 -0
- package/Models/DatabaseModels/Runner.d.mts +1 -0
- package/Models/DatabaseModels/Runner.d.ts +1 -0
- package/Models/DatabaseModels/Runner.js +40 -0
- package/Models/DatabaseModels/SecurityCase.d.mts +2 -1
- package/Models/DatabaseModels/SecurityCase.d.ts +2 -1
- package/Models/DatabaseModels/SecurityCase.js +27 -0
- package/Models/DatabaseModels/SecurityCaseCustomField.d.mts +20 -0
- package/Models/DatabaseModels/SecurityCaseCustomField.d.ts +20 -0
- package/Models/DatabaseModels/SecurityCaseCustomField.js +387 -0
- package/Models/DatabaseModels/SecurityCaseCustomField.mjs +2 -0
- package/Models/DatabaseModels/SecurityCaseNoteTemplate.d.mts +15 -0
- package/Models/DatabaseModels/SecurityCaseNoteTemplate.d.ts +15 -0
- package/Models/DatabaseModels/SecurityCaseNoteTemplate.js +309 -0
- package/Models/DatabaseModels/SecurityCaseNoteTemplate.mjs +2 -0
- package/Models/DatabaseModels/WorkspaceHomeChoice.d.mts +11 -0
- package/Models/DatabaseModels/WorkspaceHomeChoice.d.ts +11 -0
- package/Models/DatabaseModels/WorkspaceHomeChoice.js +186 -0
- package/Models/DatabaseModels/WorkspaceHomeChoice.mjs +2 -0
- package/Types/AI/AIFixReadiness.d.mts +2 -0
- package/Types/AI/AIFixReadiness.d.ts +2 -0
- package/Types/AI/AIFixReadiness.js +0 -6
- package/Types/AI/CodeTask.d.mts +3 -1
- package/Types/AI/CodeTask.d.ts +3 -1
- package/Types/AI/CodeTask.js +12 -0
- package/Types/CustomField/CustomFieldRecordKinds.js +5 -0
- package/Types/CustomField/CustomFieldSavedViews.js +2 -0
- package/Types/DateLanguage.js +3 -2
- package/Types/DockerSwarm/DockerSwarmInventoryExtractor.d.mts +1 -0
- package/Types/DockerSwarm/DockerSwarmInventoryExtractor.d.ts +1 -0
- package/Types/DockerSwarm/DockerSwarmInventoryExtractor.js +84 -6
- package/Types/DockerSwarm/DockerSwarmInventoryExtractor.mjs +1 -0
- package/Types/InstallScripts/InstallScripts.d.mts +1 -0
- package/Types/InstallScripts/InstallScripts.d.ts +1 -0
- package/Types/InstallScripts/InstallScripts.js +14 -0
- package/Types/Monitor/DockerSwarmAlertTemplates.d.mts +15 -0
- package/Types/Monitor/DockerSwarmAlertTemplates.d.ts +15 -0
- package/Types/Monitor/DockerSwarmAlertTemplates.js +168 -0
- package/Types/Monitor/DockerSwarmAlertTemplates.mjs +1 -0
- package/Types/Monitor/DockerSwarmMetricCatalog.d.mts +1 -1
- package/Types/Monitor/DockerSwarmMetricCatalog.d.ts +1 -1
- package/Types/Monitor/DockerSwarmMetricCatalog.js +43 -11
- package/Types/Monitor/SeriesContext/SeriesDebugHints.js +19 -0
- package/Types/NetworkController/NetworkControllerDeviceAdd.d.mts +70 -0
- package/Types/NetworkController/NetworkControllerDeviceAdd.d.ts +70 -0
- package/Types/NetworkController/NetworkControllerDeviceAdd.js +389 -0
- package/Types/NetworkController/NetworkControllerDeviceAdd.mjs +26 -0
- package/Types/NetworkController/NetworkControllerReadSummary.d.mts +2 -0
- package/Types/NetworkController/NetworkControllerReadSummary.d.ts +2 -0
- package/Types/NetworkController/NetworkControllerReadSummary.js +6 -1
- package/Types/NetworkDevice/NetworkTopologyLayout.d.mts +8 -0
- package/Types/NetworkDevice/NetworkTopologyLayout.d.ts +8 -0
- package/Types/NetworkDevice/NetworkTopologyLayout.js +49 -0
- package/Types/NetworkDevice/NetworkTopologyLayout.mjs +3 -0
- package/Types/Permission.d.mts +8 -0
- package/Types/Permission.d.ts +8 -0
- package/Types/Permission.js +87 -3
- package/Types/PushNotification/PushNotificationCategory.d.mts +3 -0
- package/Types/PushNotification/PushNotificationCategory.d.ts +3 -0
- package/Types/PushNotification/PushNotificationCategory.js +38 -0
- package/Types/PushNotification/PushNotificationCategory.mjs +4 -0
- package/Types/PushNotification/PushNotificationMessage.d.mts +1 -0
- package/Types/PushNotification/PushNotificationMessage.d.ts +1 -0
- package/Types/Runner/RunnerCodeFixes.d.mts +22 -0
- package/Types/Runner/RunnerCodeFixes.d.ts +22 -0
- package/Types/Runner/RunnerCodeFixes.js +129 -0
- package/Types/Runner/RunnerCodeFixes.mjs +9 -0
- package/Types/SecurityCase/SecurityCaseNumber.js +8 -4
- package/Types/SecurityEvent/MitreAttack.d.mts +2 -0
- package/Types/SecurityEvent/MitreAttack.d.ts +2 -0
- package/Types/SecurityEvent/MitreAttack.js +26 -0
- package/Types/SecurityEvent/MitreAttack.mjs +2 -0
- package/Types/SecurityEvent/OcsfSeverity.js +10 -1
- package/Types/Telemetry/TelemetrySearchQuery.js +14 -2
- package/Types/Workspace/WorkspaceMessagePayload.d.mts +7 -0
- package/Types/Workspace/WorkspaceMessagePayload.d.ts +7 -0
- package/Utils/CronScheduleText.d.mts +3 -0
- package/Utils/CronScheduleText.d.ts +3 -0
- package/Utils/CronScheduleText.js +307 -0
- package/Utils/CronScheduleText.mjs +3 -0
- package/Utils/Dashboard/DashboardBoardLayout.d.mts +2 -0
- package/Utils/Dashboard/DashboardBoardLayout.d.ts +2 -0
- package/Utils/Dashboard/DashboardBoardLayout.js +17 -4
- package/Utils/Dashboard/DashboardBoardLayout.mjs +1 -0
- package/Utils/DeveloperDocs/CliCommands.d.mts +114 -0
- package/Utils/DeveloperDocs/CliCommands.d.ts +114 -0
- package/Utils/DeveloperDocs/CliCommands.js +750 -0
- package/Utils/DeveloperDocs/CliCommands.mjs +37 -0
- package/Utils/DeveloperDocs/CliExamples.d.mts +59 -0
- package/Utils/DeveloperDocs/CliExamples.d.ts +59 -0
- package/Utils/DeveloperDocs/CliExamples.js +348 -0
- package/Utils/DeveloperDocs/CliExamples.mjs +17 -0
- package/Utils/DeveloperDocs/CliResources.d.mts +18 -0
- package/Utils/DeveloperDocs/CliResources.d.ts +18 -0
- package/Utils/DeveloperDocs/CliResources.js +129 -0
- package/Utils/DeveloperDocs/CliResources.mjs +6 -0
- package/Utils/DeveloperDocs/ExampleBuilder.d.mts +6 -0
- package/Utils/DeveloperDocs/ExampleBuilder.d.ts +6 -0
- package/Utils/DeveloperDocs/ExampleBuilder.js +27 -2
- package/Utils/DeveloperDocs/ExampleBuilder.mjs +1 -0
- package/Utils/DeveloperDocs/PageLookups.d.mts +1 -1
- package/Utils/DeveloperDocs/PageLookups.d.ts +1 -1
- package/Utils/DeveloperDocs/PageLookups.js +9 -2
- package/Utils/DeveloperDocs/TerraformSchema.d.mts +1 -0
- package/Utils/DeveloperDocs/TerraformSchema.d.ts +1 -0
- package/Utils/DeveloperDocs/TerraformSchema.js +3 -1
- package/Utils/DeveloperDocs/TerraformSchema.mjs +1 -0
- package/Utils/LookupTable.d.mts +3 -0
- package/Utils/LookupTable.d.ts +3 -0
- package/Utils/LookupTable.js +44 -0
- package/Utils/LookupTable.mjs +4 -0
- package/Utils/Monitor/MonitorCheckScheduleUtil.d.mts +62 -0
- package/Utils/Monitor/MonitorCheckScheduleUtil.d.ts +62 -0
- package/Utils/Monitor/MonitorCheckScheduleUtil.js +484 -0
- package/Utils/Monitor/MonitorCheckScheduleUtil.mjs +3 -0
- package/Utils/Monitor/MonitorOverviewFamily.d.mts +39 -0
- package/Utils/Monitor/MonitorOverviewFamily.d.ts +39 -0
- package/Utils/Monitor/MonitorOverviewFamily.js +207 -0
- package/Utils/Monitor/MonitorOverviewFamily.mjs +4 -0
- package/Utils/Monitor/MonitorOverviewPresentationUtil.d.mts +192 -0
- package/Utils/Monitor/MonitorOverviewPresentationUtil.d.ts +192 -0
- package/Utils/Monitor/MonitorOverviewPresentationUtil.js +1659 -0
- package/Utils/Monitor/MonitorOverviewPresentationUtil.mjs +5 -0
- package/Utils/Monitor/MonitorOverviewProbeUtil.d.mts +112 -0
- package/Utils/Monitor/MonitorOverviewProbeUtil.d.ts +112 -0
- package/Utils/Monitor/MonitorOverviewProbeUtil.js +640 -0
- package/Utils/Monitor/MonitorOverviewProbeUtil.mjs +3 -0
- package/Utils/Monitor/MonitorOverviewTargetUtil.d.mts +1 -1
- package/Utils/Monitor/MonitorOverviewTargetUtil.d.ts +1 -1
- package/Utils/Monitor/MonitorStatusHistoryUtil.d.mts +27 -0
- package/Utils/Monitor/MonitorStatusHistoryUtil.d.ts +27 -0
- package/Utils/Monitor/MonitorStatusHistoryUtil.js +132 -0
- package/Utils/Monitor/MonitorStatusHistoryUtil.mjs +2 -0
- package/Utils/Monitor/MonitorUptimeSummaryUtil.d.mts +44 -0
- package/Utils/Monitor/MonitorUptimeSummaryUtil.d.ts +44 -0
- package/Utils/Monitor/MonitorUptimeSummaryUtil.js +487 -0
- package/Utils/Monitor/MonitorUptimeSummaryUtil.mjs +2 -0
- package/Utils/OldestKeyMap.d.mts +10 -0
- package/Utils/OldestKeyMap.d.ts +10 -0
- package/Utils/OldestKeyMap.js +91 -0
- package/Utils/OldestKeyMap.mjs +2 -0
- package/Utils/Project/NextNumber.d.mts +4 -3
- package/Utils/Project/NextNumber.d.ts +4 -3
- package/Utils/Project/NextNumber.js +11 -2
- package/Utils/Project/NumberPrefix.d.mts +1 -1
- package/Utils/Project/NumberPrefix.d.ts +1 -1
- package/Utils/Project/NumberPrefix.js +12 -0
- package/Utils/Schema/AnalyticsModelSchema.d.mts +48 -0
- package/Utils/Schema/AnalyticsModelSchema.d.ts +48 -0
- package/Utils/Schema/AnalyticsModelSchema.js +767 -0
- package/Utils/Schema/AnalyticsModelSchema.mjs +2 -0
- package/Utils/Schema/BaseSchema.d.mts +117 -0
- package/Utils/Schema/BaseSchema.d.ts +117 -0
- package/Utils/Schema/BaseSchema.js +257 -0
- package/Utils/Schema/BaseSchema.mjs +3 -0
- package/Utils/Schema/ModelSchema.d.mts +80 -0
- package/Utils/Schema/ModelSchema.d.ts +80 -0
- package/Utils/Schema/ModelSchema.js +1727 -0
- package/Utils/Schema/ModelSchema.mjs +2 -0
- package/Utils/SecurityEvent/Connectors/AwsSecurityHubNormalizer.d.mts +0 -1
- package/Utils/SecurityEvent/Connectors/AwsSecurityHubNormalizer.d.ts +0 -1
- package/Utils/SecurityEvent/Connectors/AwsSecurityHubNormalizer.js +9 -25
- package/Utils/SecurityEvent/Connectors/AwsSecurityHubNormalizer.mjs +0 -1
- package/Utils/SecurityEvent/Connectors/EntraIdNormalizer.d.mts +1 -1
- package/Utils/SecurityEvent/Connectors/EntraIdNormalizer.d.ts +1 -1
- package/Utils/SecurityEvent/Connectors/EntraIdNormalizer.js +7 -6
- package/Utils/SecurityEvent/Connectors/GoogleWorkspaceNormalizer.d.mts +1 -1
- package/Utils/SecurityEvent/Connectors/GoogleWorkspaceNormalizer.d.ts +1 -1
- package/Utils/SecurityEvent/Connectors/GoogleWorkspaceNormalizer.js +10 -9
- package/Utils/SecurityEvent/Connectors/Microsoft365AuditNormalizer.js +4 -3
- package/Utils/SecurityEvent/Connectors/MicrosoftDefenderXdrNormalizer.js +12 -28
- package/Utils/SecurityEvent/Connectors/MicrosoftSentinelNormalizer.d.mts +1 -1
- package/Utils/SecurityEvent/Connectors/MicrosoftSentinelNormalizer.d.ts +1 -1
- package/Utils/SecurityEvent/Connectors/MicrosoftSentinelNormalizer.js +13 -24
- package/Utils/SecurityEvent/Connectors/MicrosoftSentinelNormalizer.mjs +1 -1
- package/Utils/SecurityEvent/Connectors/OktaNormalizer.d.mts +2 -2
- package/Utils/SecurityEvent/Connectors/OktaNormalizer.d.ts +2 -2
- package/Utils/SecurityEvent/Connectors/OktaNormalizer.js +7 -6
- package/Utils/SecurityEvent/Connectors/SplunkNormalizer.js +7 -26
- package/Utils/SecurityEvent/LogParsers/AzureActivityLogParser.js +4 -3
- package/Utils/SecurityEvent/LogParsers/WindowsEventLogParser.d.mts +2 -2
- package/Utils/SecurityEvent/LogParsers/WindowsEventLogParser.d.ts +2 -2
- package/Utils/SecurityEvent/LogParsers/WindowsEventLogParser.js +26 -16
- package/Utils/SecurityEvent/LogParsers/WindowsEventRecord.d.mts +1 -1
- package/Utils/SecurityEvent/LogParsers/WindowsEventRecord.d.ts +1 -1
- package/Utils/SecurityEvent/LogParsers/WindowsEventRecord.js +10 -6
- package/Utils/SecurityEvent/SecurityEventNormalizer.js +17 -11
- package/Utils/SecurityEvent/SecurityEventSearch.js +8 -1
- package/Utils/SecurityEvent/Sigma/SigmaRuleSetParser.js +4 -5
- package/Utils/SecurityEvent/ThreatIntel/StixPatternParser.js +7 -3
- package/Utils/SecurityEvent/UdmNormalizer.js +10 -6
- package/Utils/Telemetry/SavedViewDefault.js +4 -3
- package/Utils/Telemetry/SavedViewScope.d.mts +33 -0
- package/Utils/Telemetry/SavedViewScope.d.ts +33 -0
- package/Utils/Telemetry/SavedViewScope.js +105 -0
- package/Utils/Telemetry/SavedViewScope.mjs +7 -0
- package/package.json +1 -11
- package/UI/Utils/TranslateTemplate.d.mts +0 -8
- package/UI/Utils/TranslateTemplate.d.ts +0 -8
|
@@ -0,0 +1,117 @@
|
|
|
1
|
+
import { z as ZodTypes } from "zod";
|
|
2
|
+
import { ZodSchema } from "./Zod.mjs";
|
|
3
|
+
export type BaseSchemaType = ZodSchema;
|
|
4
|
+
export type SchemaExample = Record<string, unknown>;
|
|
5
|
+
export type ShapeRecord = Record<string, ZodTypes.ZodTypeAny>;
|
|
6
|
+
export type OperatorExample = {
|
|
7
|
+
properties: Record<string, {
|
|
8
|
+
type: string;
|
|
9
|
+
enum?: string[];
|
|
10
|
+
items?: {
|
|
11
|
+
type: string;
|
|
12
|
+
};
|
|
13
|
+
}>;
|
|
14
|
+
required: string[];
|
|
15
|
+
example: Record<string, unknown>;
|
|
16
|
+
};
|
|
17
|
+
export declare const ALWAYS_READABLE_COLUMNS: Array<string>;
|
|
18
|
+
/**
|
|
19
|
+
* Base class for schema generation with common functionality
|
|
20
|
+
* Both ModelSchema and AnalyticsModelSchema extend this class
|
|
21
|
+
*
|
|
22
|
+
* No object schema here names a `type` in .openapi(): zod-to-openapi takes a
|
|
23
|
+
* `type` there for the whole schema and leaves out the properties it would
|
|
24
|
+
* have generated, so the spec listed no field of any sort, select or group
|
|
25
|
+
* by. A field's own `type` is kept, where it is a plain value's.
|
|
26
|
+
*/
|
|
27
|
+
export declare abstract class BaseSchema {
|
|
28
|
+
/**
|
|
29
|
+
* Generate a sort schema for a model
|
|
30
|
+
*/
|
|
31
|
+
protected static generateSortSchema<T>(data: {
|
|
32
|
+
model: T;
|
|
33
|
+
tableName?: string;
|
|
34
|
+
getSortableTypes: () => Array<any>;
|
|
35
|
+
getColumnsForSorting: (model: T) => Array<{
|
|
36
|
+
key: string;
|
|
37
|
+
type: any;
|
|
38
|
+
}>;
|
|
39
|
+
disableOpenApiSchema?: boolean;
|
|
40
|
+
}): BaseSchemaType;
|
|
41
|
+
/**
|
|
42
|
+
* Generate a select schema for a model
|
|
43
|
+
*/
|
|
44
|
+
protected static generateSelectSchema<T>(data: {
|
|
45
|
+
model: T;
|
|
46
|
+
tableName?: string;
|
|
47
|
+
getColumns: (model: T) => Array<{
|
|
48
|
+
key: string;
|
|
49
|
+
type?: any;
|
|
50
|
+
}>;
|
|
51
|
+
getSelectSchemaExample: (model: T) => SchemaExample;
|
|
52
|
+
allowNested?: boolean;
|
|
53
|
+
getNestedSchema?: (key: string, model: T) => ZodTypes.ZodTypeAny | null;
|
|
54
|
+
}): BaseSchemaType;
|
|
55
|
+
/**
|
|
56
|
+
* Generate a group by schema for a model
|
|
57
|
+
*/
|
|
58
|
+
protected static generateGroupBySchema<T>(data: {
|
|
59
|
+
model: T;
|
|
60
|
+
tableName?: string;
|
|
61
|
+
getColumns: (model: T) => Array<{
|
|
62
|
+
key: string;
|
|
63
|
+
type: any;
|
|
64
|
+
}>;
|
|
65
|
+
getGroupableTypes: () => Array<any>;
|
|
66
|
+
getGroupBySchemaExample: (model: T) => SchemaExample;
|
|
67
|
+
}): BaseSchemaType;
|
|
68
|
+
/**
|
|
69
|
+
* Generate a create schema for a model
|
|
70
|
+
*/
|
|
71
|
+
protected static generateCreateSchema<T>(data: {
|
|
72
|
+
model: T;
|
|
73
|
+
tableName?: string;
|
|
74
|
+
getColumns: (model: T) => Array<{
|
|
75
|
+
key: string;
|
|
76
|
+
type?: any;
|
|
77
|
+
required?: boolean;
|
|
78
|
+
isDefaultValueColumn?: boolean;
|
|
79
|
+
}>;
|
|
80
|
+
getZodTypeForColumn: (column: any) => ZodTypes.ZodTypeAny;
|
|
81
|
+
getCreateSchemaExample: (model: T) => SchemaExample;
|
|
82
|
+
excludedFields?: Array<string>;
|
|
83
|
+
}): BaseSchemaType;
|
|
84
|
+
/**
|
|
85
|
+
* Helper method to generate common example values for different data types
|
|
86
|
+
*/
|
|
87
|
+
protected static getCommonExampleValue(dataType: string, isSecondValue?: boolean): unknown;
|
|
88
|
+
/**
|
|
89
|
+
* Helper method to generate select schema examples
|
|
90
|
+
*/
|
|
91
|
+
protected static generateSelectSchemaExample<T>(data: {
|
|
92
|
+
model: T;
|
|
93
|
+
getColumns: (model: T) => Array<{
|
|
94
|
+
key: string;
|
|
95
|
+
type?: any;
|
|
96
|
+
}>;
|
|
97
|
+
commonFields?: Array<string>;
|
|
98
|
+
maxFields?: number;
|
|
99
|
+
priorityFieldTypes?: Array<any>;
|
|
100
|
+
}): SchemaExample;
|
|
101
|
+
/**
|
|
102
|
+
* Helper method to generate group by schema examples
|
|
103
|
+
*/
|
|
104
|
+
protected static generateGroupBySchemaExample<T>(data: {
|
|
105
|
+
model: T;
|
|
106
|
+
getColumns: (model: T) => Array<{
|
|
107
|
+
key: string;
|
|
108
|
+
type: any;
|
|
109
|
+
}>;
|
|
110
|
+
getGroupableTypes: () => Array<any>;
|
|
111
|
+
excludeFields?: Array<string>;
|
|
112
|
+
}): SchemaExample;
|
|
113
|
+
/**
|
|
114
|
+
* Helper method to conditionally apply OpenAPI schema
|
|
115
|
+
*/
|
|
116
|
+
protected static applyOpenApi<T extends ZodTypes.ZodTypeAny>(baseType: T, openApiConfig: any, disableOpenApiSchema?: boolean): T;
|
|
117
|
+
}
|
|
@@ -0,0 +1,117 @@
|
|
|
1
|
+
import { z as ZodTypes } from "zod";
|
|
2
|
+
import { ZodSchema } from "./Zod";
|
|
3
|
+
export type BaseSchemaType = ZodSchema;
|
|
4
|
+
export type SchemaExample = Record<string, unknown>;
|
|
5
|
+
export type ShapeRecord = Record<string, ZodTypes.ZodTypeAny>;
|
|
6
|
+
export type OperatorExample = {
|
|
7
|
+
properties: Record<string, {
|
|
8
|
+
type: string;
|
|
9
|
+
enum?: string[];
|
|
10
|
+
items?: {
|
|
11
|
+
type: string;
|
|
12
|
+
};
|
|
13
|
+
}>;
|
|
14
|
+
required: string[];
|
|
15
|
+
example: Record<string, unknown>;
|
|
16
|
+
};
|
|
17
|
+
export declare const ALWAYS_READABLE_COLUMNS: Array<string>;
|
|
18
|
+
/**
|
|
19
|
+
* Base class for schema generation with common functionality
|
|
20
|
+
* Both ModelSchema and AnalyticsModelSchema extend this class
|
|
21
|
+
*
|
|
22
|
+
* No object schema here names a `type` in .openapi(): zod-to-openapi takes a
|
|
23
|
+
* `type` there for the whole schema and leaves out the properties it would
|
|
24
|
+
* have generated, so the spec listed no field of any sort, select or group
|
|
25
|
+
* by. A field's own `type` is kept, where it is a plain value's.
|
|
26
|
+
*/
|
|
27
|
+
export declare abstract class BaseSchema {
|
|
28
|
+
/**
|
|
29
|
+
* Generate a sort schema for a model
|
|
30
|
+
*/
|
|
31
|
+
protected static generateSortSchema<T>(data: {
|
|
32
|
+
model: T;
|
|
33
|
+
tableName?: string;
|
|
34
|
+
getSortableTypes: () => Array<any>;
|
|
35
|
+
getColumnsForSorting: (model: T) => Array<{
|
|
36
|
+
key: string;
|
|
37
|
+
type: any;
|
|
38
|
+
}>;
|
|
39
|
+
disableOpenApiSchema?: boolean;
|
|
40
|
+
}): BaseSchemaType;
|
|
41
|
+
/**
|
|
42
|
+
* Generate a select schema for a model
|
|
43
|
+
*/
|
|
44
|
+
protected static generateSelectSchema<T>(data: {
|
|
45
|
+
model: T;
|
|
46
|
+
tableName?: string;
|
|
47
|
+
getColumns: (model: T) => Array<{
|
|
48
|
+
key: string;
|
|
49
|
+
type?: any;
|
|
50
|
+
}>;
|
|
51
|
+
getSelectSchemaExample: (model: T) => SchemaExample;
|
|
52
|
+
allowNested?: boolean;
|
|
53
|
+
getNestedSchema?: (key: string, model: T) => ZodTypes.ZodTypeAny | null;
|
|
54
|
+
}): BaseSchemaType;
|
|
55
|
+
/**
|
|
56
|
+
* Generate a group by schema for a model
|
|
57
|
+
*/
|
|
58
|
+
protected static generateGroupBySchema<T>(data: {
|
|
59
|
+
model: T;
|
|
60
|
+
tableName?: string;
|
|
61
|
+
getColumns: (model: T) => Array<{
|
|
62
|
+
key: string;
|
|
63
|
+
type: any;
|
|
64
|
+
}>;
|
|
65
|
+
getGroupableTypes: () => Array<any>;
|
|
66
|
+
getGroupBySchemaExample: (model: T) => SchemaExample;
|
|
67
|
+
}): BaseSchemaType;
|
|
68
|
+
/**
|
|
69
|
+
* Generate a create schema for a model
|
|
70
|
+
*/
|
|
71
|
+
protected static generateCreateSchema<T>(data: {
|
|
72
|
+
model: T;
|
|
73
|
+
tableName?: string;
|
|
74
|
+
getColumns: (model: T) => Array<{
|
|
75
|
+
key: string;
|
|
76
|
+
type?: any;
|
|
77
|
+
required?: boolean;
|
|
78
|
+
isDefaultValueColumn?: boolean;
|
|
79
|
+
}>;
|
|
80
|
+
getZodTypeForColumn: (column: any) => ZodTypes.ZodTypeAny;
|
|
81
|
+
getCreateSchemaExample: (model: T) => SchemaExample;
|
|
82
|
+
excludedFields?: Array<string>;
|
|
83
|
+
}): BaseSchemaType;
|
|
84
|
+
/**
|
|
85
|
+
* Helper method to generate common example values for different data types
|
|
86
|
+
*/
|
|
87
|
+
protected static getCommonExampleValue(dataType: string, isSecondValue?: boolean): unknown;
|
|
88
|
+
/**
|
|
89
|
+
* Helper method to generate select schema examples
|
|
90
|
+
*/
|
|
91
|
+
protected static generateSelectSchemaExample<T>(data: {
|
|
92
|
+
model: T;
|
|
93
|
+
getColumns: (model: T) => Array<{
|
|
94
|
+
key: string;
|
|
95
|
+
type?: any;
|
|
96
|
+
}>;
|
|
97
|
+
commonFields?: Array<string>;
|
|
98
|
+
maxFields?: number;
|
|
99
|
+
priorityFieldTypes?: Array<any>;
|
|
100
|
+
}): SchemaExample;
|
|
101
|
+
/**
|
|
102
|
+
* Helper method to generate group by schema examples
|
|
103
|
+
*/
|
|
104
|
+
protected static generateGroupBySchemaExample<T>(data: {
|
|
105
|
+
model: T;
|
|
106
|
+
getColumns: (model: T) => Array<{
|
|
107
|
+
key: string;
|
|
108
|
+
type: any;
|
|
109
|
+
}>;
|
|
110
|
+
getGroupableTypes: () => Array<any>;
|
|
111
|
+
excludeFields?: Array<string>;
|
|
112
|
+
}): SchemaExample;
|
|
113
|
+
/**
|
|
114
|
+
* Helper method to conditionally apply OpenAPI schema
|
|
115
|
+
*/
|
|
116
|
+
protected static applyOpenApi<T extends ZodTypes.ZodTypeAny>(baseType: T, openApiConfig: any, disableOpenApiSchema?: boolean): T;
|
|
117
|
+
}
|
|
@@ -0,0 +1,257 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.BaseSchema = exports.ALWAYS_READABLE_COLUMNS = void 0;
|
|
7
|
+
const Zod_1 = __importDefault(require("./Zod"));
|
|
8
|
+
const SortOrder_1 = __importDefault(require("../../Types/BaseDatabase/SortOrder"));
|
|
9
|
+
/*
|
|
10
|
+
* Columns a query, sort or select may name though no permission reads them:
|
|
11
|
+
* the API lets these through before it looks at a column's readers
|
|
12
|
+
* (ColumnPermission.getExcludedColumnNames, and ModelPermission's for
|
|
13
|
+
* telemetry). It refuses any other column nobody may read.
|
|
14
|
+
*/
|
|
15
|
+
exports.ALWAYS_READABLE_COLUMNS = [
|
|
16
|
+
"_id",
|
|
17
|
+
"createdAt",
|
|
18
|
+
"deletedAt",
|
|
19
|
+
"updatedAt",
|
|
20
|
+
"version",
|
|
21
|
+
];
|
|
22
|
+
/*
|
|
23
|
+
* ASC or DESC, as a sort field takes it. Published once, as SortOrder, which
|
|
24
|
+
* every sort field refers to: spelled out on each of the 6,700 sort fields it
|
|
25
|
+
* was 0.5 MB of the spec, and a client generated from it had a type for each.
|
|
26
|
+
*/
|
|
27
|
+
const SORT_ORDER_SCHEMA = Zod_1.default
|
|
28
|
+
.enum([SortOrder_1.default.Ascending, SortOrder_1.default.Descending])
|
|
29
|
+
.openapi("SortOrder", {
|
|
30
|
+
description: "The order of a sort: ASC (ascending) or DESC (descending).",
|
|
31
|
+
example: SortOrder_1.default.Descending,
|
|
32
|
+
});
|
|
33
|
+
/**
|
|
34
|
+
* Base class for schema generation with common functionality
|
|
35
|
+
* Both ModelSchema and AnalyticsModelSchema extend this class
|
|
36
|
+
*
|
|
37
|
+
* No object schema here names a `type` in .openapi(): zod-to-openapi takes a
|
|
38
|
+
* `type` there for the whole schema and leaves out the properties it would
|
|
39
|
+
* have generated, so the spec listed no field of any sort, select or group
|
|
40
|
+
* by. A field's own `type` is kept, where it is a plain value's.
|
|
41
|
+
*/
|
|
42
|
+
class BaseSchema {
|
|
43
|
+
/**
|
|
44
|
+
* Generate a sort schema for a model
|
|
45
|
+
*/
|
|
46
|
+
static generateSortSchema(data) {
|
|
47
|
+
const shape = {};
|
|
48
|
+
const columns = data.getColumnsForSorting(data.model);
|
|
49
|
+
for (const column of columns) {
|
|
50
|
+
const key = column.key;
|
|
51
|
+
const isSortable = data.getSortableTypes().includes(column.type);
|
|
52
|
+
if (!isSortable) {
|
|
53
|
+
continue;
|
|
54
|
+
}
|
|
55
|
+
shape[key] = SORT_ORDER_SCHEMA.optional();
|
|
56
|
+
}
|
|
57
|
+
return this.applyOpenApi(Zod_1.default.object(shape), {
|
|
58
|
+
description: `Sort schema for ${data.tableName || "model"}. Only sortable fields are included.`,
|
|
59
|
+
example: shape["createdAt"] ? { createdAt: SortOrder_1.default.Descending } : {},
|
|
60
|
+
additionalProperties: false,
|
|
61
|
+
}, data.disableOpenApiSchema || false);
|
|
62
|
+
}
|
|
63
|
+
/**
|
|
64
|
+
* Generate a select schema for a model
|
|
65
|
+
*/
|
|
66
|
+
static generateSelectSchema(data) {
|
|
67
|
+
const shape = {};
|
|
68
|
+
const columns = data.getColumns(data.model);
|
|
69
|
+
for (const column of columns) {
|
|
70
|
+
const key = column.key;
|
|
71
|
+
// Handle nested schemas if allowed and available
|
|
72
|
+
if (data.allowNested && data.getNestedSchema) {
|
|
73
|
+
const nestedSchema = data.getNestedSchema(key, data.model);
|
|
74
|
+
/*
|
|
75
|
+
* The nested schema says what it selects. Metadata given here would
|
|
76
|
+
* wrap a schema the spec publishes on its own (a $ref) in an allOf.
|
|
77
|
+
*/
|
|
78
|
+
if (nestedSchema) {
|
|
79
|
+
shape[key] = nestedSchema.optional();
|
|
80
|
+
continue;
|
|
81
|
+
}
|
|
82
|
+
}
|
|
83
|
+
// What it selects, the select schema's own description says.
|
|
84
|
+
shape[key] = Zod_1.default.boolean().optional();
|
|
85
|
+
}
|
|
86
|
+
return Zod_1.default.object(shape).openapi({
|
|
87
|
+
description: `Select schema for ${data.tableName || "model"}. Set fields to true to include them in the response.`,
|
|
88
|
+
example: data.getSelectSchemaExample(data.model),
|
|
89
|
+
additionalProperties: false,
|
|
90
|
+
});
|
|
91
|
+
}
|
|
92
|
+
/**
|
|
93
|
+
* Generate a group by schema for a model
|
|
94
|
+
*/
|
|
95
|
+
static generateGroupBySchema(data) {
|
|
96
|
+
const shape = {};
|
|
97
|
+
const columns = data.getColumns(data.model);
|
|
98
|
+
for (const column of columns) {
|
|
99
|
+
const key = column.key;
|
|
100
|
+
const isGroupable = data
|
|
101
|
+
.getGroupableTypes()
|
|
102
|
+
.includes(column.type);
|
|
103
|
+
if (!isGroupable) {
|
|
104
|
+
continue;
|
|
105
|
+
}
|
|
106
|
+
shape[key] = Zod_1.default
|
|
107
|
+
.literal(true)
|
|
108
|
+
.optional()
|
|
109
|
+
.openapi({
|
|
110
|
+
type: "boolean",
|
|
111
|
+
description: `Group by ${key} field. Only one field can be selected for grouping.`,
|
|
112
|
+
example: true,
|
|
113
|
+
});
|
|
114
|
+
}
|
|
115
|
+
return Zod_1.default.object(shape).openapi({
|
|
116
|
+
description: `Group by schema for ${data.tableName || "model"}. Only one field can be set to true for grouping.`,
|
|
117
|
+
example: data.getGroupBySchemaExample(data.model),
|
|
118
|
+
additionalProperties: false,
|
|
119
|
+
});
|
|
120
|
+
}
|
|
121
|
+
/**
|
|
122
|
+
* Generate a create schema for a model
|
|
123
|
+
*/
|
|
124
|
+
static generateCreateSchema(data) {
|
|
125
|
+
const shape = {};
|
|
126
|
+
const columns = data.getColumns(data.model);
|
|
127
|
+
const excludedFields = data.excludedFields || [
|
|
128
|
+
"_id",
|
|
129
|
+
"createdAt",
|
|
130
|
+
"updatedAt",
|
|
131
|
+
];
|
|
132
|
+
for (const column of columns) {
|
|
133
|
+
const key = column.key;
|
|
134
|
+
if (excludedFields.includes(key)) {
|
|
135
|
+
continue;
|
|
136
|
+
}
|
|
137
|
+
// Skip default value columns in create schema
|
|
138
|
+
if (column.isDefaultValueColumn) {
|
|
139
|
+
continue;
|
|
140
|
+
}
|
|
141
|
+
const zodType = data.getZodTypeForColumn(column);
|
|
142
|
+
if (column.required) {
|
|
143
|
+
shape[key] = zodType;
|
|
144
|
+
}
|
|
145
|
+
else {
|
|
146
|
+
shape[key] = zodType.optional();
|
|
147
|
+
}
|
|
148
|
+
}
|
|
149
|
+
return Zod_1.default.object(shape).openapi({
|
|
150
|
+
description: `Create schema for ${data.tableName || "model"}`,
|
|
151
|
+
example: data.getCreateSchemaExample(data.model),
|
|
152
|
+
additionalProperties: false,
|
|
153
|
+
});
|
|
154
|
+
}
|
|
155
|
+
/**
|
|
156
|
+
* Helper method to generate common example values for different data types
|
|
157
|
+
*/
|
|
158
|
+
static getCommonExampleValue(dataType, isSecondValue = false) {
|
|
159
|
+
switch (dataType.toLowerCase()) {
|
|
160
|
+
case "objectid":
|
|
161
|
+
case "id":
|
|
162
|
+
return "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx";
|
|
163
|
+
case "text":
|
|
164
|
+
case "string":
|
|
165
|
+
return isSecondValue ? "example_text_2" : "example_text_1";
|
|
166
|
+
case "email":
|
|
167
|
+
return isSecondValue ? "user2@example.com" : "user@example.com";
|
|
168
|
+
case "number":
|
|
169
|
+
case "integer":
|
|
170
|
+
return isSecondValue ? 100 : 42;
|
|
171
|
+
case "date":
|
|
172
|
+
case "datetime":
|
|
173
|
+
return isSecondValue
|
|
174
|
+
? "2023-12-31T23:59:59.000Z"
|
|
175
|
+
: "2023-01-15T12:30:00.000Z";
|
|
176
|
+
case "boolean":
|
|
177
|
+
return !isSecondValue;
|
|
178
|
+
case "json":
|
|
179
|
+
case "object":
|
|
180
|
+
return isSecondValue ? { key2: "value2" } : { key: "value" };
|
|
181
|
+
case "array":
|
|
182
|
+
return isSecondValue ? ["item3", "item4"] : ["item1", "item2"];
|
|
183
|
+
default:
|
|
184
|
+
return isSecondValue ? "example_value_2" : "example_value_1";
|
|
185
|
+
}
|
|
186
|
+
}
|
|
187
|
+
/**
|
|
188
|
+
* Helper method to generate select schema examples
|
|
189
|
+
*/
|
|
190
|
+
static generateSelectSchemaExample(data) {
|
|
191
|
+
const columns = data.getColumns(data.model);
|
|
192
|
+
const example = {};
|
|
193
|
+
const commonFields = data.commonFields || [
|
|
194
|
+
"_id",
|
|
195
|
+
"createdAt",
|
|
196
|
+
"updatedAt",
|
|
197
|
+
];
|
|
198
|
+
const maxFields = data.maxFields || 5;
|
|
199
|
+
// Add common fields that exist
|
|
200
|
+
for (const field of commonFields) {
|
|
201
|
+
const hasField = columns.some((col) => {
|
|
202
|
+
return col.key === field;
|
|
203
|
+
});
|
|
204
|
+
if (hasField) {
|
|
205
|
+
example[field] = true;
|
|
206
|
+
}
|
|
207
|
+
}
|
|
208
|
+
// Add priority fields if specified
|
|
209
|
+
let fieldCount = 0;
|
|
210
|
+
if (data.priorityFieldTypes) {
|
|
211
|
+
for (const column of columns) {
|
|
212
|
+
if (fieldCount >= maxFields) {
|
|
213
|
+
break;
|
|
214
|
+
}
|
|
215
|
+
if (!commonFields.includes(column.key) &&
|
|
216
|
+
column.type &&
|
|
217
|
+
data.priorityFieldTypes.includes(column.type)) {
|
|
218
|
+
example[column.key] = true;
|
|
219
|
+
fieldCount++;
|
|
220
|
+
}
|
|
221
|
+
}
|
|
222
|
+
}
|
|
223
|
+
return example;
|
|
224
|
+
}
|
|
225
|
+
/**
|
|
226
|
+
* Helper method to generate group by schema examples
|
|
227
|
+
*/
|
|
228
|
+
static generateGroupBySchemaExample(data) {
|
|
229
|
+
const columns = data.getColumns(data.model);
|
|
230
|
+
const excludeFields = data.excludeFields || [
|
|
231
|
+
"_id",
|
|
232
|
+
"createdAt",
|
|
233
|
+
"updatedAt",
|
|
234
|
+
];
|
|
235
|
+
// Find first suitable field for grouping
|
|
236
|
+
for (const column of columns) {
|
|
237
|
+
const isGroupable = data
|
|
238
|
+
.getGroupableTypes()
|
|
239
|
+
.includes(column.type);
|
|
240
|
+
if (isGroupable && !excludeFields.includes(column.key)) {
|
|
241
|
+
return { [column.key]: true };
|
|
242
|
+
}
|
|
243
|
+
}
|
|
244
|
+
// Fallback
|
|
245
|
+
return { createdAt: true };
|
|
246
|
+
}
|
|
247
|
+
/**
|
|
248
|
+
* Helper method to conditionally apply OpenAPI schema
|
|
249
|
+
*/
|
|
250
|
+
static applyOpenApi(baseType, openApiConfig, disableOpenApiSchema = false) {
|
|
251
|
+
if (disableOpenApiSchema) {
|
|
252
|
+
return baseType;
|
|
253
|
+
}
|
|
254
|
+
return baseType.openapi(openApiConfig);
|
|
255
|
+
}
|
|
256
|
+
}
|
|
257
|
+
exports.BaseSchema = BaseSchema;
|
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
import { ZodSchema } from "./Zod.mjs";
|
|
2
|
+
import TableColumnType from "../../Types/Database/TableColumnType.mjs";
|
|
3
|
+
import { TableColumnMetadata } from "../../Types/Database/TableColumn.mjs";
|
|
4
|
+
import Dictionary from "../../Types/Dictionary.mjs";
|
|
5
|
+
import DatabaseBaseModel from "../../Models/DatabaseModels/DatabaseBaseModel/DatabaseBaseModel.mjs";
|
|
6
|
+
import { z as ZodTypes } from "zod";
|
|
7
|
+
import { BaseSchema } from "./BaseSchema.mjs";
|
|
8
|
+
export type ModelSchemaType = ZodSchema;
|
|
9
|
+
export interface ModelRelationReference {
|
|
10
|
+
tag: string;
|
|
11
|
+
tableName: string;
|
|
12
|
+
}
|
|
13
|
+
export declare class ModelSchema extends BaseSchema {
|
|
14
|
+
/**
|
|
15
|
+
* Format permissions array into a human-readable string for OpenAPI documentation
|
|
16
|
+
*/
|
|
17
|
+
private static formatPermissionsForSchema;
|
|
18
|
+
/**
|
|
19
|
+
* Get permissions description for a column to add to OpenAPI schema
|
|
20
|
+
*/
|
|
21
|
+
private static getColumnPermissionsDescription;
|
|
22
|
+
static describeColumnWithPermissions(description: string, permissionsDescription: string): string;
|
|
23
|
+
static getAllowedValues(column: TableColumnMetadata): Array<string> | undefined;
|
|
24
|
+
static getTextExample(column: TableColumnMetadata, placeholder: string): string;
|
|
25
|
+
private static getTextOpenApi;
|
|
26
|
+
static getModelSchema(data: {
|
|
27
|
+
modelType: new () => DatabaseBaseModel;
|
|
28
|
+
}): ModelSchemaType;
|
|
29
|
+
private static annotateColumn;
|
|
30
|
+
static getRelationReferences(columns: Dictionary<TableColumnMetadata>): Dictionary<ModelRelationReference>;
|
|
31
|
+
static getSortableTypes(): Array<TableColumnType>;
|
|
32
|
+
static getQueryModelSchema(data: {
|
|
33
|
+
modelType: new () => DatabaseBaseModel;
|
|
34
|
+
disableOpenApiSchema?: boolean;
|
|
35
|
+
}): ModelSchemaType;
|
|
36
|
+
static getValidOperatorsForColumnType(columnType: TableColumnType): Array<string>;
|
|
37
|
+
static getQueryFilterSchema(columnType: TableColumnType): ZodTypes.ZodTypeAny;
|
|
38
|
+
private static getValueOrOperatorSchema;
|
|
39
|
+
private static getOperatorSchema;
|
|
40
|
+
private static getQueryValueSchema;
|
|
41
|
+
private static getQueryFilterDescription;
|
|
42
|
+
private static getQueryFilterExample;
|
|
43
|
+
private static getColumnTypeKey;
|
|
44
|
+
private static getReadableColumns;
|
|
45
|
+
static getSortModelSchema(data: {
|
|
46
|
+
modelType: new () => DatabaseBaseModel;
|
|
47
|
+
disableOpenApiSchema?: boolean;
|
|
48
|
+
}): ModelSchemaType;
|
|
49
|
+
static getSelectModelSchema(data: {
|
|
50
|
+
modelType: new () => DatabaseBaseModel;
|
|
51
|
+
}): ModelSchemaType;
|
|
52
|
+
static getRelationSelectSchema(modelType: new () => DatabaseBaseModel): ModelSchemaType;
|
|
53
|
+
static getGroupByModelSchema(data: {
|
|
54
|
+
modelType: new () => DatabaseBaseModel;
|
|
55
|
+
}): ModelSchemaType;
|
|
56
|
+
private static getQuerySchemaExample;
|
|
57
|
+
private static getSelectSchemaExample;
|
|
58
|
+
private static buildModelSchema;
|
|
59
|
+
private static getZodTypeForColumn;
|
|
60
|
+
static isSecretColumn(column: TableColumnMetadata): boolean;
|
|
61
|
+
private static annotateSecret;
|
|
62
|
+
static getCreateModelSchema(data: {
|
|
63
|
+
modelType: new () => DatabaseBaseModel;
|
|
64
|
+
disableOpenApiSchema?: boolean;
|
|
65
|
+
}): ModelSchemaType;
|
|
66
|
+
static getReadModelSchema(data: {
|
|
67
|
+
modelType: new () => DatabaseBaseModel;
|
|
68
|
+
}): ModelSchemaType;
|
|
69
|
+
static getUpdateModelSchema(data: {
|
|
70
|
+
modelType: new () => DatabaseBaseModel;
|
|
71
|
+
disableOpenApiSchema?: boolean;
|
|
72
|
+
}): ModelSchemaType;
|
|
73
|
+
static getDeleteModelSchema(data: {
|
|
74
|
+
modelType: new () => DatabaseBaseModel;
|
|
75
|
+
}): ModelSchemaType;
|
|
76
|
+
private static generateDynamicExample;
|
|
77
|
+
private static generateExampleValueForColumn;
|
|
78
|
+
private static getShortTextExample;
|
|
79
|
+
private static getLongTextExample;
|
|
80
|
+
}
|
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
import { ZodSchema } from "./Zod";
|
|
2
|
+
import TableColumnType from "../../Types/Database/TableColumnType";
|
|
3
|
+
import { TableColumnMetadata } from "../../Types/Database/TableColumn";
|
|
4
|
+
import Dictionary from "../../Types/Dictionary";
|
|
5
|
+
import DatabaseBaseModel from "../../Models/DatabaseModels/DatabaseBaseModel/DatabaseBaseModel";
|
|
6
|
+
import { z as ZodTypes } from "zod";
|
|
7
|
+
import { BaseSchema } from "./BaseSchema";
|
|
8
|
+
export type ModelSchemaType = ZodSchema;
|
|
9
|
+
export interface ModelRelationReference {
|
|
10
|
+
tag: string;
|
|
11
|
+
tableName: string;
|
|
12
|
+
}
|
|
13
|
+
export declare class ModelSchema extends BaseSchema {
|
|
14
|
+
/**
|
|
15
|
+
* Format permissions array into a human-readable string for OpenAPI documentation
|
|
16
|
+
*/
|
|
17
|
+
private static formatPermissionsForSchema;
|
|
18
|
+
/**
|
|
19
|
+
* Get permissions description for a column to add to OpenAPI schema
|
|
20
|
+
*/
|
|
21
|
+
private static getColumnPermissionsDescription;
|
|
22
|
+
static describeColumnWithPermissions(description: string, permissionsDescription: string): string;
|
|
23
|
+
static getAllowedValues(column: TableColumnMetadata): Array<string> | undefined;
|
|
24
|
+
static getTextExample(column: TableColumnMetadata, placeholder: string): string;
|
|
25
|
+
private static getTextOpenApi;
|
|
26
|
+
static getModelSchema(data: {
|
|
27
|
+
modelType: new () => DatabaseBaseModel;
|
|
28
|
+
}): ModelSchemaType;
|
|
29
|
+
private static annotateColumn;
|
|
30
|
+
static getRelationReferences(columns: Dictionary<TableColumnMetadata>): Dictionary<ModelRelationReference>;
|
|
31
|
+
static getSortableTypes(): Array<TableColumnType>;
|
|
32
|
+
static getQueryModelSchema(data: {
|
|
33
|
+
modelType: new () => DatabaseBaseModel;
|
|
34
|
+
disableOpenApiSchema?: boolean;
|
|
35
|
+
}): ModelSchemaType;
|
|
36
|
+
static getValidOperatorsForColumnType(columnType: TableColumnType): Array<string>;
|
|
37
|
+
static getQueryFilterSchema(columnType: TableColumnType): ZodTypes.ZodTypeAny;
|
|
38
|
+
private static getValueOrOperatorSchema;
|
|
39
|
+
private static getOperatorSchema;
|
|
40
|
+
private static getQueryValueSchema;
|
|
41
|
+
private static getQueryFilterDescription;
|
|
42
|
+
private static getQueryFilterExample;
|
|
43
|
+
private static getColumnTypeKey;
|
|
44
|
+
private static getReadableColumns;
|
|
45
|
+
static getSortModelSchema(data: {
|
|
46
|
+
modelType: new () => DatabaseBaseModel;
|
|
47
|
+
disableOpenApiSchema?: boolean;
|
|
48
|
+
}): ModelSchemaType;
|
|
49
|
+
static getSelectModelSchema(data: {
|
|
50
|
+
modelType: new () => DatabaseBaseModel;
|
|
51
|
+
}): ModelSchemaType;
|
|
52
|
+
static getRelationSelectSchema(modelType: new () => DatabaseBaseModel): ModelSchemaType;
|
|
53
|
+
static getGroupByModelSchema(data: {
|
|
54
|
+
modelType: new () => DatabaseBaseModel;
|
|
55
|
+
}): ModelSchemaType;
|
|
56
|
+
private static getQuerySchemaExample;
|
|
57
|
+
private static getSelectSchemaExample;
|
|
58
|
+
private static buildModelSchema;
|
|
59
|
+
private static getZodTypeForColumn;
|
|
60
|
+
static isSecretColumn(column: TableColumnMetadata): boolean;
|
|
61
|
+
private static annotateSecret;
|
|
62
|
+
static getCreateModelSchema(data: {
|
|
63
|
+
modelType: new () => DatabaseBaseModel;
|
|
64
|
+
disableOpenApiSchema?: boolean;
|
|
65
|
+
}): ModelSchemaType;
|
|
66
|
+
static getReadModelSchema(data: {
|
|
67
|
+
modelType: new () => DatabaseBaseModel;
|
|
68
|
+
}): ModelSchemaType;
|
|
69
|
+
static getUpdateModelSchema(data: {
|
|
70
|
+
modelType: new () => DatabaseBaseModel;
|
|
71
|
+
disableOpenApiSchema?: boolean;
|
|
72
|
+
}): ModelSchemaType;
|
|
73
|
+
static getDeleteModelSchema(data: {
|
|
74
|
+
modelType: new () => DatabaseBaseModel;
|
|
75
|
+
}): ModelSchemaType;
|
|
76
|
+
private static generateDynamicExample;
|
|
77
|
+
private static generateExampleValueForColumn;
|
|
78
|
+
private static getShortTextExample;
|
|
79
|
+
private static getLongTextExample;
|
|
80
|
+
}
|