@objectstack/spec 0.1.0 → 0.1.2
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/README.md +134 -121
- package/dist/ai/agent.zod.d.ts +164 -0
- package/dist/ai/agent.zod.d.ts.map +1 -0
- package/dist/ai/agent.zod.js +51 -0
- package/dist/api/contract.zod.d.ts +1733 -0
- package/dist/api/contract.zod.d.ts.map +1 -0
- package/dist/api/contract.zod.js +138 -0
- package/dist/data/dataset.zod.d.ts +60 -0
- package/dist/data/dataset.zod.d.ts.map +1 -0
- package/dist/data/dataset.zod.js +54 -0
- package/dist/data/field.zod.d.ts +1808 -0
- package/dist/data/field.zod.d.ts.map +1 -0
- package/dist/data/field.zod.js +222 -0
- package/dist/data/flow.zod.d.ts +242 -0
- package/dist/data/flow.zod.d.ts.map +1 -0
- package/dist/data/flow.zod.js +77 -0
- package/dist/data/mapping.zod.d.ts +470 -0
- package/dist/data/mapping.zod.d.ts.map +1 -0
- package/dist/data/mapping.zod.js +65 -0
- package/dist/data/object.zod.d.ts +844 -0
- package/dist/data/object.zod.d.ts.map +1 -0
- package/dist/data/object.zod.js +81 -0
- package/dist/data/permission.zod.d.ts +163 -0
- package/dist/data/permission.zod.d.ts.map +1 -0
- package/dist/data/permission.zod.js +62 -0
- package/dist/data/query.zod.d.ts +438 -0
- package/dist/data/query.zod.d.ts.map +1 -0
- package/dist/data/query.zod.js +147 -0
- package/dist/data/sharing.zod.d.ts +63 -0
- package/dist/data/sharing.zod.d.ts.map +1 -0
- package/dist/data/sharing.zod.js +57 -0
- package/dist/data/trigger.zod.d.ts +354 -0
- package/dist/data/trigger.zod.d.ts.map +1 -0
- package/dist/data/trigger.zod.js +195 -0
- package/dist/data/validation.zod.d.ts +276 -0
- package/dist/data/validation.zod.d.ts.map +1 -0
- package/dist/data/validation.zod.js +105 -0
- package/dist/data/workflow.zod.d.ts +195 -0
- package/dist/data/workflow.zod.d.ts.map +1 -0
- package/dist/data/workflow.zod.js +64 -0
- package/dist/index.d.ts +41 -5
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +62 -5
- package/dist/system/api.zod.d.ts +294 -0
- package/dist/system/api.zod.d.ts.map +1 -0
- package/dist/system/api.zod.js +56 -0
- package/dist/system/constants/index.d.ts +11 -0
- package/dist/system/constants/index.d.ts.map +1 -0
- package/dist/system/constants/index.js +26 -0
- package/dist/system/constants/paths.d.ts +71 -0
- package/dist/system/constants/paths.d.ts.map +1 -0
- package/dist/system/constants/paths.js +65 -0
- package/dist/system/datasource.zod.d.ts +210 -0
- package/dist/system/datasource.zod.d.ts.map +1 -0
- package/dist/system/datasource.zod.js +90 -0
- package/dist/system/discovery.zod.d.ts +174 -0
- package/dist/system/discovery.zod.d.ts.map +1 -0
- package/dist/system/discovery.zod.js +53 -0
- package/dist/system/driver.zod.d.ts +1525 -0
- package/dist/system/driver.zod.d.ts.map +1 -0
- package/dist/system/driver.zod.js +290 -0
- package/dist/system/identity.zod.d.ts +204 -0
- package/dist/system/identity.zod.d.ts.map +1 -0
- package/dist/system/identity.zod.js +68 -0
- package/dist/system/license.zod.d.ts +110 -0
- package/dist/system/license.zod.d.ts.map +1 -0
- package/dist/system/license.zod.js +63 -0
- package/dist/system/manifest.zod.d.ts +397 -0
- package/dist/system/manifest.zod.d.ts.map +1 -0
- package/dist/system/manifest.zod.js +142 -0
- package/dist/system/plugin.zod.d.ts +3516 -0
- package/dist/system/plugin.zod.d.ts.map +1 -0
- package/dist/system/plugin.zod.js +226 -0
- package/dist/system/policy.zod.d.ts +209 -0
- package/dist/system/policy.zod.d.ts.map +1 -0
- package/dist/system/policy.zod.js +54 -0
- package/dist/system/role.zod.d.ts +34 -0
- package/dist/system/role.zod.d.ts.map +1 -0
- package/dist/system/role.zod.js +25 -0
- package/dist/system/territory.zod.d.ts +91 -0
- package/dist/system/territory.zod.d.ts.map +1 -0
- package/dist/system/territory.zod.js +64 -0
- package/dist/system/translation.zod.d.ts +171 -0
- package/dist/system/translation.zod.d.ts.map +1 -0
- package/dist/system/translation.zod.js +34 -0
- package/dist/system/types/index.d.ts +7 -0
- package/dist/system/types/index.d.ts.map +1 -0
- package/dist/system/types/index.js +22 -0
- package/dist/system/types/plugin.d.ts +113 -0
- package/dist/system/types/plugin.d.ts.map +1 -0
- package/dist/system/types/plugin.js +6 -0
- package/dist/system/webhook.zod.d.ts +106 -0
- package/dist/system/webhook.zod.d.ts.map +1 -0
- package/dist/system/webhook.zod.js +56 -0
- package/dist/ui/action.zod.d.ts +155 -0
- package/dist/ui/action.zod.d.ts.map +1 -0
- package/dist/ui/action.zod.js +54 -0
- package/dist/ui/app.zod.d.ts +405 -0
- package/dist/ui/app.zod.d.ts.map +1 -0
- package/dist/ui/app.zod.js +138 -0
- package/dist/ui/dashboard.zod.d.ts +213 -0
- package/dist/ui/dashboard.zod.d.ts.map +1 -0
- package/dist/ui/dashboard.zod.js +72 -0
- package/dist/ui/page.zod.d.ts +187 -0
- package/dist/ui/page.zod.d.ts.map +1 -0
- package/dist/ui/page.zod.js +48 -0
- package/dist/ui/report.zod.d.ts +233 -0
- package/dist/ui/report.zod.d.ts.map +1 -0
- package/dist/ui/report.zod.js +74 -0
- package/dist/ui/theme.zod.d.ts +1221 -0
- package/dist/ui/theme.zod.d.ts.map +1 -0
- package/dist/ui/theme.zod.js +202 -0
- package/dist/ui/view.zod.d.ts +887 -0
- package/dist/ui/view.zod.d.ts.map +1 -0
- package/dist/ui/view.zod.js +83 -0
- package/dist/ui/widget.zod.d.ts +350 -0
- package/dist/ui/widget.zod.d.ts.map +1 -0
- package/dist/ui/widget.zod.js +66 -0
- package/json-schema/AIKnowledge.json +30 -0
- package/json-schema/AIModelConfig.json +41 -0
- package/json-schema/AITool.json +33 -0
- package/json-schema/Action.json +162 -0
- package/json-schema/ActionParam.json +82 -0
- package/json-schema/Address.json +40 -0
- package/json-schema/Agent.json +140 -0
- package/json-schema/AggregationFunction.json +19 -0
- package/json-schema/AggregationNode.json +42 -0
- package/json-schema/Animation.json +56 -0
- package/json-schema/ApiCapabilities.json +28 -0
- package/json-schema/ApiEndpoint.json +162 -0
- package/json-schema/ApiError.json +27 -0
- package/json-schema/ApiMapping.json +28 -0
- package/json-schema/ApiRoutes.json +41 -0
- package/json-schema/App.json +297 -0
- package/json-schema/AppBranding.json +24 -0
- package/json-schema/AsyncValidation.json +70 -0
- package/json-schema/AuditPolicy.json +31 -0
- package/json-schema/AuthProtocol.json +17 -0
- package/json-schema/AuthProvider.json +171 -0
- package/json-schema/BaseResponse.json +63 -0
- package/json-schema/BorderRadius.json +44 -0
- package/json-schema/Breakpoints.json +36 -0
- package/json-schema/BulkRequest.json +29 -0
- package/json-schema/BulkResponse.json +108 -0
- package/json-schema/CalendarConfig.json +28 -0
- package/json-schema/ChartType.json +19 -0
- package/json-schema/ColorPalette.json +83 -0
- package/json-schema/ConditionalValidation.json +793 -0
- package/json-schema/CreateRequest.json +20 -0
- package/json-schema/CrossFieldValidation.json +56 -0
- package/json-schema/CustomValidator.json +57 -0
- package/json-schema/Dashboard.json +117 -0
- package/json-schema/DashboardNavItem.json +42 -0
- package/json-schema/DashboardWidget.json +89 -0
- package/json-schema/Dataset.json +63 -0
- package/json-schema/DatasetMode.json +16 -0
- package/json-schema/Datasource.json +75 -0
- package/json-schema/DatasourceCapabilities.json +36 -0
- package/json-schema/DeleteResponse.json +68 -0
- package/json-schema/Discovery.json +114 -0
- package/json-schema/DriverCapabilities.json +39 -0
- package/json-schema/DriverDefinition.json +66 -0
- package/json-schema/DriverInterface.json +58 -0
- package/json-schema/DriverOptions.json +23 -0
- package/json-schema/DriverType.json +10 -0
- package/json-schema/EmailAlertAction.json +37 -0
- package/json-schema/ExportRequest.json +786 -0
- package/json-schema/Feature.json +51 -0
- package/json-schema/Field.json +290 -0
- package/json-schema/FieldMapping.json +83 -0
- package/json-schema/FieldNode.json +32 -0
- package/json-schema/FieldPermission.json +22 -0
- package/json-schema/FieldType.json +42 -0
- package/json-schema/FieldUpdateAction.json +32 -0
- package/json-schema/FieldWidgetProps.json +327 -0
- package/json-schema/FilterNode.json +52 -0
- package/json-schema/FilterOperator.json +26 -0
- package/json-schema/Flow.json +186 -0
- package/json-schema/FlowEdge.json +37 -0
- package/json-schema/FlowNode.json +65 -0
- package/json-schema/FlowNodeAction.json +24 -0
- package/json-schema/FlowVariable.json +34 -0
- package/json-schema/FormSection.json +42 -0
- package/json-schema/FormView.json +99 -0
- package/json-schema/FormatValidation.json +59 -0
- package/json-schema/GanttConfig.json +32 -0
- package/json-schema/GroupNavItem.json +42 -0
- package/json-schema/HttpMethod.json +16 -0
- package/json-schema/I18nContext.json +12 -0
- package/json-schema/Index.json +30 -0
- package/json-schema/JoinNode.json +455 -0
- package/json-schema/JoinType.json +15 -0
- package/json-schema/KanbanConfig.json +31 -0
- package/json-schema/LDAPConfig.json +39 -0
- package/json-schema/License.json +57 -0
- package/json-schema/ListRecordResponse.json +103 -0
- package/json-schema/ListView.json +153 -0
- package/json-schema/Locale.json +10 -0
- package/json-schema/LocationCoordinates.json +36 -0
- package/json-schema/Logger.json +25 -0
- package/json-schema/LogicOperator.json +14 -0
- package/json-schema/Manifest.json +315 -0
- package/json-schema/Mapping.json +598 -0
- package/json-schema/MenuItem.json +28 -0
- package/json-schema/MetricType.json +14 -0
- package/json-schema/ModificationResult.json +46 -0
- package/json-schema/NavigationItem.json +214 -0
- package/json-schema/NetworkPolicy.json +31 -0
- package/json-schema/OIDCConfig.json +46 -0
- package/json-schema/OWDModel.json +14 -0
- package/json-schema/Object.json +428 -0
- package/json-schema/ObjectCapabilities.json +62 -0
- package/json-schema/ObjectNavItem.json +46 -0
- package/json-schema/ObjectPermission.json +42 -0
- package/json-schema/ObjectQLClient.json +12 -0
- package/json-schema/Page.json +117 -0
- package/json-schema/PageComponent.json +36 -0
- package/json-schema/PageNavItem.json +47 -0
- package/json-schema/PageRegion.json +63 -0
- package/json-schema/PasswordPolicy.json +41 -0
- package/json-schema/PermissionSet.json +96 -0
- package/json-schema/Plan.json +53 -0
- package/json-schema/Plugin.json +20 -0
- package/json-schema/PluginContext.json +91 -0
- package/json-schema/PluginLifecycle.json +11 -0
- package/json-schema/Policy.json +138 -0
- package/json-schema/Query.json +456 -0
- package/json-schema/RateLimit.json +26 -0
- package/json-schema/RecordData.json +11 -0
- package/json-schema/Report.json +219 -0
- package/json-schema/ReportChart.json +45 -0
- package/json-schema/ReportColumn.json +35 -0
- package/json-schema/ReportGrouping.json +38 -0
- package/json-schema/ReportType.json +15 -0
- package/json-schema/Role.json +32 -0
- package/json-schema/Router.json +12 -0
- package/json-schema/SAMLConfig.json +44 -0
- package/json-schema/Scheduler.json +12 -0
- package/json-schema/ScopedStorage.json +12 -0
- package/json-schema/ScriptValidation.json +48 -0
- package/json-schema/SelectOption.json +32 -0
- package/json-schema/SessionPolicy.json +27 -0
- package/json-schema/Shadow.json +44 -0
- package/json-schema/SharingLevel.json +13 -0
- package/json-schema/SharingRule.json +58 -0
- package/json-schema/SharingRuleType.json +15 -0
- package/json-schema/SingleRecordResponse.json +69 -0
- package/json-schema/SortNode.json +26 -0
- package/json-schema/Spacing.json +64 -0
- package/json-schema/StateMachineValidation.json +59 -0
- package/json-schema/SystemAPI.json +12 -0
- package/json-schema/Territory.json +77 -0
- package/json-schema/TerritoryModel.json +34 -0
- package/json-schema/TerritoryType.json +15 -0
- package/json-schema/Theme.json +543 -0
- package/json-schema/ThemeMode.json +14 -0
- package/json-schema/TransformType.json +18 -0
- package/json-schema/TranslationBundle.json +78 -0
- package/json-schema/TranslationData.json +75 -0
- package/json-schema/Trigger.json +73 -0
- package/json-schema/TriggerAction.json +14 -0
- package/json-schema/TriggerContext.json +61 -0
- package/json-schema/TriggerTiming.json +13 -0
- package/json-schema/Typography.json +142 -0
- package/json-schema/UniquenessValidation.json +59 -0
- package/json-schema/UpdateRequest.json +20 -0
- package/json-schema/UrlNavItem.json +51 -0
- package/json-schema/ValidationRule.json +794 -0
- package/json-schema/View.json +500 -0
- package/json-schema/Webhook.json +88 -0
- package/json-schema/WebhookReceiver.json +66 -0
- package/json-schema/WebhookTriggerType.json +16 -0
- package/json-schema/WindowFunction.json +24 -0
- package/json-schema/WindowFunctionNode.json +104 -0
- package/json-schema/WindowSpec.json +65 -0
- package/json-schema/WorkflowAction.json +84 -0
- package/json-schema/WorkflowRule.json +128 -0
- package/json-schema/WorkflowTriggerType.json +16 -0
- package/json-schema/ZIndex.json +44 -0
- package/package.json +34 -20
- package/dist/examples.d.ts +0 -28
- package/dist/examples.d.ts.map +0 -1
- package/dist/examples.js +0 -250
- package/dist/types/index.d.ts +0 -9
- package/dist/types/index.d.ts.map +0 -1
- package/dist/types/index.js +0 -8
- package/dist/types/meta/field-type.d.ts +0 -54
- package/dist/types/meta/field-type.d.ts.map +0 -1
- package/dist/types/meta/field-type.js +0 -42
- package/dist/types/meta/index.d.ts +0 -13
- package/dist/types/meta/index.d.ts.map +0 -1
- package/dist/types/meta/index.js +0 -12
- package/dist/types/meta/object-entity.d.ts +0 -246
- package/dist/types/meta/object-entity.d.ts.map +0 -1
- package/dist/types/meta/object-entity.js +0 -9
- package/dist/types/meta/object-field.d.ts +0 -199
- package/dist/types/meta/object-field.d.ts.map +0 -1
- package/dist/types/meta/object-field.js +0 -9
- package/dist/types/meta/object-view.d.ts +0 -430
- package/dist/types/meta/object-view.d.ts.map +0 -1
- package/dist/types/meta/object-view.js +0 -9
- package/src/examples.ts +0 -257
- package/src/index.ts +0 -10
- package/src/types/index.ts +0 -9
- package/src/types/meta/field-type.ts +0 -91
- package/src/types/meta/index.ts +0 -13
- package/src/types/meta/object-entity.ts +0 -265
- package/src/types/meta/object-field.ts +0 -218
- package/src/types/meta/object-view.ts +0 -475
|
@@ -0,0 +1,438 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
/**
|
|
3
|
+
* Filter Operator Enum
|
|
4
|
+
* Standard SQL/NoSQL operators supported by the engine.
|
|
5
|
+
*/
|
|
6
|
+
export declare const FilterOperator: z.ZodEnum<["=", "!=", "<>", ">", ">=", "<", "<=", "startswith", "contains", "notcontains", "between", "in", "notin", "is_null", "is_not_null"]>;
|
|
7
|
+
/**
|
|
8
|
+
* Filter Logic Operator
|
|
9
|
+
*/
|
|
10
|
+
export declare const LogicOperator: z.ZodEnum<["and", "or", "not"]>;
|
|
11
|
+
/**
|
|
12
|
+
* Recursive Filter Node
|
|
13
|
+
* Represents the "Where" clause.
|
|
14
|
+
*
|
|
15
|
+
* Structure: [Field, Operator, Value] OR [Logic, Filter, Filter...]
|
|
16
|
+
* Examples:
|
|
17
|
+
* - Simple: ["amount", ">", 1000]
|
|
18
|
+
* - Logic: [["status", "=", "closed"], "or", ["amount", ">", 1000]]
|
|
19
|
+
*/
|
|
20
|
+
export declare const FilterNodeSchema: z.ZodType<any>;
|
|
21
|
+
/**
|
|
22
|
+
* Sort Node
|
|
23
|
+
* Represents "Order By".
|
|
24
|
+
*/
|
|
25
|
+
export declare const SortNodeSchema: z.ZodObject<{
|
|
26
|
+
field: z.ZodString;
|
|
27
|
+
order: z.ZodDefault<z.ZodEnum<["asc", "desc"]>>;
|
|
28
|
+
}, "strip", z.ZodTypeAny, {
|
|
29
|
+
field: string;
|
|
30
|
+
order: "asc" | "desc";
|
|
31
|
+
}, {
|
|
32
|
+
field: string;
|
|
33
|
+
order?: "asc" | "desc" | undefined;
|
|
34
|
+
}>;
|
|
35
|
+
/**
|
|
36
|
+
* Aggregation Function Enum
|
|
37
|
+
* Standard aggregation functions.
|
|
38
|
+
*/
|
|
39
|
+
export declare const AggregationFunction: z.ZodEnum<["count", "sum", "avg", "min", "max", "count_distinct", "array_agg", "string_agg"]>;
|
|
40
|
+
/**
|
|
41
|
+
* Aggregation Node
|
|
42
|
+
* Represents aggregated field with function.
|
|
43
|
+
*/
|
|
44
|
+
export declare const AggregationNodeSchema: z.ZodObject<{
|
|
45
|
+
function: z.ZodEnum<["count", "sum", "avg", "min", "max", "count_distinct", "array_agg", "string_agg"]>;
|
|
46
|
+
field: z.ZodOptional<z.ZodString>;
|
|
47
|
+
alias: z.ZodString;
|
|
48
|
+
distinct: z.ZodOptional<z.ZodBoolean>;
|
|
49
|
+
}, "strip", z.ZodTypeAny, {
|
|
50
|
+
function: "min" | "max" | "count" | "sum" | "avg" | "count_distinct" | "array_agg" | "string_agg";
|
|
51
|
+
alias: string;
|
|
52
|
+
field?: string | undefined;
|
|
53
|
+
distinct?: boolean | undefined;
|
|
54
|
+
}, {
|
|
55
|
+
function: "min" | "max" | "count" | "sum" | "avg" | "count_distinct" | "array_agg" | "string_agg";
|
|
56
|
+
alias: string;
|
|
57
|
+
field?: string | undefined;
|
|
58
|
+
distinct?: boolean | undefined;
|
|
59
|
+
}>;
|
|
60
|
+
/**
|
|
61
|
+
* Join Type Enum
|
|
62
|
+
*/
|
|
63
|
+
export declare const JoinType: z.ZodEnum<["inner", "left", "right", "full"]>;
|
|
64
|
+
/**
|
|
65
|
+
* Join Node
|
|
66
|
+
* Represents table joins.
|
|
67
|
+
*/
|
|
68
|
+
export declare const JoinNodeSchema: z.ZodType<any>;
|
|
69
|
+
/**
|
|
70
|
+
* Window Function Enum
|
|
71
|
+
*/
|
|
72
|
+
export declare const WindowFunction: z.ZodEnum<["row_number", "rank", "dense_rank", "percent_rank", "lag", "lead", "first_value", "last_value", "sum", "avg", "count", "min", "max"]>;
|
|
73
|
+
/**
|
|
74
|
+
* Window Specification
|
|
75
|
+
* Defines PARTITION BY and ORDER BY for window functions.
|
|
76
|
+
*/
|
|
77
|
+
export declare const WindowSpecSchema: z.ZodObject<{
|
|
78
|
+
partitionBy: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
|
|
79
|
+
orderBy: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
80
|
+
field: z.ZodString;
|
|
81
|
+
order: z.ZodDefault<z.ZodEnum<["asc", "desc"]>>;
|
|
82
|
+
}, "strip", z.ZodTypeAny, {
|
|
83
|
+
field: string;
|
|
84
|
+
order: "asc" | "desc";
|
|
85
|
+
}, {
|
|
86
|
+
field: string;
|
|
87
|
+
order?: "asc" | "desc" | undefined;
|
|
88
|
+
}>, "many">>;
|
|
89
|
+
frame: z.ZodOptional<z.ZodObject<{
|
|
90
|
+
type: z.ZodOptional<z.ZodEnum<["rows", "range"]>>;
|
|
91
|
+
start: z.ZodOptional<z.ZodString>;
|
|
92
|
+
end: z.ZodOptional<z.ZodString>;
|
|
93
|
+
}, "strip", z.ZodTypeAny, {
|
|
94
|
+
type?: "rows" | "range" | undefined;
|
|
95
|
+
start?: string | undefined;
|
|
96
|
+
end?: string | undefined;
|
|
97
|
+
}, {
|
|
98
|
+
type?: "rows" | "range" | undefined;
|
|
99
|
+
start?: string | undefined;
|
|
100
|
+
end?: string | undefined;
|
|
101
|
+
}>>;
|
|
102
|
+
}, "strip", z.ZodTypeAny, {
|
|
103
|
+
partitionBy?: string[] | undefined;
|
|
104
|
+
orderBy?: {
|
|
105
|
+
field: string;
|
|
106
|
+
order: "asc" | "desc";
|
|
107
|
+
}[] | undefined;
|
|
108
|
+
frame?: {
|
|
109
|
+
type?: "rows" | "range" | undefined;
|
|
110
|
+
start?: string | undefined;
|
|
111
|
+
end?: string | undefined;
|
|
112
|
+
} | undefined;
|
|
113
|
+
}, {
|
|
114
|
+
partitionBy?: string[] | undefined;
|
|
115
|
+
orderBy?: {
|
|
116
|
+
field: string;
|
|
117
|
+
order?: "asc" | "desc" | undefined;
|
|
118
|
+
}[] | undefined;
|
|
119
|
+
frame?: {
|
|
120
|
+
type?: "rows" | "range" | undefined;
|
|
121
|
+
start?: string | undefined;
|
|
122
|
+
end?: string | undefined;
|
|
123
|
+
} | undefined;
|
|
124
|
+
}>;
|
|
125
|
+
/**
|
|
126
|
+
* Window Function Node
|
|
127
|
+
* Represents window function with OVER clause.
|
|
128
|
+
*/
|
|
129
|
+
export declare const WindowFunctionNodeSchema: z.ZodObject<{
|
|
130
|
+
function: z.ZodEnum<["row_number", "rank", "dense_rank", "percent_rank", "lag", "lead", "first_value", "last_value", "sum", "avg", "count", "min", "max"]>;
|
|
131
|
+
field: z.ZodOptional<z.ZodString>;
|
|
132
|
+
alias: z.ZodString;
|
|
133
|
+
over: z.ZodObject<{
|
|
134
|
+
partitionBy: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
|
|
135
|
+
orderBy: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
136
|
+
field: z.ZodString;
|
|
137
|
+
order: z.ZodDefault<z.ZodEnum<["asc", "desc"]>>;
|
|
138
|
+
}, "strip", z.ZodTypeAny, {
|
|
139
|
+
field: string;
|
|
140
|
+
order: "asc" | "desc";
|
|
141
|
+
}, {
|
|
142
|
+
field: string;
|
|
143
|
+
order?: "asc" | "desc" | undefined;
|
|
144
|
+
}>, "many">>;
|
|
145
|
+
frame: z.ZodOptional<z.ZodObject<{
|
|
146
|
+
type: z.ZodOptional<z.ZodEnum<["rows", "range"]>>;
|
|
147
|
+
start: z.ZodOptional<z.ZodString>;
|
|
148
|
+
end: z.ZodOptional<z.ZodString>;
|
|
149
|
+
}, "strip", z.ZodTypeAny, {
|
|
150
|
+
type?: "rows" | "range" | undefined;
|
|
151
|
+
start?: string | undefined;
|
|
152
|
+
end?: string | undefined;
|
|
153
|
+
}, {
|
|
154
|
+
type?: "rows" | "range" | undefined;
|
|
155
|
+
start?: string | undefined;
|
|
156
|
+
end?: string | undefined;
|
|
157
|
+
}>>;
|
|
158
|
+
}, "strip", z.ZodTypeAny, {
|
|
159
|
+
partitionBy?: string[] | undefined;
|
|
160
|
+
orderBy?: {
|
|
161
|
+
field: string;
|
|
162
|
+
order: "asc" | "desc";
|
|
163
|
+
}[] | undefined;
|
|
164
|
+
frame?: {
|
|
165
|
+
type?: "rows" | "range" | undefined;
|
|
166
|
+
start?: string | undefined;
|
|
167
|
+
end?: string | undefined;
|
|
168
|
+
} | undefined;
|
|
169
|
+
}, {
|
|
170
|
+
partitionBy?: string[] | undefined;
|
|
171
|
+
orderBy?: {
|
|
172
|
+
field: string;
|
|
173
|
+
order?: "asc" | "desc" | undefined;
|
|
174
|
+
}[] | undefined;
|
|
175
|
+
frame?: {
|
|
176
|
+
type?: "rows" | "range" | undefined;
|
|
177
|
+
start?: string | undefined;
|
|
178
|
+
end?: string | undefined;
|
|
179
|
+
} | undefined;
|
|
180
|
+
}>;
|
|
181
|
+
}, "strip", z.ZodTypeAny, {
|
|
182
|
+
function: "min" | "max" | "count" | "sum" | "avg" | "row_number" | "rank" | "dense_rank" | "percent_rank" | "lag" | "lead" | "first_value" | "last_value";
|
|
183
|
+
alias: string;
|
|
184
|
+
over: {
|
|
185
|
+
partitionBy?: string[] | undefined;
|
|
186
|
+
orderBy?: {
|
|
187
|
+
field: string;
|
|
188
|
+
order: "asc" | "desc";
|
|
189
|
+
}[] | undefined;
|
|
190
|
+
frame?: {
|
|
191
|
+
type?: "rows" | "range" | undefined;
|
|
192
|
+
start?: string | undefined;
|
|
193
|
+
end?: string | undefined;
|
|
194
|
+
} | undefined;
|
|
195
|
+
};
|
|
196
|
+
field?: string | undefined;
|
|
197
|
+
}, {
|
|
198
|
+
function: "min" | "max" | "count" | "sum" | "avg" | "row_number" | "rank" | "dense_rank" | "percent_rank" | "lag" | "lead" | "first_value" | "last_value";
|
|
199
|
+
alias: string;
|
|
200
|
+
over: {
|
|
201
|
+
partitionBy?: string[] | undefined;
|
|
202
|
+
orderBy?: {
|
|
203
|
+
field: string;
|
|
204
|
+
order?: "asc" | "desc" | undefined;
|
|
205
|
+
}[] | undefined;
|
|
206
|
+
frame?: {
|
|
207
|
+
type?: "rows" | "range" | undefined;
|
|
208
|
+
start?: string | undefined;
|
|
209
|
+
end?: string | undefined;
|
|
210
|
+
} | undefined;
|
|
211
|
+
};
|
|
212
|
+
field?: string | undefined;
|
|
213
|
+
}>;
|
|
214
|
+
/**
|
|
215
|
+
* Field Selection Node
|
|
216
|
+
* Represents "Select" attributes, including joins.
|
|
217
|
+
*/
|
|
218
|
+
export declare const FieldNodeSchema: z.ZodType<any>;
|
|
219
|
+
/**
|
|
220
|
+
* Query AST Schema
|
|
221
|
+
* The universal data retrieval contract defined in `ast-structure.mdx`.
|
|
222
|
+
*/
|
|
223
|
+
export declare const QuerySchema: z.ZodObject<{
|
|
224
|
+
/** Target Entity */
|
|
225
|
+
object: z.ZodString;
|
|
226
|
+
/** Select Clause */
|
|
227
|
+
fields: z.ZodOptional<z.ZodArray<z.ZodType<any, z.ZodTypeDef, any>, "many">>;
|
|
228
|
+
/** Aggregations */
|
|
229
|
+
aggregations: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
230
|
+
function: z.ZodEnum<["count", "sum", "avg", "min", "max", "count_distinct", "array_agg", "string_agg"]>;
|
|
231
|
+
field: z.ZodOptional<z.ZodString>;
|
|
232
|
+
alias: z.ZodString;
|
|
233
|
+
distinct: z.ZodOptional<z.ZodBoolean>;
|
|
234
|
+
}, "strip", z.ZodTypeAny, {
|
|
235
|
+
function: "min" | "max" | "count" | "sum" | "avg" | "count_distinct" | "array_agg" | "string_agg";
|
|
236
|
+
alias: string;
|
|
237
|
+
field?: string | undefined;
|
|
238
|
+
distinct?: boolean | undefined;
|
|
239
|
+
}, {
|
|
240
|
+
function: "min" | "max" | "count" | "sum" | "avg" | "count_distinct" | "array_agg" | "string_agg";
|
|
241
|
+
alias: string;
|
|
242
|
+
field?: string | undefined;
|
|
243
|
+
distinct?: boolean | undefined;
|
|
244
|
+
}>, "many">>;
|
|
245
|
+
/** Window Functions */
|
|
246
|
+
windowFunctions: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
247
|
+
function: z.ZodEnum<["row_number", "rank", "dense_rank", "percent_rank", "lag", "lead", "first_value", "last_value", "sum", "avg", "count", "min", "max"]>;
|
|
248
|
+
field: z.ZodOptional<z.ZodString>;
|
|
249
|
+
alias: z.ZodString;
|
|
250
|
+
over: z.ZodObject<{
|
|
251
|
+
partitionBy: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
|
|
252
|
+
orderBy: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
253
|
+
field: z.ZodString;
|
|
254
|
+
order: z.ZodDefault<z.ZodEnum<["asc", "desc"]>>;
|
|
255
|
+
}, "strip", z.ZodTypeAny, {
|
|
256
|
+
field: string;
|
|
257
|
+
order: "asc" | "desc";
|
|
258
|
+
}, {
|
|
259
|
+
field: string;
|
|
260
|
+
order?: "asc" | "desc" | undefined;
|
|
261
|
+
}>, "many">>;
|
|
262
|
+
frame: z.ZodOptional<z.ZodObject<{
|
|
263
|
+
type: z.ZodOptional<z.ZodEnum<["rows", "range"]>>;
|
|
264
|
+
start: z.ZodOptional<z.ZodString>;
|
|
265
|
+
end: z.ZodOptional<z.ZodString>;
|
|
266
|
+
}, "strip", z.ZodTypeAny, {
|
|
267
|
+
type?: "rows" | "range" | undefined;
|
|
268
|
+
start?: string | undefined;
|
|
269
|
+
end?: string | undefined;
|
|
270
|
+
}, {
|
|
271
|
+
type?: "rows" | "range" | undefined;
|
|
272
|
+
start?: string | undefined;
|
|
273
|
+
end?: string | undefined;
|
|
274
|
+
}>>;
|
|
275
|
+
}, "strip", z.ZodTypeAny, {
|
|
276
|
+
partitionBy?: string[] | undefined;
|
|
277
|
+
orderBy?: {
|
|
278
|
+
field: string;
|
|
279
|
+
order: "asc" | "desc";
|
|
280
|
+
}[] | undefined;
|
|
281
|
+
frame?: {
|
|
282
|
+
type?: "rows" | "range" | undefined;
|
|
283
|
+
start?: string | undefined;
|
|
284
|
+
end?: string | undefined;
|
|
285
|
+
} | undefined;
|
|
286
|
+
}, {
|
|
287
|
+
partitionBy?: string[] | undefined;
|
|
288
|
+
orderBy?: {
|
|
289
|
+
field: string;
|
|
290
|
+
order?: "asc" | "desc" | undefined;
|
|
291
|
+
}[] | undefined;
|
|
292
|
+
frame?: {
|
|
293
|
+
type?: "rows" | "range" | undefined;
|
|
294
|
+
start?: string | undefined;
|
|
295
|
+
end?: string | undefined;
|
|
296
|
+
} | undefined;
|
|
297
|
+
}>;
|
|
298
|
+
}, "strip", z.ZodTypeAny, {
|
|
299
|
+
function: "min" | "max" | "count" | "sum" | "avg" | "row_number" | "rank" | "dense_rank" | "percent_rank" | "lag" | "lead" | "first_value" | "last_value";
|
|
300
|
+
alias: string;
|
|
301
|
+
over: {
|
|
302
|
+
partitionBy?: string[] | undefined;
|
|
303
|
+
orderBy?: {
|
|
304
|
+
field: string;
|
|
305
|
+
order: "asc" | "desc";
|
|
306
|
+
}[] | undefined;
|
|
307
|
+
frame?: {
|
|
308
|
+
type?: "rows" | "range" | undefined;
|
|
309
|
+
start?: string | undefined;
|
|
310
|
+
end?: string | undefined;
|
|
311
|
+
} | undefined;
|
|
312
|
+
};
|
|
313
|
+
field?: string | undefined;
|
|
314
|
+
}, {
|
|
315
|
+
function: "min" | "max" | "count" | "sum" | "avg" | "row_number" | "rank" | "dense_rank" | "percent_rank" | "lag" | "lead" | "first_value" | "last_value";
|
|
316
|
+
alias: string;
|
|
317
|
+
over: {
|
|
318
|
+
partitionBy?: string[] | undefined;
|
|
319
|
+
orderBy?: {
|
|
320
|
+
field: string;
|
|
321
|
+
order?: "asc" | "desc" | undefined;
|
|
322
|
+
}[] | undefined;
|
|
323
|
+
frame?: {
|
|
324
|
+
type?: "rows" | "range" | undefined;
|
|
325
|
+
start?: string | undefined;
|
|
326
|
+
end?: string | undefined;
|
|
327
|
+
} | undefined;
|
|
328
|
+
};
|
|
329
|
+
field?: string | undefined;
|
|
330
|
+
}>, "many">>;
|
|
331
|
+
/** Where Clause */
|
|
332
|
+
filters: z.ZodOptional<z.ZodType<any, z.ZodTypeDef, any>>;
|
|
333
|
+
/** Joins */
|
|
334
|
+
joins: z.ZodOptional<z.ZodArray<z.ZodType<any, z.ZodTypeDef, any>, "many">>;
|
|
335
|
+
/** Group By Clause */
|
|
336
|
+
groupBy: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
|
|
337
|
+
/** Having Clause */
|
|
338
|
+
having: z.ZodOptional<z.ZodType<any, z.ZodTypeDef, any>>;
|
|
339
|
+
/** Order By Clause */
|
|
340
|
+
sort: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
341
|
+
field: z.ZodString;
|
|
342
|
+
order: z.ZodDefault<z.ZodEnum<["asc", "desc"]>>;
|
|
343
|
+
}, "strip", z.ZodTypeAny, {
|
|
344
|
+
field: string;
|
|
345
|
+
order: "asc" | "desc";
|
|
346
|
+
}, {
|
|
347
|
+
field: string;
|
|
348
|
+
order?: "asc" | "desc" | undefined;
|
|
349
|
+
}>, "many">>;
|
|
350
|
+
/** Pagination */
|
|
351
|
+
top: z.ZodOptional<z.ZodNumber>;
|
|
352
|
+
skip: z.ZodOptional<z.ZodNumber>;
|
|
353
|
+
/** Subquery flag */
|
|
354
|
+
distinct: z.ZodOptional<z.ZodBoolean>;
|
|
355
|
+
}, "strip", z.ZodTypeAny, {
|
|
356
|
+
object: string;
|
|
357
|
+
sort?: {
|
|
358
|
+
field: string;
|
|
359
|
+
order: "asc" | "desc";
|
|
360
|
+
}[] | undefined;
|
|
361
|
+
fields?: any[] | undefined;
|
|
362
|
+
distinct?: boolean | undefined;
|
|
363
|
+
aggregations?: {
|
|
364
|
+
function: "min" | "max" | "count" | "sum" | "avg" | "count_distinct" | "array_agg" | "string_agg";
|
|
365
|
+
alias: string;
|
|
366
|
+
field?: string | undefined;
|
|
367
|
+
distinct?: boolean | undefined;
|
|
368
|
+
}[] | undefined;
|
|
369
|
+
windowFunctions?: {
|
|
370
|
+
function: "min" | "max" | "count" | "sum" | "avg" | "row_number" | "rank" | "dense_rank" | "percent_rank" | "lag" | "lead" | "first_value" | "last_value";
|
|
371
|
+
alias: string;
|
|
372
|
+
over: {
|
|
373
|
+
partitionBy?: string[] | undefined;
|
|
374
|
+
orderBy?: {
|
|
375
|
+
field: string;
|
|
376
|
+
order: "asc" | "desc";
|
|
377
|
+
}[] | undefined;
|
|
378
|
+
frame?: {
|
|
379
|
+
type?: "rows" | "range" | undefined;
|
|
380
|
+
start?: string | undefined;
|
|
381
|
+
end?: string | undefined;
|
|
382
|
+
} | undefined;
|
|
383
|
+
};
|
|
384
|
+
field?: string | undefined;
|
|
385
|
+
}[] | undefined;
|
|
386
|
+
filters?: any;
|
|
387
|
+
joins?: any[] | undefined;
|
|
388
|
+
groupBy?: string[] | undefined;
|
|
389
|
+
having?: any;
|
|
390
|
+
top?: number | undefined;
|
|
391
|
+
skip?: number | undefined;
|
|
392
|
+
}, {
|
|
393
|
+
object: string;
|
|
394
|
+
sort?: {
|
|
395
|
+
field: string;
|
|
396
|
+
order?: "asc" | "desc" | undefined;
|
|
397
|
+
}[] | undefined;
|
|
398
|
+
fields?: any[] | undefined;
|
|
399
|
+
distinct?: boolean | undefined;
|
|
400
|
+
aggregations?: {
|
|
401
|
+
function: "min" | "max" | "count" | "sum" | "avg" | "count_distinct" | "array_agg" | "string_agg";
|
|
402
|
+
alias: string;
|
|
403
|
+
field?: string | undefined;
|
|
404
|
+
distinct?: boolean | undefined;
|
|
405
|
+
}[] | undefined;
|
|
406
|
+
windowFunctions?: {
|
|
407
|
+
function: "min" | "max" | "count" | "sum" | "avg" | "row_number" | "rank" | "dense_rank" | "percent_rank" | "lag" | "lead" | "first_value" | "last_value";
|
|
408
|
+
alias: string;
|
|
409
|
+
over: {
|
|
410
|
+
partitionBy?: string[] | undefined;
|
|
411
|
+
orderBy?: {
|
|
412
|
+
field: string;
|
|
413
|
+
order?: "asc" | "desc" | undefined;
|
|
414
|
+
}[] | undefined;
|
|
415
|
+
frame?: {
|
|
416
|
+
type?: "rows" | "range" | undefined;
|
|
417
|
+
start?: string | undefined;
|
|
418
|
+
end?: string | undefined;
|
|
419
|
+
} | undefined;
|
|
420
|
+
};
|
|
421
|
+
field?: string | undefined;
|
|
422
|
+
}[] | undefined;
|
|
423
|
+
filters?: any;
|
|
424
|
+
joins?: any[] | undefined;
|
|
425
|
+
groupBy?: string[] | undefined;
|
|
426
|
+
having?: any;
|
|
427
|
+
top?: number | undefined;
|
|
428
|
+
skip?: number | undefined;
|
|
429
|
+
}>;
|
|
430
|
+
export type QueryAST = z.infer<typeof QuerySchema>;
|
|
431
|
+
export type QueryInput = z.input<typeof QuerySchema>;
|
|
432
|
+
export type FilterNode = z.infer<typeof FilterNodeSchema>;
|
|
433
|
+
export type SortNode = z.infer<typeof SortNodeSchema>;
|
|
434
|
+
export type AggregationNode = z.infer<typeof AggregationNodeSchema>;
|
|
435
|
+
export type JoinNode = z.infer<typeof JoinNodeSchema>;
|
|
436
|
+
export type WindowFunctionNode = z.infer<typeof WindowFunctionNodeSchema>;
|
|
437
|
+
export type WindowSpec = z.infer<typeof WindowSpecSchema>;
|
|
438
|
+
//# sourceMappingURL=query.zod.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"query.zod.d.ts","sourceRoot":"","sources":["../../src/data/query.zod.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB;;;GAGG;AACH,eAAO,MAAM,cAAc,iJAMzB,CAAC;AAEH;;GAEG;AACH,eAAO,MAAM,aAAa,iCAA+B,CAAC;AAE1D;;;;;;;;GAQG;AACH,eAAO,MAAM,gBAAgB,EAAE,CAAC,CAAC,OAAO,CAAC,GAAG,CAQ3C,CAAC;AAEF;;;GAGG;AACH,eAAO,MAAM,cAAc;;;;;;;;;EAGzB,CAAC;AAEH;;;GAGG;AACH,eAAO,MAAM,mBAAmB,+FAG9B,CAAC;AAEH;;;GAGG;AACH,eAAO,MAAM,qBAAqB;;;;;;;;;;;;;;;EAKhC,CAAC;AAEH;;GAEG;AACH,eAAO,MAAM,QAAQ,+CAA6C,CAAC;AAEnE;;;GAGG;AACH,eAAO,MAAM,cAAc,EAAE,CAAC,CAAC,OAAO,CAAC,GAAG,CAQzC,CAAC;AAEF;;GAEG;AACH,eAAO,MAAM,cAAc,kJAIzB,CAAC;AAEH;;;GAGG;AACH,eAAO,MAAM,gBAAgB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAQ3B,CAAC;AAEH;;;GAGG;AACH,eAAO,MAAM,wBAAwB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAKnC,CAAC;AAEH;;;GAGG;AACH,eAAO,MAAM,eAAe,EAAE,CAAC,CAAC,OAAO,CAAC,GAAG,CAS1C,CAAC;AAEF;;;GAGG;AACH,eAAO,MAAM,WAAW;IACtB,oBAAoB;;IAGpB,oBAAoB;;IAGpB,mBAAmB;;;;;;;;;;;;;;;;;IAGnB,uBAAuB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;IAGvB,mBAAmB;;IAGnB,YAAY;;IAGZ,sBAAsB;;IAGtB,oBAAoB;;IAGpB,sBAAsB;;;;;;;;;;;IAGtB,iBAAiB;;;IAIjB,oBAAoB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAEpB,CAAC;AAEH,MAAM,MAAM,QAAQ,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,WAAW,CAAC,CAAC;AACnD,MAAM,MAAM,UAAU,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,WAAW,CAAC,CAAC;AACrD,MAAM,MAAM,UAAU,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,gBAAgB,CAAC,CAAC;AAC1D,MAAM,MAAM,QAAQ,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,cAAc,CAAC,CAAC;AACtD,MAAM,MAAM,eAAe,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,qBAAqB,CAAC,CAAC;AACpE,MAAM,MAAM,QAAQ,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,cAAc,CAAC,CAAC;AACtD,MAAM,MAAM,kBAAkB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,wBAAwB,CAAC,CAAC;AAC1E,MAAM,MAAM,UAAU,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,gBAAgB,CAAC,CAAC"}
|
|
@@ -0,0 +1,147 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.QuerySchema = exports.FieldNodeSchema = exports.WindowFunctionNodeSchema = exports.WindowSpecSchema = exports.WindowFunction = exports.JoinNodeSchema = exports.JoinType = exports.AggregationNodeSchema = exports.AggregationFunction = exports.SortNodeSchema = exports.FilterNodeSchema = exports.LogicOperator = exports.FilterOperator = void 0;
|
|
4
|
+
const zod_1 = require("zod");
|
|
5
|
+
/**
|
|
6
|
+
* Filter Operator Enum
|
|
7
|
+
* Standard SQL/NoSQL operators supported by the engine.
|
|
8
|
+
*/
|
|
9
|
+
exports.FilterOperator = zod_1.z.enum([
|
|
10
|
+
'=', '!=', '<>',
|
|
11
|
+
'>', '>=', '<', '<=',
|
|
12
|
+
'startswith', 'contains', 'notcontains',
|
|
13
|
+
'between', 'in', 'notin',
|
|
14
|
+
'is_null', 'is_not_null'
|
|
15
|
+
]);
|
|
16
|
+
/**
|
|
17
|
+
* Filter Logic Operator
|
|
18
|
+
*/
|
|
19
|
+
exports.LogicOperator = zod_1.z.enum(['and', 'or', 'not']);
|
|
20
|
+
/**
|
|
21
|
+
* Recursive Filter Node
|
|
22
|
+
* Represents the "Where" clause.
|
|
23
|
+
*
|
|
24
|
+
* Structure: [Field, Operator, Value] OR [Logic, Filter, Filter...]
|
|
25
|
+
* Examples:
|
|
26
|
+
* - Simple: ["amount", ">", 1000]
|
|
27
|
+
* - Logic: [["status", "=", "closed"], "or", ["amount", ">", 1000]]
|
|
28
|
+
*/
|
|
29
|
+
exports.FilterNodeSchema = zod_1.z.lazy(() => zod_1.z.union([
|
|
30
|
+
// Leaf Node: [Field, Operator, Value]
|
|
31
|
+
zod_1.z.tuple([zod_1.z.string(), exports.FilterOperator, zod_1.z.any()]),
|
|
32
|
+
// Logic Node: [Expression, "or", Expression]
|
|
33
|
+
zod_1.z.array(zod_1.z.union([zod_1.z.string(), exports.FilterNodeSchema]))
|
|
34
|
+
]));
|
|
35
|
+
/**
|
|
36
|
+
* Sort Node
|
|
37
|
+
* Represents "Order By".
|
|
38
|
+
*/
|
|
39
|
+
exports.SortNodeSchema = zod_1.z.object({
|
|
40
|
+
field: zod_1.z.string(),
|
|
41
|
+
order: zod_1.z.enum(['asc', 'desc']).default('asc')
|
|
42
|
+
});
|
|
43
|
+
/**
|
|
44
|
+
* Aggregation Function Enum
|
|
45
|
+
* Standard aggregation functions.
|
|
46
|
+
*/
|
|
47
|
+
exports.AggregationFunction = zod_1.z.enum([
|
|
48
|
+
'count', 'sum', 'avg', 'min', 'max',
|
|
49
|
+
'count_distinct', 'array_agg', 'string_agg'
|
|
50
|
+
]);
|
|
51
|
+
/**
|
|
52
|
+
* Aggregation Node
|
|
53
|
+
* Represents aggregated field with function.
|
|
54
|
+
*/
|
|
55
|
+
exports.AggregationNodeSchema = zod_1.z.object({
|
|
56
|
+
function: exports.AggregationFunction.describe('Aggregation function'),
|
|
57
|
+
field: zod_1.z.string().optional().describe('Field to aggregate (optional for COUNT(*))'),
|
|
58
|
+
alias: zod_1.z.string().describe('Result column alias'),
|
|
59
|
+
distinct: zod_1.z.boolean().optional().describe('Apply DISTINCT before aggregation'),
|
|
60
|
+
});
|
|
61
|
+
/**
|
|
62
|
+
* Join Type Enum
|
|
63
|
+
*/
|
|
64
|
+
exports.JoinType = zod_1.z.enum(['inner', 'left', 'right', 'full']);
|
|
65
|
+
/**
|
|
66
|
+
* Join Node
|
|
67
|
+
* Represents table joins.
|
|
68
|
+
*/
|
|
69
|
+
exports.JoinNodeSchema = zod_1.z.lazy(() => zod_1.z.object({
|
|
70
|
+
type: exports.JoinType.describe('Join type'),
|
|
71
|
+
object: zod_1.z.string().describe('Object/table to join'),
|
|
72
|
+
alias: zod_1.z.string().optional().describe('Table alias'),
|
|
73
|
+
on: exports.FilterNodeSchema.describe('Join condition'),
|
|
74
|
+
subquery: zod_1.z.lazy(() => exports.QuerySchema).optional().describe('Subquery instead of object'),
|
|
75
|
+
}));
|
|
76
|
+
/**
|
|
77
|
+
* Window Function Enum
|
|
78
|
+
*/
|
|
79
|
+
exports.WindowFunction = zod_1.z.enum([
|
|
80
|
+
'row_number', 'rank', 'dense_rank', 'percent_rank',
|
|
81
|
+
'lag', 'lead', 'first_value', 'last_value',
|
|
82
|
+
'sum', 'avg', 'count', 'min', 'max'
|
|
83
|
+
]);
|
|
84
|
+
/**
|
|
85
|
+
* Window Specification
|
|
86
|
+
* Defines PARTITION BY and ORDER BY for window functions.
|
|
87
|
+
*/
|
|
88
|
+
exports.WindowSpecSchema = zod_1.z.object({
|
|
89
|
+
partitionBy: zod_1.z.array(zod_1.z.string()).optional().describe('PARTITION BY fields'),
|
|
90
|
+
orderBy: zod_1.z.array(exports.SortNodeSchema).optional().describe('ORDER BY specification'),
|
|
91
|
+
frame: zod_1.z.object({
|
|
92
|
+
type: zod_1.z.enum(['rows', 'range']).optional(),
|
|
93
|
+
start: zod_1.z.string().optional().describe('Frame start (e.g., "UNBOUNDED PRECEDING", "1 PRECEDING")'),
|
|
94
|
+
end: zod_1.z.string().optional().describe('Frame end (e.g., "CURRENT ROW", "1 FOLLOWING")'),
|
|
95
|
+
}).optional().describe('Window frame specification'),
|
|
96
|
+
});
|
|
97
|
+
/**
|
|
98
|
+
* Window Function Node
|
|
99
|
+
* Represents window function with OVER clause.
|
|
100
|
+
*/
|
|
101
|
+
exports.WindowFunctionNodeSchema = zod_1.z.object({
|
|
102
|
+
function: exports.WindowFunction.describe('Window function name'),
|
|
103
|
+
field: zod_1.z.string().optional().describe('Field to operate on (for aggregate window functions)'),
|
|
104
|
+
alias: zod_1.z.string().describe('Result column alias'),
|
|
105
|
+
over: exports.WindowSpecSchema.describe('Window specification (OVER clause)'),
|
|
106
|
+
});
|
|
107
|
+
/**
|
|
108
|
+
* Field Selection Node
|
|
109
|
+
* Represents "Select" attributes, including joins.
|
|
110
|
+
*/
|
|
111
|
+
exports.FieldNodeSchema = zod_1.z.lazy(() => zod_1.z.union([
|
|
112
|
+
zod_1.z.string(), // Primitive field: "name"
|
|
113
|
+
zod_1.z.object({
|
|
114
|
+
field: zod_1.z.string(), // Relationship field: "owner"
|
|
115
|
+
fields: zod_1.z.array(exports.FieldNodeSchema).optional(), // Nested select: ["name", "email"]
|
|
116
|
+
alias: zod_1.z.string().optional()
|
|
117
|
+
})
|
|
118
|
+
]));
|
|
119
|
+
/**
|
|
120
|
+
* Query AST Schema
|
|
121
|
+
* The universal data retrieval contract defined in `ast-structure.mdx`.
|
|
122
|
+
*/
|
|
123
|
+
exports.QuerySchema = zod_1.z.object({
|
|
124
|
+
/** Target Entity */
|
|
125
|
+
object: zod_1.z.string().describe('Object name (e.g. account)'),
|
|
126
|
+
/** Select Clause */
|
|
127
|
+
fields: zod_1.z.array(exports.FieldNodeSchema).optional().describe('Fields to retrieve'),
|
|
128
|
+
/** Aggregations */
|
|
129
|
+
aggregations: zod_1.z.array(exports.AggregationNodeSchema).optional().describe('Aggregation functions (GROUP BY)'),
|
|
130
|
+
/** Window Functions */
|
|
131
|
+
windowFunctions: zod_1.z.array(exports.WindowFunctionNodeSchema).optional().describe('Window functions with OVER clause'),
|
|
132
|
+
/** Where Clause */
|
|
133
|
+
filters: exports.FilterNodeSchema.optional().describe('Filtering criteria'),
|
|
134
|
+
/** Joins */
|
|
135
|
+
joins: zod_1.z.array(exports.JoinNodeSchema).optional().describe('Table joins'),
|
|
136
|
+
/** Group By Clause */
|
|
137
|
+
groupBy: zod_1.z.array(zod_1.z.string()).optional().describe('GROUP BY fields'),
|
|
138
|
+
/** Having Clause */
|
|
139
|
+
having: exports.FilterNodeSchema.optional().describe('HAVING clause for aggregation filtering'),
|
|
140
|
+
/** Order By Clause */
|
|
141
|
+
sort: zod_1.z.array(exports.SortNodeSchema).optional().describe('Sorting instructions'),
|
|
142
|
+
/** Pagination */
|
|
143
|
+
top: zod_1.z.number().optional().describe('Limit results'),
|
|
144
|
+
skip: zod_1.z.number().optional().describe('Offset results'),
|
|
145
|
+
/** Subquery flag */
|
|
146
|
+
distinct: zod_1.z.boolean().optional().describe('SELECT DISTINCT flag'),
|
|
147
|
+
});
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
/**
|
|
3
|
+
* Sharing Rule Type
|
|
4
|
+
* How is the data shared?
|
|
5
|
+
*/
|
|
6
|
+
export declare const SharingRuleType: z.ZodEnum<["owner", "criteria", "manual", "guest"]>;
|
|
7
|
+
/**
|
|
8
|
+
* Sharing Level
|
|
9
|
+
* What access is granted?
|
|
10
|
+
*/
|
|
11
|
+
export declare const SharingLevel: z.ZodEnum<["read", "edit"]>;
|
|
12
|
+
/**
|
|
13
|
+
* Sharing Rule Schema
|
|
14
|
+
* Defines AUTOMATIC access grants based on logic.
|
|
15
|
+
* The core engine of the governance layer.
|
|
16
|
+
*/
|
|
17
|
+
export declare const SharingRuleSchema: z.ZodObject<{
|
|
18
|
+
name: z.ZodString;
|
|
19
|
+
label: z.ZodOptional<z.ZodString>;
|
|
20
|
+
active: z.ZodDefault<z.ZodBoolean>;
|
|
21
|
+
/** Target Object */
|
|
22
|
+
object: z.ZodString;
|
|
23
|
+
/** Grant Logic */
|
|
24
|
+
type: z.ZodDefault<z.ZodEnum<["owner", "criteria", "manual", "guest"]>>;
|
|
25
|
+
/**
|
|
26
|
+
* Criteria (for type='criteria')
|
|
27
|
+
* SQL-like condition: "department = 'Sales' AND amount > 10000"
|
|
28
|
+
*/
|
|
29
|
+
criteria: z.ZodOptional<z.ZodString>;
|
|
30
|
+
/** Access Level */
|
|
31
|
+
accessLevel: z.ZodDefault<z.ZodEnum<["read", "edit"]>>;
|
|
32
|
+
/**
|
|
33
|
+
* Target Audience (Whom to share with)
|
|
34
|
+
* ID of a Group, Role, or User.
|
|
35
|
+
*/
|
|
36
|
+
sharedWith: z.ZodString;
|
|
37
|
+
}, "strip", z.ZodTypeAny, {
|
|
38
|
+
object: string;
|
|
39
|
+
type: "owner" | "criteria" | "manual" | "guest";
|
|
40
|
+
name: string;
|
|
41
|
+
active: boolean;
|
|
42
|
+
accessLevel: "read" | "edit";
|
|
43
|
+
sharedWith: string;
|
|
44
|
+
label?: string | undefined;
|
|
45
|
+
criteria?: string | undefined;
|
|
46
|
+
}, {
|
|
47
|
+
object: string;
|
|
48
|
+
name: string;
|
|
49
|
+
sharedWith: string;
|
|
50
|
+
type?: "owner" | "criteria" | "manual" | "guest" | undefined;
|
|
51
|
+
label?: string | undefined;
|
|
52
|
+
active?: boolean | undefined;
|
|
53
|
+
criteria?: string | undefined;
|
|
54
|
+
accessLevel?: "read" | "edit" | undefined;
|
|
55
|
+
}>;
|
|
56
|
+
/**
|
|
57
|
+
* Organization-Wide Defaults (OWD)
|
|
58
|
+
* The baseline security posture for an object.
|
|
59
|
+
*/
|
|
60
|
+
export declare const OWDModel: z.ZodEnum<["private", "public_read", "public_read_write"]>;
|
|
61
|
+
export type SharingRule = z.infer<typeof SharingRuleSchema>;
|
|
62
|
+
export type SharingRuleType = z.infer<typeof SharingRuleType>;
|
|
63
|
+
//# sourceMappingURL=sharing.zod.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"sharing.zod.d.ts","sourceRoot":"","sources":["../../src/data/sharing.zod.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB;;;GAGG;AACH,eAAO,MAAM,eAAe,qDAK1B,CAAC;AAEH;;;GAGG;AACH,eAAO,MAAM,YAAY,6BAGvB,CAAC;AAEH;;;;GAIG;AACH,eAAO,MAAM,iBAAiB;;;;IAK5B,oBAAoB;;IAGpB,kBAAkB;;IAGlB;;;OAGG;;IAGH,mBAAmB;;IAGnB;;;OAGG;;;;;;;;;;;;;;;;;;;;EAEH,CAAC;AAEH;;;GAGG;AACH,eAAO,MAAM,QAAQ,4DAInB,CAAC;AAEH,MAAM,MAAM,WAAW,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,iBAAiB,CAAC,CAAC;AAC5D,MAAM,MAAM,eAAe,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,eAAe,CAAC,CAAC"}
|