@objectstack/spec 2.0.5 → 2.0.7
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/dist/ai/index.d.mts +1 -1
- package/dist/ai/index.d.ts +1 -1
- package/dist/ai/index.js +230 -3
- package/dist/ai/index.js.map +1 -1
- package/dist/ai/index.mjs +218 -3
- package/dist/ai/index.mjs.map +1 -1
- package/dist/api/index.d.mts +2 -2
- package/dist/api/index.d.ts +2 -2
- package/dist/api/index.js +3409 -2841
- package/dist/api/index.js.map +1 -1
- package/dist/api/index.mjs +3386 -2841
- package/dist/api/index.mjs.map +1 -1
- package/dist/automation/index.d.mts +1 -1
- package/dist/automation/index.d.ts +1 -1
- package/dist/contracts/index.d.mts +2 -2
- package/dist/contracts/index.d.ts +2 -2
- package/dist/contracts/index.js.map +1 -1
- package/dist/data/index.d.mts +2 -2
- package/dist/data/index.d.ts +2 -2
- package/dist/data/index.js +58 -1
- package/dist/data/index.js.map +1 -1
- package/dist/data/index.mjs +58 -1
- package/dist/data/index.mjs.map +1 -1
- package/dist/{driver.zod-E3C6n0W-.d.ts → driver.zod-B3Q0oLlF.d.ts} +1 -1
- package/dist/{driver.zod-DnOPgUGi.d.mts → driver.zod-Bf2z72WQ.d.mts} +1 -1
- package/dist/{index-DyawwLFZ.d.ts → index-B3C8s_DZ.d.ts} +307 -29
- package/dist/{index-DTCkpGMm.d.mts → index-BliYpI46.d.mts} +879 -52
- package/dist/{index-BbtSaxHm.d.ts → index-BpE_xfkc.d.ts} +3289 -229
- package/dist/{index-E1mP_eoE.d.mts → index-C3cFLYII.d.mts} +307 -29
- package/dist/{index-BpP0MwlW.d.ts → index-CXtgLAue.d.ts} +879 -52
- package/dist/{index-D-tf4nDV.d.mts → index-CYbdd-mL.d.mts} +27 -1
- package/dist/index-CeUUI-ym.d.mts +2102 -0
- package/dist/{index-BPhGHW32.d.ts → index-CfvdYFyf.d.ts} +27 -1
- package/dist/{index-CDN6TRx9.d.mts → index-ClHj1Tbo.d.mts} +71 -2
- package/dist/{index-CDN6TRx9.d.ts → index-ClHj1Tbo.d.ts} +71 -2
- package/dist/index-CmY8tgpL.d.ts +2102 -0
- package/dist/{index-DRCh2NTZ.d.mts → index-CqDMk0T6.d.mts} +3289 -229
- package/dist/{index-d9wYlv-g.d.ts → index-DNKiU_-x.d.mts} +684 -18
- package/dist/{index-d9wYlv-g.d.mts → index-DNKiU_-x.d.ts} +684 -18
- package/dist/{index-CisfSmuF.d.ts → index-Dm4UfDKG.d.ts} +451 -19
- package/dist/index-KhvhiesR.d.mts +6902 -0
- package/dist/{index-BV0xBoer.d.mts → index-Onf8hbkX.d.mts} +451 -19
- package/dist/index-OqCqQSaH.d.ts +6902 -0
- package/dist/index.d.mts +2519 -222
- package/dist/index.d.ts +2519 -222
- package/dist/index.js +9957 -8069
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +9957 -8069
- package/dist/index.mjs.map +1 -1
- package/dist/integration/index.d.mts +1 -1
- package/dist/integration/index.d.ts +1 -1
- package/dist/integration/index.js +67 -0
- package/dist/integration/index.js.map +1 -1
- package/dist/integration/index.mjs +61 -0
- package/dist/integration/index.mjs.map +1 -1
- package/dist/kernel/index.d.mts +2 -2
- package/dist/kernel/index.d.ts +2 -2
- package/dist/kernel/index.js +1698 -1474
- package/dist/kernel/index.js.map +1 -1
- package/dist/kernel/index.mjs +1690 -1474
- package/dist/kernel/index.mjs.map +1 -1
- package/dist/{package-registry.zod-CbS9FKeH.d.mts → package-registry.zod-BJQSiICj.d.mts} +78 -43
- package/dist/{package-registry.zod-CbS9FKeH.d.ts → package-registry.zod-BJQSiICj.d.ts} +78 -43
- package/dist/security/index.d.mts +1 -1
- package/dist/security/index.d.ts +1 -1
- package/dist/security/index.js +47 -1
- package/dist/security/index.js.map +1 -1
- package/dist/security/index.mjs +45 -1
- package/dist/security/index.mjs.map +1 -1
- package/dist/system/index.d.mts +1 -1
- package/dist/system/index.d.ts +1 -1
- package/dist/system/index.js +2189 -1821
- package/dist/system/index.js.map +1 -1
- package/dist/system/index.mjs +2168 -1821
- package/dist/system/index.mjs.map +1 -1
- package/dist/ui/index.d.mts +1 -1
- package/dist/ui/index.d.ts +1 -1
- package/dist/ui/index.js +1414 -767
- package/dist/ui/index.js.map +1 -1
- package/dist/ui/index.mjs +1354 -767
- package/dist/ui/index.mjs.map +1 -1
- package/json-schema/ai/Agent.json +203 -0
- package/json-schema/ai/AgentCommunicationProtocol.json +9 -0
- package/json-schema/ai/AgentGroupMember.json +45 -0
- package/json-schema/ai/AgentGroupRole.json +10 -0
- package/json-schema/ai/DevOpsAgent.json +203 -0
- package/json-schema/ai/MCPClientConfig.json +168 -0
- package/json-schema/ai/MCPRootEntry.json +23 -0
- package/json-schema/ai/MCPRootsConfig.json +49 -0
- package/json-schema/ai/MCPSamplingConfig.json +46 -0
- package/json-schema/ai/MCPServerConfig.json +120 -0
- package/json-schema/ai/MCPStreamingConfig.json +38 -0
- package/json-schema/ai/MCPToolApproval.json +39 -0
- package/json-schema/ai/MultiAgentGroup.json +137 -0
- package/json-schema/ai/StructuredOutputConfig.json +75 -0
- package/json-schema/ai/StructuredOutputFormat.json +12 -0
- package/json-schema/ai/TransformPipelineStep.json +11 -0
- package/json-schema/api/AppDefinitionResponse.json +285 -7
- package/json-schema/api/BasePresence.json +40 -0
- package/json-schema/api/BatchLoadingStrategy.json +40 -0
- package/json-schema/api/Callback.json +39 -0
- package/json-schema/api/DataLoaderConfig.json +55 -0
- package/json-schema/api/DisablePackageResponse.json +26 -0
- package/json-schema/api/Discovery.json +4 -62
- package/json-schema/api/EnablePackageResponse.json +26 -0
- package/json-schema/api/FederationEntity.json +110 -0
- package/json-schema/api/FederationEntityKey.json +20 -0
- package/json-schema/api/FederationExternalField.json +18 -0
- package/json-schema/api/FederationGateway.json +327 -0
- package/json-schema/api/FederationProvides.json +19 -0
- package/json-schema/api/FederationRequires.json +19 -0
- package/json-schema/api/GetDiscoveryResponse.json +1 -60
- package/json-schema/api/GetPackageResponse.json +26 -0
- package/json-schema/api/GraphQLConfig.json +327 -0
- package/json-schema/api/GraphQLQueryAdapter.json +84 -0
- package/json-schema/api/InstallPackageRequest.json +26 -0
- package/json-schema/api/InstallPackageResponse.json +26 -0
- package/json-schema/api/ListPackagesResponse.json +26 -0
- package/json-schema/api/ODataQueryAdapter.json +66 -0
- package/json-schema/api/OpenApi31Extensions.json +139 -0
- package/json-schema/api/OperatorMapping.json +26 -0
- package/json-schema/api/PresenceStatus.json +10 -0
- package/json-schema/api/QueryAdapterConfig.json +272 -0
- package/json-schema/api/QueryAdapterTarget.json +9 -0
- package/json-schema/api/QueryOptimizationConfig.json +126 -0
- package/json-schema/api/RealtimeRecordAction.json +9 -0
- package/json-schema/api/RestQueryAdapter.json +86 -0
- package/json-schema/api/RestServerConfig.json +139 -0
- package/json-schema/api/SubgraphConfig.json +183 -0
- package/json-schema/api/WebhookConfig.json +129 -0
- package/json-schema/api/WebhookEvent.json +64 -0
- package/json-schema/data/ExternalLookup.json +128 -0
- package/json-schema/identity/SCIMBulkOperation.json +41 -0
- package/json-schema/identity/SCIMBulkRequest.json +73 -0
- package/json-schema/identity/SCIMBulkResponse.json +61 -0
- package/json-schema/identity/SCIMBulkResponseOperation.json +36 -0
- package/json-schema/integration/CircuitBreakerConfig.json +49 -0
- package/json-schema/integration/Connector.json +223 -0
- package/json-schema/integration/ConnectorHealth.json +113 -0
- package/json-schema/integration/DatabaseConnector.json +223 -0
- package/json-schema/integration/ErrorCategory.json +15 -0
- package/json-schema/integration/ErrorMappingConfig.json +112 -0
- package/json-schema/integration/ErrorMappingRule.json +66 -0
- package/json-schema/integration/FileStorageConnector.json +223 -0
- package/json-schema/integration/GitHubConnector.json +223 -0
- package/json-schema/integration/HealthCheckConfig.json +58 -0
- package/json-schema/integration/MessageQueueConnector.json +223 -0
- package/json-schema/integration/SaasConnector.json +223 -0
- package/json-schema/integration/VercelConnector.json +223 -0
- package/json-schema/kernel/CLICommandContribution.json +23 -0
- package/json-schema/kernel/CLIExtensionExport.json +22 -0
- package/json-schema/kernel/DevFixtureConfig.json +35 -0
- package/json-schema/kernel/DevPluginConfig.json +170 -0
- package/json-schema/kernel/DevPluginPreset.json +10 -0
- package/json-schema/kernel/DevServiceOverride.json +41 -0
- package/json-schema/kernel/DevToolsConfig.json +45 -0
- package/json-schema/kernel/DisablePackageResponse.json +26 -0
- package/json-schema/kernel/EnablePackageResponse.json +26 -0
- package/json-schema/kernel/GetPackageResponse.json +26 -0
- package/json-schema/kernel/InstallPackageRequest.json +26 -0
- package/json-schema/kernel/InstallPackageResponse.json +26 -0
- package/json-schema/kernel/InstalledPackage.json +26 -0
- package/json-schema/kernel/ListPackagesResponse.json +26 -0
- package/json-schema/kernel/Manifest.json +26 -0
- package/json-schema/kernel/MetadataFallbackStrategy.json +9 -0
- package/json-schema/kernel/MetadataLoaderContract.json +7 -0
- package/json-schema/kernel/MetadataManagerConfig.json +21 -0
- package/json-schema/security/RLSAuditConfig.json +62 -0
- package/json-schema/security/RLSAuditEvent.json +66 -0
- package/json-schema/security/RLSConfig.json +62 -0
- package/json-schema/system/AuthConfig.json +83 -0
- package/json-schema/system/BackupConfig.json +148 -0
- package/json-schema/system/BackupRetention.json +27 -0
- package/json-schema/system/BackupStrategy.json +10 -0
- package/json-schema/system/CacheAvalanchePrevention.json +77 -0
- package/json-schema/system/CacheConsistency.json +11 -0
- package/json-schema/system/CacheWarmup.json +44 -0
- package/json-schema/system/ComplianceAuditRequirement.json +43 -0
- package/json-schema/system/ComplianceEncryptionRequirement.json +58 -0
- package/json-schema/system/DataClassificationPolicy.json +46 -0
- package/json-schema/system/DisasterRecoveryPlan.json +414 -0
- package/json-schema/system/DistributedCacheConfig.json +269 -0
- package/json-schema/system/FailoverConfig.json +102 -0
- package/json-schema/system/FailoverMode.json +11 -0
- package/json-schema/system/MaskingVisibilityRule.json +56 -0
- package/json-schema/system/MetadataFallbackStrategy.json +9 -0
- package/json-schema/system/MetadataLoaderContract.json +9 -1
- package/json-schema/system/MetadataManagerConfig.json +52 -11
- package/json-schema/system/MetadataRecord.json +32 -1
- package/json-schema/system/MetadataSource.json +10 -0
- package/json-schema/system/MutualTLSConfig.json +83 -0
- package/json-schema/system/RPO.json +27 -0
- package/json-schema/system/RTO.json +27 -0
- package/json-schema/system/SecurityContextConfig.json +288 -0
- package/json-schema/system/SecurityEventCorrelation.json +40 -0
- package/json-schema/ui/Action.json +200 -5
- package/json-schema/ui/ActionParam.json +62 -2
- package/json-schema/ui/AnimationTrigger.json +14 -0
- package/json-schema/ui/App.json +285 -7
- package/json-schema/ui/AriaProps.json +49 -0
- package/json-schema/ui/BreakpointColumnMap.json +38 -0
- package/json-schema/ui/BreakpointName.json +12 -0
- package/json-schema/ui/BreakpointOrderMap.json +26 -0
- package/json-schema/ui/ChartAnnotation.json +31 -1
- package/json-schema/ui/ChartAxis.json +30 -1
- package/json-schema/ui/ChartConfig.json +259 -7
- package/json-schema/ui/ChartSeries.json +30 -1
- package/json-schema/ui/ColumnSummary.json +18 -0
- package/json-schema/ui/ComponentAnimation.json +246 -0
- package/json-schema/ui/ConflictResolution.json +11 -0
- package/json-schema/ui/Dashboard.json +627 -11
- package/json-schema/ui/DashboardNavItem.json +30 -1
- package/json-schema/ui/DashboardWidget.json +433 -8
- package/json-schema/ui/DateFormat.json +36 -0
- package/json-schema/ui/DensityMode.json +9 -0
- package/json-schema/ui/DndConfig.json +306 -0
- package/json-schema/ui/DragConstraint.json +44 -0
- package/json-schema/ui/DragHandle.json +10 -0
- package/json-schema/ui/DragItem.json +160 -0
- package/json-schema/ui/DropEffect.json +11 -0
- package/json-schema/ui/DropZone.json +114 -0
- package/json-schema/ui/EasingFunction.json +13 -0
- package/json-schema/ui/EvictionPolicy.json +10 -0
- package/json-schema/ui/FocusManagement.json +69 -0
- package/json-schema/ui/FocusTrapConfig.json +32 -0
- package/json-schema/ui/FormField.json +90 -3
- package/json-schema/ui/GalleryConfig.json +46 -0
- package/json-schema/ui/GestureConfig.json +128 -0
- package/json-schema/ui/GestureType.json +14 -0
- package/json-schema/ui/GroupNavItem.json +30 -1
- package/json-schema/ui/GroupingConfig.json +45 -0
- package/json-schema/ui/GroupingField.json +30 -0
- package/json-schema/ui/I18nLabel.json +34 -0
- package/json-schema/ui/I18nObject.json +26 -0
- package/json-schema/ui/KeyboardNavigationConfig.json +194 -0
- package/json-schema/ui/KeyboardShortcut.json +66 -0
- package/json-schema/ui/ListColumn.json +55 -1
- package/json-schema/ui/ListView.json +435 -4
- package/json-schema/ui/LocaleConfig.json +108 -0
- package/json-schema/ui/LongPressGestureConfig.json +20 -0
- package/json-schema/ui/MotionConfig.json +405 -0
- package/json-schema/ui/NavigationItem.json +150 -5
- package/json-schema/ui/Notification.json +232 -0
- package/json-schema/ui/NotificationAction.json +60 -0
- package/json-schema/ui/NotificationConfig.json +52 -0
- package/json-schema/ui/NotificationPosition.json +13 -0
- package/json-schema/ui/NotificationSeverity.json +11 -0
- package/json-schema/ui/NotificationType.json +12 -0
- package/json-schema/ui/NumberFormat.json +42 -0
- package/json-schema/ui/ObjectNavItem.json +30 -1
- package/json-schema/ui/OfflineCacheConfig.json +40 -0
- package/json-schema/ui/OfflineConfig.json +157 -0
- package/json-schema/ui/OfflineStrategy.json +12 -0
- package/json-schema/ui/Page.json +285 -3
- package/json-schema/ui/PageCardProps.json +79 -1
- package/json-schema/ui/PageComponent.json +175 -1
- package/json-schema/ui/PageHeaderProps.json +108 -2
- package/json-schema/ui/PageNavItem.json +30 -1
- package/json-schema/ui/PageRegion.json +175 -1
- package/json-schema/ui/PageTabsProps.json +79 -1
- package/json-schema/ui/PageTransition.json +53 -0
- package/json-schema/ui/PerformanceConfig.json +57 -0
- package/json-schema/ui/PersistStorage.json +10 -0
- package/json-schema/ui/PinchGestureConfig.json +16 -0
- package/json-schema/ui/PluralRule.json +40 -0
- package/json-schema/ui/Report.json +490 -8
- package/json-schema/ui/ReportChart.json +199 -5
- package/json-schema/ui/ReportColumn.json +126 -1
- package/json-schema/ui/ResponsiveConfig.json +97 -0
- package/json-schema/ui/RowColorConfig.json +25 -0
- package/json-schema/ui/RowHeight.json +12 -0
- package/json-schema/ui/SwipeDirection.json +10 -0
- package/json-schema/ui/SwipeGestureConfig.json +32 -0
- package/json-schema/ui/SyncConfig.json +47 -0
- package/json-schema/ui/Theme.json +137 -0
- package/json-schema/ui/TimelineConfig.json +46 -0
- package/json-schema/ui/TouchInteraction.json +232 -0
- package/json-schema/ui/TouchTargetConfig.json +49 -0
- package/json-schema/ui/TransitionConfig.json +47 -0
- package/json-schema/ui/TransitionPreset.json +16 -0
- package/json-schema/ui/UrlNavItem.json +30 -1
- package/json-schema/ui/ViewSharing.json +24 -0
- package/json-schema/ui/WcagContrastLevel.json +8 -0
- package/json-schema/ui/WidgetEvent.json +60 -2
- package/json-schema/ui/WidgetManifest.json +284 -6
- package/json-schema/ui/WidgetProperty.json +60 -2
- package/package.json +1 -1
- package/dist/index-C6p-2KXV.d.ts +0 -767
- package/dist/index-CVnGe2b8.d.mts +0 -767
- package/dist/index-CZjkpp75.d.mts +0 -3867
- package/dist/index-CgkjUheS.d.ts +0 -3867
- package/dist/{index-B08s7rEU.d.mts → index-DmhxH5jy.d.mts} +8 -8
- package/dist/{index-DqnBqATx.d.ts → index-y5JJvyML.d.ts} +8 -8
package/dist/api/index.mjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/api/contract.zod.ts","../../src/data/query.zod.ts","../../src/data/filter.zod.ts","../../src/api/endpoint.zod.ts","../../src/shared/http.zod.ts","../../src/api/discovery.zod.ts","../../src/api/realtime.zod.ts","../../src/api/websocket.zod.ts","../../src/shared/identifiers.zod.ts","../../src/api/router.zod.ts","../../src/api/odata.zod.ts","../../src/api/graphql.zod.ts","../../src/api/batch.zod.ts","../../src/api/http-cache.zod.ts","../../src/api/errors.zod.ts","../../src/api/protocol.zod.ts","../../src/ui/view.zod.ts","../../src/security/permission.zod.ts","../../src/security/rls.zod.ts","../../src/automation/workflow.zod.ts","../../src/system/translation.zod.ts","../../src/kernel/package-registry.zod.ts","../../src/kernel/manifest.zod.ts","../../src/kernel/plugin-capability.zod.ts","../../src/kernel/plugin-loading.zod.ts","../../src/kernel/plugin.zod.ts","../../src/data/dataset.zod.ts","../../src/api/rest-server.zod.ts","../../src/api/registry.zod.ts","../../src/api/documentation.zod.ts","../../src/api/analytics.zod.ts","../../src/data/analytics.zod.ts","../../src/api/versioning.zod.ts","../../src/api/auth.zod.ts","../../src/api/auth-endpoints.zod.ts","../../src/api/storage.zod.ts","../../src/system/object-storage.zod.ts","../../src/api/metadata.zod.ts","../../src/data/object.zod.ts","../../src/data/field.zod.ts","../../src/system/encryption.zod.ts","../../src/system/masking.zod.ts","../../src/data/validation.zod.ts","../../src/automation/state-machine.zod.ts","../../src/ui/app.zod.ts","../../src/api/dispatcher.zod.ts","../../src/system/core-services.zod.ts","../../src/api/plugin-rest-api.zod.ts","../../src/system/http-server.zod.ts"],"sourcesContent":["// Copyright (c) 2025 ObjectStack. Licensed under the Apache-2.0 license.\n\nimport { z } from 'zod';\nimport { QuerySchema } from '../data/query.zod';\n\n// ==========================================\n// 1. Base Envelopes\n// ==========================================\n\nexport const ApiErrorSchema = z.object({\n code: z.string().describe('Error code (e.g. validation_error)'),\n message: z.string().describe('Readable error message'),\n category: z.string().optional().describe('Error category (e.g. validation, authorization)'),\n details: z.unknown().optional().describe('Additional error context (e.g. field validation errors)'),\n requestId: z.string().optional().describe('Request ID for tracking'),\n});\n\nexport const BaseResponseSchema = z.object({\n success: z.boolean().describe('Operation success status'),\n error: ApiErrorSchema.optional().describe('Error details if success is false'),\n meta: z.object({\n timestamp: z.string(),\n duration: z.number().optional(),\n requestId: z.string().optional(),\n traceId: z.string().optional(),\n }).optional().describe('Response metadata'),\n});\n\n// ==========================================\n// 2. Request Payloads (Inputs)\n// ==========================================\n\nexport const RecordDataSchema = z.record(z.string(), z.unknown()).describe('Key-value map of record data');\n\n/**\n * Standard Create Request\n */\nexport const CreateRequestSchema = z.object({\n data: RecordDataSchema.describe('Record data to insert'),\n});\n\n/**\n * Standard Update Request\n */\nexport const UpdateRequestSchema = z.object({\n data: RecordDataSchema.describe('Partial record data to update'),\n});\n\n/**\n * Standard Bulk Request\n */\nexport const BulkRequestSchema = z.object({\n records: z.array(RecordDataSchema).describe('Array of records to process'),\n allOrNone: z.boolean().default(true).describe('If true, rollback entire transaction on any failure'),\n});\n\n/**\n * Export Request\n */\nexport const ExportRequestSchema = z.intersection(\n QuerySchema,\n z.object({\n format: z.enum(['csv', 'json', 'xlsx']).default('csv'),\n })\n);\n\n// ==========================================\n// 3. Response Payloads (Outputs)\n// ==========================================\n\n/**\n * Single Record Response (Get/Create/Update)\n */\nexport const SingleRecordResponseSchema = BaseResponseSchema.extend({\n data: RecordDataSchema.describe('The requested or modified record'),\n});\n\n/**\n * List/Query Response\n */\nexport const ListRecordResponseSchema = BaseResponseSchema.extend({\n data: z.array(RecordDataSchema).describe('Array of matching records'),\n pagination: z.object({\n total: z.number().optional().describe('Total matching records count'),\n limit: z.number().optional().describe('Page size'),\n offset: z.number().optional().describe('Page offset'),\n cursor: z.string().optional().describe('Cursor for next page'),\n nextCursor: z.string().optional().describe('Next cursor for pagination'),\n hasMore: z.boolean().describe('Are there more pages?'),\n }).describe('Pagination info'),\n});\n\n/**\n * ID Request (Get/Delete)\n */\nexport const IdRequestSchema = z.object({\n id: z.string().describe('Record ID'),\n});\n\n/**\n * Modification Result (for Batch/Bulk operations)\n */\nexport const ModificationResultSchema = z.object({\n id: z.string().optional().describe('Record ID if processed'),\n success: z.boolean(),\n errors: z.array(ApiErrorSchema).optional(),\n index: z.number().optional().describe('Index in original request'),\n data: z.unknown().optional().describe('Result data (e.g. created record)'),\n});\n\n/**\n * Bulk Operation Response\n */\nexport const BulkResponseSchema = BaseResponseSchema.extend({\n data: z.array(ModificationResultSchema).describe('Results for each item in the batch'),\n});\n\n/**\n * Delete Response\n */\nexport const DeleteResponseSchema = BaseResponseSchema.extend({\n id: z.string().describe('ID of the deleted record'),\n});\n\n// ==========================================\n// 4. API Contract Registry\n// ==========================================\n\n/**\n * Standard API Contracts map\n * Used for generating SDKs and Documentation\n */\nexport const StandardApiContracts = {\n create: {\n input: CreateRequestSchema,\n output: SingleRecordResponseSchema\n },\n delete: {\n input: IdRequestSchema,\n output: DeleteResponseSchema\n },\n get: {\n input: IdRequestSchema,\n output: SingleRecordResponseSchema\n },\n update: {\n input: UpdateRequestSchema,\n output: SingleRecordResponseSchema\n },\n list: {\n input: QuerySchema,\n output: ListRecordResponseSchema\n },\n bulkCreate: {\n input: BulkRequestSchema,\n output: BulkResponseSchema\n },\n bulkUpdate: {\n input: BulkRequestSchema,\n output: BulkResponseSchema\n },\n bulkUpsert: {\n input: BulkRequestSchema,\n output: BulkResponseSchema\n },\n bulkDelete: {\n input: z.object({ ids: z.array(z.string()) }),\n output: BulkResponseSchema\n }\n};\n\nexport type ApiError = z.infer<typeof ApiErrorSchema>;\nexport type BaseResponse = z.infer<typeof BaseResponseSchema>;\nexport type RecordData = z.infer<typeof RecordDataSchema>;\nexport type CreateRequest = z.infer<typeof CreateRequestSchema>;\nexport type UpdateRequest = z.infer<typeof UpdateRequestSchema>;\nexport type BulkRequest = z.infer<typeof BulkRequestSchema>;\nexport type ExportRequest = z.infer<typeof ExportRequestSchema>;\nexport type SingleRecordResponse = z.infer<typeof SingleRecordResponseSchema>;\nexport type ListRecordResponse = z.infer<typeof ListRecordResponseSchema>;\nexport type IdRequest = z.infer<typeof IdRequestSchema>;\nexport type ModificationResult = z.infer<typeof ModificationResultSchema>;\nexport type BulkResponse = z.infer<typeof BulkResponseSchema>;\nexport type DeleteResponse = z.infer<typeof DeleteResponseSchema>;\n","// Copyright (c) 2025 ObjectStack. Licensed under the Apache-2.0 license.\n\nimport { z } from 'zod';\nimport { FilterConditionSchema } from './filter.zod';\n\n/**\n * Sort Node\n * Represents \"Order By\".\n */\nexport const SortNodeSchema = z.object({\n field: z.string(),\n order: z.enum(['asc', 'desc']).default('asc')\n});\n\n/**\n * Aggregation Function Enum\n * Standard aggregation functions for data analysis.\n * \n * Supported Functions:\n * - **count**: Count rows (SQL: COUNT(*) or COUNT(field))\n * - **sum**: Sum numeric values (SQL: SUM(field))\n * - **avg**: Average numeric values (SQL: AVG(field))\n * - **min**: Minimum value (SQL: MIN(field))\n * - **max**: Maximum value (SQL: MAX(field))\n * - **count_distinct**: Count unique values (SQL: COUNT(DISTINCT field))\n * - **array_agg**: Aggregate values into array (SQL: ARRAY_AGG(field))\n * - **string_agg**: Concatenate values (SQL: STRING_AGG(field, delimiter))\n * \n * Performance Considerations:\n * - COUNT(*) is typically faster than COUNT(field) as it doesn't check for nulls\n * - COUNT DISTINCT may require additional memory for tracking unique values\n * - Window aggregates (with OVER clause) can be more efficient than subqueries\n * - Large GROUP BY operations benefit from proper indexing on grouped fields\n * \n * @example\n * // SQL: SELECT region, SUM(amount) FROM sales GROUP BY region\n * {\n * object: 'sales',\n * fields: ['region'],\n * aggregations: [\n * { function: 'sum', field: 'amount', alias: 'total_sales' }\n * ],\n * groupBy: ['region']\n * }\n * \n * @example\n * // Salesforce SOQL: SELECT COUNT(Id) FROM Account\n * {\n * object: 'account',\n * aggregations: [\n * { function: 'count', alias: 'total_accounts' }\n * ]\n * }\n */\nexport const AggregationFunction = z.enum([\n 'count', 'sum', 'avg', 'min', 'max',\n 'count_distinct', 'array_agg', 'string_agg'\n]);\n\n/**\n * Aggregation Node\n * Represents an aggregated field with function.\n * \n * Aggregations summarize data across groups of rows (GROUP BY).\n * Used with `groupBy` to create analytical queries.\n * \n * @example\n * // SQL: SELECT customer_id, COUNT(*), SUM(amount) FROM orders GROUP BY customer_id\n * {\n * object: 'order',\n * fields: ['customer_id'],\n * aggregations: [\n * { function: 'count', alias: 'order_count' },\n * { function: 'sum', field: 'amount', alias: 'total_amount' }\n * ],\n * groupBy: ['customer_id']\n * }\n * \n * @example\n * // Salesforce SOQL: SELECT LeadSource, COUNT(Id) FROM Lead GROUP BY LeadSource\n * {\n * object: 'lead',\n * fields: ['lead_source'],\n * aggregations: [\n * { function: 'count', alias: 'lead_count' }\n * ],\n * groupBy: ['lead_source']\n * }\n */\nexport const AggregationNodeSchema = z.object({\n function: AggregationFunction.describe('Aggregation function'),\n field: z.string().optional().describe('Field to aggregate (optional for COUNT(*))'),\n alias: z.string().describe('Result column alias'),\n distinct: z.boolean().optional().describe('Apply DISTINCT before aggregation'),\n filter: FilterConditionSchema.optional().describe('Filter/Condition to apply to the aggregation (FILTER WHERE clause)'),\n});\n\n/**\n * Join Type Enum\n * Standard SQL join types for combining tables.\n * \n * Join Types:\n * - **inner**: Returns only matching rows from both tables (SQL: INNER JOIN)\n * - **left**: Returns all rows from left table, matching rows from right (SQL: LEFT JOIN)\n * - **right**: Returns all rows from right table, matching rows from left (SQL: RIGHT JOIN)\n * - **full**: Returns all rows from both tables (SQL: FULL OUTER JOIN)\n * \n * @example\n * // SQL: SELECT * FROM orders INNER JOIN customers ON orders.customer_id = customers.id\n * {\n * object: 'order',\n * joins: [\n * {\n * type: 'inner',\n * object: 'customer',\n * on: ['order.customer_id', '=', 'customer.id']\n * }\n * ]\n * }\n * \n * @example\n * // Salesforce SOQL-style: Find all customers and their orders (if any)\n * {\n * object: 'customer',\n * joins: [\n * {\n * type: 'left',\n * object: 'order',\n * on: ['customer.id', '=', 'order.customer_id']\n * }\n * ]\n * }\n */\nexport const JoinType = z.enum(['inner', 'left', 'right', 'full']);\n\n/**\n * Join Execution Strategy\n * Hints to the query engine on how to execute the join.\n * \n * Strategies:\n * - **auto**: Engine decides best strategy (Default).\n * - **database**: Push down join to the database (Requires same datasource).\n * - **hash**: Load both sets into memory and hash join (Cross-datasource, memory intensive).\n * - **loop**: Nested loop lookup (N+1 safe version). (Good for small right-side lookups).\n */\nexport const JoinStrategy = z.enum(['auto', 'database', 'hash', 'loop']);\n\n/**\n * Join Node\n * Represents table joins for combining data from multiple objects.\n * \n * Joins connect related data across multiple tables using ON conditions.\n * Supports both direct object joins and subquery joins.\n * \n * @example\n * // SQL: SELECT o.*, c.name FROM orders o INNER JOIN customers c ON o.customer_id = c.id\n * {\n * object: 'order',\n * fields: ['id', 'amount'],\n * joins: [\n * {\n * type: 'inner',\n * object: 'customer',\n * alias: 'c',\n * on: ['order.customer_id', '=', 'c.id']\n * }\n * ]\n * }\n * \n * @example\n * // SQL: Multi-table join\n * // SELECT * FROM orders o\n * // INNER JOIN customers c ON o.customer_id = c.id\n * // LEFT JOIN shipments s ON o.id = s.order_id\n * {\n * object: 'order',\n * joins: [\n * {\n * type: 'inner',\n * object: 'customer',\n * alias: 'c',\n * on: ['order.customer_id', '=', 'c.id']\n * },\n * {\n * type: 'left',\n * object: 'shipment',\n * alias: 's',\n * on: ['order.id', '=', 's.order_id']\n * }\n * ]\n * }\n * \n * @example\n * // Salesforce SOQL: SELECT Name, (SELECT LastName FROM Contacts) FROM Account\n * {\n * object: 'account',\n * fields: ['name'],\n * joins: [\n * {\n * type: 'left',\n * object: 'contact',\n * on: ['account.id', '=', 'contact.account_id']\n * }\n * ]\n * }\n * \n * @example\n * // Subquery Join: Join with a filtered/aggregated dataset\n * {\n * object: 'customer',\n * joins: [\n * {\n * type: 'left',\n * object: 'order',\n * alias: 'high_value_orders',\n * on: ['customer.id', '=', 'high_value_orders.customer_id'],\n * subquery: {\n * object: 'order',\n * fields: ['customer_id', 'total'],\n * filters: ['total', '>', 1000]\n * }\n * }\n * ]\n * }\n */\nexport const JoinNodeSchema: z.ZodType<any> = z.lazy(() => \n z.object({\n type: JoinType.describe('Join type'),\n strategy: JoinStrategy.optional().describe('Execution strategy hint'),\n object: z.string().describe('Object/table to join'),\n alias: z.string().optional().describe('Table alias'),\n on: FilterConditionSchema.describe('Join condition'),\n subquery: z.lazy(() => QuerySchema).optional().describe('Subquery instead of object'),\n })\n);\n\n/**\n * Window Function Enum\n * Advanced analytical functions for row-based calculations.\n * \n * Window Functions:\n * - **row_number**: Sequential number within partition (SQL: ROW_NUMBER() OVER (...))\n * - **rank**: Rank with gaps for ties (SQL: RANK() OVER (...))\n * - **dense_rank**: Rank without gaps (SQL: DENSE_RANK() OVER (...))\n * - **percent_rank**: Relative rank as percentage (SQL: PERCENT_RANK() OVER (...))\n * - **lag**: Access previous row value (SQL: LAG(field) OVER (...))\n * - **lead**: Access next row value (SQL: LEAD(field) OVER (...))\n * - **first_value**: First value in window (SQL: FIRST_VALUE(field) OVER (...))\n * - **last_value**: Last value in window (SQL: LAST_VALUE(field) OVER (...))\n * - **sum/avg/count/min/max**: Aggregates over window (SQL: SUM(field) OVER (...))\n * \n * @example\n * // SQL: SELECT *, ROW_NUMBER() OVER (PARTITION BY customer_id ORDER BY amount DESC) as rank\n * // FROM orders\n * {\n * object: 'order',\n * fields: ['id', 'customer_id', 'amount'],\n * windowFunctions: [\n * {\n * function: 'row_number',\n * alias: 'rank',\n * over: {\n * partitionBy: ['customer_id'],\n * orderBy: [{ field: 'amount', order: 'desc' }]\n * }\n * }\n * ]\n * }\n * \n * @example\n * // SQL: Running total with SUM() OVER (...)\n * {\n * object: 'transaction',\n * fields: ['date', 'amount'],\n * windowFunctions: [\n * {\n * function: 'sum',\n * field: 'amount',\n * alias: 'running_total',\n * over: {\n * orderBy: [{ field: 'date', order: 'asc' }],\n * frame: {\n * type: 'rows',\n * start: 'UNBOUNDED PRECEDING',\n * end: 'CURRENT ROW'\n * }\n * }\n * }\n * ]\n * }\n */\nexport const WindowFunction = z.enum([\n 'row_number', 'rank', 'dense_rank', 'percent_rank',\n 'lag', 'lead', 'first_value', 'last_value',\n 'sum', 'avg', 'count', 'min', 'max'\n]);\n\n/**\n * Window Specification\n * Defines PARTITION BY and ORDER BY for window functions.\n * \n * Window specifications control how window functions compute values:\n * - **partitionBy**: Divide rows into groups (like GROUP BY but without collapsing rows)\n * - **orderBy**: Define order for ranking and offset functions\n * - **frame**: Specify which rows to include in aggregate calculations\n * \n * @example\n * // Partition by department, order by salary\n * {\n * partitionBy: ['department'],\n * orderBy: [{ field: 'salary', order: 'desc' }]\n * }\n * \n * @example\n * // Moving average with frame specification\n * {\n * orderBy: [{ field: 'date', order: 'asc' }],\n * frame: {\n * type: 'rows',\n * start: '6 PRECEDING',\n * end: 'CURRENT ROW'\n * }\n * }\n */\nexport const WindowSpecSchema = z.object({\n partitionBy: z.array(z.string()).optional().describe('PARTITION BY fields'),\n orderBy: z.array(SortNodeSchema).optional().describe('ORDER BY specification'),\n frame: z.object({\n type: z.enum(['rows', 'range']).optional(),\n start: z.string().optional().describe('Frame start (e.g., \"UNBOUNDED PRECEDING\", \"1 PRECEDING\")'),\n end: z.string().optional().describe('Frame end (e.g., \"CURRENT ROW\", \"1 FOLLOWING\")'),\n }).optional().describe('Window frame specification'),\n});\n\n/**\n * Window Function Node\n * Represents window function with OVER clause.\n * \n * Window functions perform calculations across a set of rows related to the current row,\n * without collapsing the result set (unlike GROUP BY aggregations).\n * \n * @example\n * // SQL: Top 3 products per category\n * // SELECT *, ROW_NUMBER() OVER (PARTITION BY category ORDER BY sales DESC) as rank\n * // FROM products\n * {\n * object: 'product',\n * fields: ['name', 'category', 'sales'],\n * windowFunctions: [\n * {\n * function: 'row_number',\n * alias: 'category_rank',\n * over: {\n * partitionBy: ['category'],\n * orderBy: [{ field: 'sales', order: 'desc' }]\n * }\n * }\n * ]\n * }\n * \n * @example\n * // SQL: Year-over-year comparison with LAG\n * {\n * object: 'monthly_sales',\n * fields: ['month', 'revenue'],\n * windowFunctions: [\n * {\n * function: 'lag',\n * field: 'revenue',\n * alias: 'prev_year_revenue',\n * over: {\n * orderBy: [{ field: 'month', order: 'asc' }]\n * }\n * }\n * ]\n * }\n */\nexport const WindowFunctionNodeSchema = z.object({\n function: WindowFunction.describe('Window function name'),\n field: z.string().optional().describe('Field to operate on (for aggregate window functions)'),\n alias: z.string().describe('Result column alias'),\n over: WindowSpecSchema.describe('Window specification (OVER clause)'),\n});\n\n/**\n * Field Selection Node\n * Represents \"Select\" attributes, including joins.\n */\nexport const FieldNodeSchema: z.ZodType<any> = z.lazy(() => \n z.union([\n z.string(), // Primitive field: \"name\"\n z.object({\n field: z.string(), // Relationship field: \"owner\"\n fields: z.array(FieldNodeSchema).optional(), // Nested select: [\"name\", \"email\"]\n alias: z.string().optional()\n })\n ])\n);\n\n/**\n * Full-Text Search Configuration\n * Defines full-text search parameters for text queries.\n * \n * Supports:\n * - Multi-field search\n * - Relevance scoring\n * - Fuzzy matching\n * - Language-specific analyzers\n * \n * @example\n * {\n * query: \"John Smith\",\n * fields: [\"name\", \"email\", \"description\"],\n * fuzzy: true,\n * boost: { \"name\": 2.0, \"email\": 1.5 }\n * }\n */\nexport const FullTextSearchSchema = z.object({\n query: z.string().describe('Search query text'),\n fields: z.array(z.string()).optional().describe('Fields to search in (if not specified, searches all text fields)'),\n fuzzy: z.boolean().optional().default(false).describe('Enable fuzzy matching (tolerates typos)'),\n operator: z.enum(['and', 'or']).optional().default('or').describe('Logical operator between terms'),\n boost: z.record(z.string(), z.number()).optional().describe('Field-specific relevance boosting (field name -> boost factor)'),\n minScore: z.number().optional().describe('Minimum relevance score threshold'),\n language: z.string().optional().describe('Language for text analysis (e.g., \"en\", \"zh\", \"es\")'),\n highlight: z.boolean().optional().default(false).describe('Enable search result highlighting'),\n});\n\nexport type FullTextSearch = z.infer<typeof FullTextSearchSchema>;\n\n/**\n * Query AST Schema\n * The universal data retrieval contract defined in `ast-structure.mdx`.\n * \n * This schema represents ObjectQL - a universal query language that abstracts\n * SQL, NoSQL, and SaaS APIs into a single unified interface.\n * \n * Updates (v2):\n * - Aligned with modern ORM standards (Prisma/TypeORM)\n * - Added `cursor` based pagination support\n * - Renamed `top`/`skip` to `limit`/`offset`\n * - Unified filtering syntax with `FilterConditionSchema`\n * \n * Updates (v3):\n * - Added `search` parameter for full-text search (P2 requirement)\n * \n * @example\n * // Simple query: SELECT name, email FROM account WHERE status = 'active'\n * {\n * object: 'account',\n * fields: ['name', 'email'],\n * where: { status: 'active' }\n * }\n * \n * @example\n * // Pagination with Limit/Offset\n * {\n * object: 'post',\n * where: { published: true },\n * orderBy: [{ field: 'created_at', order: 'desc' }],\n * limit: 20,\n * offset: 40\n * }\n * \n * @example\n * // Full-text search\n * {\n * object: 'article',\n * search: {\n * query: \"machine learning\",\n * fields: [\"title\", \"content\"],\n * fuzzy: true,\n * boost: { \"title\": 2.0 }\n * },\n * limit: 10\n * }\n */\nconst BaseQuerySchema = z.object({\n /** Target Entity */\n object: z.string().describe('Object name (e.g. account)'),\n \n /** Select Clause */\n fields: z.array(FieldNodeSchema).optional().describe('Fields to retrieve'),\n \n /** Where Clause (Filtering) */\n where: FilterConditionSchema.optional().describe('Filtering criteria (WHERE)'),\n \n /** Full-Text Search */\n search: FullTextSearchSchema.optional().describe('Full-text search configuration ($search parameter)'),\n \n /** Order By Clause (Sorting) */\n orderBy: z.array(SortNodeSchema).optional().describe('Sorting instructions (ORDER BY)'),\n \n /** Pagination */\n limit: z.number().optional().describe('Max records to return (LIMIT)'),\n offset: z.number().optional().describe('Records to skip (OFFSET)'),\n top: z.number().optional().describe('Alias for limit (OData compatibility)'),\n cursor: z.record(z.string(), z.unknown()).optional().describe('Cursor for keyset pagination'),\n \n /** Joins */\n joins: z.array(JoinNodeSchema).optional().describe('Explicit Table Joins'),\n \n /** Aggregations */\n aggregations: z.array(AggregationNodeSchema).optional().describe('Aggregation functions'),\n \n /** Group By Clause */\n groupBy: z.array(z.string()).optional().describe('GROUP BY fields'),\n \n /** Having Clause */\n having: FilterConditionSchema.optional().describe('HAVING clause for aggregation filtering'),\n \n /** Window Functions */\n windowFunctions: z.array(WindowFunctionNodeSchema).optional().describe('Window functions with OVER clause'),\n \n /** Subquery flag */\n distinct: z.boolean().optional().describe('SELECT DISTINCT flag'),\n});\n\nexport type QueryAST = z.infer<typeof BaseQuerySchema> & {\n expand?: Record<string, QueryAST>;\n};\n\nexport type QueryInput = z.input<typeof BaseQuerySchema> & {\n expand?: Record<string, QueryInput>;\n};\n\nexport const QuerySchema: z.ZodType<QueryAST> = BaseQuerySchema.extend({\n expand: z.lazy(() => z.record(z.string(), QuerySchema)).optional().describe('Recursive relation loading (nested queries)'),\n});\n\nexport type SortNode = z.infer<typeof SortNodeSchema>;\nexport type AggregationNode = z.infer<typeof AggregationNodeSchema>;\nexport type JoinNode = z.infer<typeof JoinNodeSchema>;\nexport type WindowFunctionNode = z.infer<typeof WindowFunctionNodeSchema>;\nexport type WindowSpec = z.infer<typeof WindowSpecSchema>;\n","// Copyright (c) 2025 ObjectStack. Licensed under the Apache-2.0 license.\n\nimport { z } from 'zod';\n\n/**\n * Unified Query DSL Specification\n * \n * Based on industry best practices from:\n * - Prisma ORM\n * - Strapi CMS\n * - TypeORM\n * - LoopBack Framework\n * \n * Version: 1.0.0\n * Status: Draft\n * \n * Objective: Define a JSON-based, database-agnostic query syntax standard\n * for data filtering interactions between frontend and backend APIs.\n * \n * Design Principles:\n * 1. Declarative: Frontend describes \"what data to get\", not \"how to query\"\n * 2. Database Agnostic: Syntax contains no database-specific directives\n * 3. Type Safe: Structure can be statically inferred by TypeScript\n * 4. Convention over Configuration: Implicit syntax for common queries\n */\n\n/**\n * Field Reference\n * Represents a reference to another field/column instead of a literal value.\n * Used for joins (ON clause) and cross-field comparisons.\n * \n * @example\n * // user.id = order.owner_id\n * { \"$eq\": { \"$field\": \"order.owner_id\" } }\n */\nexport const FieldReferenceSchema = z.object({\n $field: z.string().describe('Field Reference/Column Name')\n});\n\nexport type FieldReference = z.infer<typeof FieldReferenceSchema>;\n\n// ============================================================================\n// 3.1 Comparison Operators\n// ============================================================================\n\n/**\n * Comparison operators for equality and inequality checks.\n * Supported data types: Any\n */\nexport const EqualityOperatorSchema = z.object({\n /** Equal to (default) - SQL: = | MongoDB: $eq */\n $eq: z.any().optional(),\n \n /** Not equal to - SQL: <> or != | MongoDB: $ne */\n $ne: z.any().optional(),\n});\n\n/**\n * Comparison operators for numeric and date comparisons.\n * Supported data types: Number, Date\n */\nexport const ComparisonOperatorSchema = z.object({\n /** Greater than - SQL: > | MongoDB: $gt */\n $gt: z.union([z.number(), z.date(), FieldReferenceSchema]).optional(),\n \n /** Greater than or equal to - SQL: >= | MongoDB: $gte */\n $gte: z.union([z.number(), z.date(), FieldReferenceSchema]).optional(),\n \n /** Less than - SQL: < | MongoDB: $lt */\n $lt: z.union([z.number(), z.date(), FieldReferenceSchema]).optional(),\n \n /** Less than or equal to - SQL: <= | MongoDB: $lte */\n $lte: z.union([z.number(), z.date(), FieldReferenceSchema]).optional(),\n});\n\n// ============================================================================\n// 3.2 Set & Range Operators\n// ============================================================================\n\n/**\n * Set operators for membership checks.\n */\nexport const SetOperatorSchema = z.object({\n /** In list - SQL: IN (?, ?, ?) | MongoDB: $in */\n $in: z.array(z.any()).optional(),\n \n /** Not in list - SQL: NOT IN (...) | MongoDB: $nin */\n $nin: z.array(z.any()).optional(),\n});\n\n/**\n * Range operator for interval checks (closed interval).\n * SQL: BETWEEN ? AND ? | MongoDB: $gte AND $lte\n */\nexport const RangeOperatorSchema = z.object({\n /** Between (inclusive) - takes [min, max] array */\n $between: z.tuple([\n z.union([z.number(), z.date(), FieldReferenceSchema]),\n z.union([z.number(), z.date(), FieldReferenceSchema])\n ]).optional(),\n});\n\n// ============================================================================\n// 3.3 String-Specific Operators\n// ============================================================================\n\n/**\n * String pattern matching operators.\n * Note: Case sensitivity should be handled at backend level.\n */\nexport const StringOperatorSchema = z.object({\n /** Contains substring - SQL: LIKE %?% | MongoDB: $regex */\n $contains: z.string().optional(),\n \n /** Starts with prefix - SQL: LIKE ?% | MongoDB: $regex */\n $startsWith: z.string().optional(),\n \n /** Ends with suffix - SQL: LIKE %? | MongoDB: $regex */\n $endsWith: z.string().optional(),\n});\n\n// ============================================================================\n// 3.5 Special Operators\n// ============================================================================\n\n/**\n * Special check operators for null and existence.\n */\nexport const SpecialOperatorSchema = z.object({\n /** Is null check - SQL: IS NULL (true) / IS NOT NULL (false) | MongoDB: field: null */\n $null: z.boolean().optional(),\n \n /** Field exists check (primarily for NoSQL) - MongoDB: $exists */\n $exists: z.boolean().optional(),\n});\n\n// ============================================================================\n// Combined Field Operators\n// ============================================================================\n\n/**\n * All field-level operators combined.\n * These can be applied to individual fields in a filter.\n */\nexport const FieldOperatorsSchema = z.object({\n // Equality\n $eq: z.any().optional(),\n $ne: z.any().optional(),\n \n // Comparison (numeric/date)\n $gt: z.union([z.number(), z.date(), FieldReferenceSchema]).optional(),\n $gte: z.union([z.number(), z.date(), FieldReferenceSchema]).optional(),\n $lt: z.union([z.number(), z.date(), FieldReferenceSchema]).optional(),\n $lte: z.union([z.number(), z.date(), FieldReferenceSchema]).optional(),\n \n // Set & Range\n $in: z.array(z.any()).optional(),\n $nin: z.array(z.any()).optional(),\n $between: z.tuple([\n z.union([z.number(), z.date(), FieldReferenceSchema]),\n z.union([z.number(), z.date(), FieldReferenceSchema])\n ]).optional(),\n \n // String-specific\n $contains: z.string().optional(),\n $startsWith: z.string().optional(),\n $endsWith: z.string().optional(),\n \n // Special\n $null: z.boolean().optional(),\n $exists: z.boolean().optional(),\n});\n\n// ============================================================================\n// 3.4 Logical Operators & Recursive Filter Structure\n// ============================================================================\n\n/**\n * Recursive filter type that supports:\n * 1. Implicit equality: { field: value }\n * 2. Explicit operators: { field: { $op: value } }\n * 3. Logical combinations: { $and: [...], $or: [...], $not: {...} }\n * 4. Nested relations: { relation: { field: value } }\n */\nexport type FilterCondition = {\n [key: string]: \n | any // Implicit equality: key: value\n | z.infer<typeof FieldOperatorsSchema> // Explicit operators: key: { $op: value }\n | FilterCondition; // Nested relation: key: { nested: ... }\n} & {\n /** Logical AND - combines all conditions that must be true */\n $and?: FilterCondition[];\n \n /** Logical OR - at least one condition must be true */\n $or?: FilterCondition[];\n \n /** Logical NOT - negates the condition */\n $not?: FilterCondition;\n};\n\n/**\n * Zod schema for recursive filter validation.\n * Uses z.lazy() to handle recursive structure.\n */\nexport const FilterConditionSchema: z.ZodType<FilterCondition> = z.lazy(() =>\n z.record(z.string(), z.unknown()).and(\n z.object({\n $and: z.array(FilterConditionSchema).optional(),\n $or: z.array(FilterConditionSchema).optional(),\n $not: FilterConditionSchema.optional(),\n })\n )\n);\n\n// ============================================================================\n// Query Filter Wrapper\n// ============================================================================\n\n/**\n * Top-level query filter wrapper.\n * This is typically used as the \"where\" clause in a query.\n * \n * @example\n * ```typescript\n * const filter: QueryFilter = {\n * where: {\n * status: \"active\", // Implicit equality\n * age: { $gte: 18 }, // Explicit operator\n * $or: [ // Logical combination\n * { role: \"admin\" },\n * { email: { $contains: \"@company.com\" } }\n * ],\n * profile: { // Nested relation\n * verified: true\n * }\n * }\n * }\n * ```\n */\nexport const QueryFilterSchema = z.object({\n where: FilterConditionSchema.optional(),\n});\n\n// ============================================================================\n// TypeScript Type Exports\n// ============================================================================\n\n/**\n * Type-safe filter operators for use in TypeScript.\n * \n * @example\n * ```typescript\n * type UserFilter = Filter<User>;\n * \n * const filter: UserFilter = {\n * age: { $gte: 18 },\n * email: { $contains: \"@example.com\" }\n * };\n * ```\n */\nexport type Filter<T = any> = {\n [K in keyof T]?: \n | T[K] // Implicit equality\n | {\n $eq?: T[K];\n $ne?: T[K];\n $gt?: T[K] extends number | Date ? T[K] : never;\n $gte?: T[K] extends number | Date ? T[K] : never;\n $lt?: T[K] extends number | Date ? T[K] : never;\n $lte?: T[K] extends number | Date ? T[K] : never;\n $in?: T[K][];\n $nin?: T[K][];\n $between?: T[K] extends number | Date ? [T[K], T[K]] : never;\n $contains?: T[K] extends string ? string : never;\n $startsWith?: T[K] extends string ? string : never;\n $endsWith?: T[K] extends string ? string : never;\n $null?: boolean;\n $exists?: boolean;\n }\n | (T[K] extends object ? Filter<T[K]> : never); // Nested relation\n} & {\n $and?: Filter<T>[];\n $or?: Filter<T>[];\n $not?: Filter<T>;\n};\n\n/**\n * Scalar types supported by the filter system.\n */\nexport type Scalar = string | number | boolean | Date | null;\n\n// Export inferred types\nexport type FieldOperators = z.infer<typeof FieldOperatorsSchema>;\nexport type QueryFilter = z.infer<typeof QueryFilterSchema>;\n\n// ============================================================================\n// Normalization Utilities (Internal Representation)\n// ============================================================================\n\n/**\n * Normalized filter AST structure.\n * This is the internal representation after converting all syntactic sugar\n * to explicit operators.\n * \n * Stage 1: Normalization Pass\n * Input: { age: 18, role: \"admin\" }\n * Output: { $and: [{ age: { $eq: 18 } }, { role: { $eq: \"admin\" } }] }\n * \n * This simplifies adapter implementation by providing a consistent structure.\n */\nexport const NormalizedFilterSchema: z.ZodType<any> = z.lazy(() => \n z.object({\n $and: z.array(\n z.union([\n // Field condition: { field: { $op: value } }\n z.record(z.string(), FieldOperatorsSchema),\n // Nested logical group\n NormalizedFilterSchema,\n ])\n ).optional(),\n \n $or: z.array(\n z.union([\n z.record(z.string(), FieldOperatorsSchema),\n NormalizedFilterSchema,\n ])\n ).optional(),\n \n $not: z.union([\n z.record(z.string(), FieldOperatorsSchema),\n NormalizedFilterSchema,\n ]).optional(),\n })\n);\n\nexport type NormalizedFilter = z.infer<typeof NormalizedFilterSchema>;\n\n// ============================================================================\n// Constants & Metadata\n// ============================================================================\n\n/**\n * All supported operator keys.\n * Useful for validation and parsing.\n */\nexport const FILTER_OPERATORS = [\n // Equality\n '$eq', '$ne',\n // Comparison\n '$gt', '$gte', '$lt', '$lte',\n // Set & Range\n '$in', '$nin', '$between',\n // String\n '$contains', '$startsWith', '$endsWith',\n // Special\n '$null', '$exists',\n] as const;\n\n/**\n * Logical operator keys.\n */\nexport const LOGICAL_OPERATORS = ['$and', '$or', '$not'] as const;\n\n/**\n * All operator keys (field + logical).\n */\nexport const ALL_OPERATORS = [...FILTER_OPERATORS, ...LOGICAL_OPERATORS] as const;\n\nexport type FilterOperatorKey = typeof FILTER_OPERATORS[number];\nexport type LogicalOperatorKey = typeof LOGICAL_OPERATORS[number];\nexport type OperatorKey = typeof ALL_OPERATORS[number];\n","// Copyright (c) 2025 ObjectStack. Licensed under the Apache-2.0 license.\n\nimport { z } from 'zod';\nimport { HttpMethod, RateLimitConfigSchema } from '../shared/http.zod';\n\n/**\n * Rate Limit Strategy\n * @deprecated Use RateLimitConfigSchema from shared/http.zod.ts instead\n */\nexport const RateLimitSchema = RateLimitConfigSchema;\n\n/**\n * API Mapping Schema\n * Transform input/output data.\n */\nexport const ApiMappingSchema = z.object({\n source: z.string().describe('Source field/path'),\n target: z.string().describe('Target field/path'),\n transform: z.string().optional().describe('Transformation function name'),\n});\n\n/**\n * API Endpoint Schema\n * Defines an external facing API contract.\n */\nexport const ApiEndpointSchema = z.object({\n /** Identity */\n name: z.string().regex(/^[a-z_][a-z0-9_]*$/).describe('Unique endpoint ID'),\n path: z.string().regex(/^\\//).describe('URL Path (e.g. /api/v1/customers)'),\n method: HttpMethod.describe('HTTP Method'),\n \n /** Documentation */\n summary: z.string().optional(),\n description: z.string().optional(),\n \n /** Execution Logic */\n type: z.enum(['flow', 'script', 'object_operation', 'proxy']).describe('Implementation type'),\n target: z.string().describe('Target Flow ID, Script Name, or Proxy URL'),\n \n /** Logic Config */\n objectParams: z.object({\n object: z.string().optional(),\n operation: z.enum(['find', 'get', 'create', 'update', 'delete']).optional(),\n }).optional().describe('For object_operation type'),\n \n /** Data Transformation */\n inputMapping: z.array(ApiMappingSchema).optional().describe('Map Request Body to Internal Params'),\n outputMapping: z.array(ApiMappingSchema).optional().describe('Map Internal Result to Response Body'),\n \n /** Policies */\n authRequired: z.boolean().default(true).describe('Require authentication'),\n rateLimit: RateLimitSchema.optional().describe('Rate limiting policy'),\n cacheTtl: z.number().optional().describe('Response cache TTL in seconds'),\n});\n\nexport const ApiEndpoint = Object.assign(ApiEndpointSchema, {\n create: <T extends z.input<typeof ApiEndpointSchema>>(config: T) => config,\n});\n\nexport type ApiEndpoint = z.infer<typeof ApiEndpointSchema>;\nexport type ApiEndpointInput = z.input<typeof ApiEndpointSchema>;\n","// Copyright (c) 2025 ObjectStack. Licensed under the Apache-2.0 license.\n\nimport { z } from 'zod';\n\n/**\n * Shared HTTP Schemas\n * \n * Common HTTP-related schemas used across API and System protocols.\n * These schemas ensure consistency across different parts of the stack.\n */\n\n// ==========================================\n// Basic HTTP Types\n// ==========================================\n\n/**\n * HTTP Method Enum\n */\nexport const HttpMethod = z.enum([\n 'GET', \n 'POST', \n 'PUT', \n 'DELETE', \n 'PATCH', \n 'HEAD', \n 'OPTIONS'\n]);\n\nexport type HttpMethod = z.infer<typeof HttpMethod>;\n\n// ==========================================\n// CORS Configuration\n// ==========================================\n\n/**\n * CORS Configuration Schema\n * Cross-Origin Resource Sharing configuration\n * \n * Used by:\n * - api/router.zod.ts (RouterConfigSchema)\n * - system/http-server.zod.ts (HttpServerConfigSchema)\n * \n * @example\n * {\n * \"enabled\": true,\n * \"origins\": [\"http://localhost:3000\", \"https://app.example.com\"],\n * \"methods\": [\"GET\", \"POST\", \"PUT\", \"DELETE\"],\n * \"credentials\": true,\n * \"maxAge\": 86400\n * }\n */\nexport const CorsConfigSchema = z.object({\n /**\n * Enable CORS\n */\n enabled: z.boolean().default(true).describe('Enable CORS'),\n \n /**\n * Allowed origins (* for all)\n */\n origins: z.union([\n z.string(),\n z.array(z.string())\n ]).default('*').describe('Allowed origins (* for all)'),\n \n /**\n * Allowed HTTP methods\n */\n methods: z.array(HttpMethod).optional().describe('Allowed HTTP methods'),\n \n /**\n * Allow credentials (cookies, authorization headers)\n */\n credentials: z.boolean().default(false).describe('Allow credentials (cookies, authorization headers)'),\n \n /**\n * Preflight cache duration in seconds\n */\n maxAge: z.number().int().optional().describe('Preflight cache duration in seconds'),\n});\n\nexport type CorsConfig = z.infer<typeof CorsConfigSchema>;\n\n// ==========================================\n// Rate Limiting\n// ==========================================\n\n/**\n * Rate Limit Configuration Schema\n * \n * Used by:\n * - api/endpoint.zod.ts (ApiEndpointSchema)\n * - system/http-server.zod.ts (HttpServerConfigSchema)\n * \n * @example\n * {\n * \"enabled\": true,\n * \"windowMs\": 60000,\n * \"maxRequests\": 100\n * }\n */\nexport const RateLimitConfigSchema = z.object({\n /**\n * Enable rate limiting\n */\n enabled: z.boolean().default(false).describe('Enable rate limiting'),\n \n /**\n * Time window in milliseconds\n */\n windowMs: z.number().int().default(60000).describe('Time window in milliseconds'),\n \n /**\n * Max requests per window\n */\n maxRequests: z.number().int().default(100).describe('Max requests per window'),\n});\n\nexport type RateLimitConfig = z.infer<typeof RateLimitConfigSchema>;\n\n// ==========================================\n// Static File Serving\n// ==========================================\n\n/**\n * Static Mount Configuration Schema\n * Configuration for serving static files\n * \n * Used by:\n * - api/router.zod.ts (RouterConfigSchema)\n * - system/http-server.zod.ts (HttpServerConfigSchema)\n * \n * @example\n * {\n * \"path\": \"/static\",\n * \"directory\": \"./public\",\n * \"cacheControl\": \"public, max-age=31536000\"\n * }\n */\nexport const StaticMountSchema = z.object({\n /**\n * URL path to serve from\n */\n path: z.string().describe('URL path to serve from'),\n \n /**\n * Physical directory to serve\n */\n directory: z.string().describe('Physical directory to serve'),\n \n /**\n * Cache-Control header value\n */\n cacheControl: z.string().optional().describe('Cache-Control header value'),\n});\n\nexport type StaticMount = z.infer<typeof StaticMountSchema>;\n","// Copyright (c) 2025 ObjectStack. Licensed under the Apache-2.0 license.\n\nimport { z } from 'zod';\n\n/**\n * API Capabilities Schema\n * Defines what features are enabled on this ObjectOS instance.\n */\nexport const ApiCapabilitiesSchema = z.object({\n graphql: z.boolean().default(false),\n search: z.boolean().default(false),\n websockets: z.boolean().default(false),\n files: z.boolean().default(true),\n analytics: z.boolean().default(false).describe('Is the Analytics/BI engine enabled?'),\n ai: z.boolean().default(false).describe('Is the AI engine enabled?'),\n workflow: z.boolean().default(false).describe('Is the Workflow engine enabled?'),\n notifications: z.boolean().default(false).describe('Is the Notification service enabled?'),\n i18n: z.boolean().default(false).describe('Is the i18n service enabled?'),\n});\n\n/**\n * Service Status in Discovery Response\n * Reports per-service availability so clients can adapt their UI accordingly.\n */\nexport const ServiceInfoSchema = z.object({\n /** Whether the service is enabled and available */\n enabled: z.boolean(),\n /** Current operational status */\n status: z.enum(['available', 'unavailable', 'degraded', 'stub']).describe(\n 'available = fully operational, unavailable = not installed, degraded = partial, stub = placeholder that throws'\n ),\n /** Route path (only present if enabled) */\n route: z.string().optional().describe('e.g. /api/v1/analytics'),\n /** Implementation provider name */\n provider: z.string().optional().describe('e.g. \"objectql\", \"plugin-redis\", \"driver-memory\"'),\n /** Human-readable reason if unavailable */\n message: z.string().optional().describe('e.g. \"Install plugin-workflow to enable\"'),\n});\n\n/**\n * API Routes Schema\n * The \"Map\" for the frontend to know where to send requests.\n * This decouples the frontend from hardcoded URL paths.\n */\nexport const ApiRoutesSchema = z.object({\n /** Base URL for Object CRUD (Data Protocol) */\n data: z.string().describe('e.g. /api/v1/data'),\n \n /** Base URL for Schema Definitions (Metadata Protocol) */\n metadata: z.string().describe('e.g. /api/v1/meta'),\n\n /** Base URL for UI Configurations (Views, Menus) */\n ui: z.string().optional().describe('e.g. /api/v1/ui'),\n \n /** Base URL for Authentication (plugin-provided) */\n auth: z.string().optional().describe('e.g. /api/v1/auth'),\n \n /** Base URL for Automation (Flows/Scripts) */\n automation: z.string().optional().describe('e.g. /api/v1/automation'),\n \n /** Base URL for File/Storage operations */\n storage: z.string().optional().describe('e.g. /api/v1/storage'),\n \n /** Base URL for Analytics/BI operations */\n analytics: z.string().optional().describe('e.g. /api/v1/analytics'),\n \n /** GraphQL Endpoint (if enabled) */\n graphql: z.string().optional().describe('e.g. /graphql'),\n\n /** Base URL for Package Management */\n packages: z.string().optional().describe('e.g. /api/v1/packages'),\n\n /** Base URL for Workflow Engine */\n workflow: z.string().optional().describe('e.g. /api/v1/workflow'),\n\n /** Base URL for Realtime (WebSocket/SSE) */\n realtime: z.string().optional().describe('e.g. /api/v1/realtime'),\n\n /** Base URL for Notification Service */\n notifications: z.string().optional().describe('e.g. /api/v1/notifications'),\n\n /** Base URL for AI Engine (NLQ, Chat, Suggest) */\n ai: z.string().optional().describe('e.g. /api/v1/ai'),\n\n /** Base URL for Internationalization */\n i18n: z.string().optional().describe('e.g. /api/v1/i18n'),\n});\n\n/**\n * Discovery Response Schema\n * The root object returned by the Metadata Discovery Endpoint.\n */\nexport const DiscoverySchema = z.object({\n /** System Identity */\n name: z.string(),\n version: z.string(),\n environment: z.enum(['production', 'sandbox', 'development']),\n \n /** Dynamic Routing */\n routes: ApiRoutesSchema,\n \n /** Feature Flags */\n features: ApiCapabilitiesSchema,\n \n /** Localization Info (helping frontend init i18n) */\n locale: z.object({\n default: z.string(),\n supported: z.array(z.string()),\n timezone: z.string(),\n }),\n \n /**\n * Per-service status map.\n * Clients use this to determine which features are available,\n * show/hide UI elements, and display appropriate messages.\n */\n services: z.record(z.string(), ServiceInfoSchema).optional().describe(\n 'Per-service availability map keyed by CoreServiceName'\n ),\n\n /**\n * Custom metadata key-value pairs for extensibility\n */\n metadata: z.record(z.string(), z.unknown()).optional().describe('Custom metadata key-value pairs for extensibility'),\n});\n\nexport type DiscoveryResponse = z.infer<typeof DiscoverySchema>;\nexport type ApiRoutes = z.infer<typeof ApiRoutesSchema>;\nexport type ApiCapabilities = z.infer<typeof ApiCapabilitiesSchema>;\nexport type ServiceInfo = z.infer<typeof ServiceInfoSchema>;\n","// Copyright (c) 2025 ObjectStack. Licensed under the Apache-2.0 license.\n\nimport { z } from 'zod';\n\n/**\n * Transport Protocol Enum\n * Defines the communication protocol for realtime data synchronization\n */\nexport const TransportProtocol = z.enum([\n 'websocket', // Full-duplex, low latency communication\n 'sse', // Server-Sent Events, unidirectional push\n 'polling', // Short polling, best compatibility\n]);\n\nexport type TransportProtocol = z.infer<typeof TransportProtocol>;\n\n/**\n * Event Type Enum\n * Types of realtime events that can be subscribed to\n */\nexport const RealtimeEventType = z.enum([\n 'record.created',\n 'record.updated',\n 'record.deleted',\n 'field.changed',\n]);\n\nexport type RealtimeEventType = z.infer<typeof RealtimeEventType>;\n\n/**\n * Subscription Event Configuration\n * Defines what events to subscribe to with optional filtering\n */\nexport const SubscriptionEventSchema = z.object({\n type: RealtimeEventType.describe('Type of event to subscribe to'),\n object: z.string().optional().describe('Object name to subscribe to'),\n filters: z.unknown().optional().describe('Filter conditions'),\n});\n\n/**\n * Subscription Schema\n * Configuration for subscribing to realtime events\n */\nexport const SubscriptionSchema = z.object({\n id: z.string().uuid().describe('Unique subscription identifier'),\n events: z.array(SubscriptionEventSchema).describe('Array of events to subscribe to'),\n transport: TransportProtocol.describe('Transport protocol to use'),\n channel: z.string().optional().describe('Optional channel name for grouping subscriptions'),\n});\n\nexport type Subscription = z.infer<typeof SubscriptionSchema>;\n\n/**\n * Presence Status Enum\n * User online/offline status\n */\nexport const RealtimePresenceStatus = z.enum([\n 'online',\n 'away',\n 'busy',\n 'offline',\n]);\n\nexport type RealtimePresenceStatus = z.infer<typeof RealtimePresenceStatus>;\n\n/**\n * Presence Schema\n * Tracks user online status and metadata\n */\nexport const RealtimePresenceSchema = z.object({\n userId: z.string().describe('User identifier'),\n status: RealtimePresenceStatus.describe('Current presence status'),\n lastSeen: z.string().datetime().describe('ISO 8601 datetime of last activity'),\n metadata: z.record(z.string(), z.unknown()).optional().describe('Custom presence data (e.g., current page, custom status)'),\n});\n\nexport type RealtimePresence = z.infer<typeof RealtimePresenceSchema>;\n\n/**\n * Realtime Action Enum\n * Actions that can occur on records\n */\nexport const RealtimeAction = z.enum([\n 'created',\n 'updated',\n 'deleted',\n]);\n\nexport type RealtimeAction = z.infer<typeof RealtimeAction>;\n\n/**\n * Realtime Event Schema\n * Represents a realtime synchronization event\n */\nexport const RealtimeEventSchema = z.object({\n id: z.string().uuid().describe('Unique event identifier'),\n type: z.string().describe('Event type (e.g., record.created, record.updated)'),\n object: z.string().optional().describe('Object name the event relates to'),\n action: RealtimeAction.optional().describe('Action performed'),\n payload: z.record(z.string(), z.unknown()).describe('Event payload data'),\n timestamp: z.string().datetime().describe('ISO 8601 datetime when event occurred'),\n userId: z.string().optional().describe('User who triggered the event'),\n sessionId: z.string().optional().describe('Session identifier'),\n});\n\nexport type RealtimeEvent = z.infer<typeof RealtimeEventSchema>;\n\n/**\n * Realtime Configuration Schema\n * \n * Configuration for enabling realtime data synchronization.\n */\nexport const RealtimeConfigSchema = z.object({\n /** Enable realtime sync */\n enabled: z.boolean().default(true).describe('Enable realtime synchronization'),\n \n /** Transport protocol */\n transport: TransportProtocol.default('websocket').describe('Transport protocol'),\n \n /** Default subscriptions */\n subscriptions: z.array(SubscriptionSchema).optional().describe('Default subscriptions'),\n}).passthrough(); // Allow additional properties\n\nexport type RealtimeConfig = z.infer<typeof RealtimeConfigSchema>;\n","// Copyright (c) 2025 ObjectStack. Licensed under the Apache-2.0 license.\n\nimport { z } from 'zod';\nimport { EventNameSchema } from '../shared/identifiers.zod';\nimport { RealtimePresenceStatus } from './realtime.zod';\n\n/**\n * WebSocket Event Protocol\n * \n * Defines the schema for WebSocket-based real-time communication in ObjectStack.\n * Supports event subscriptions, filtering, presence tracking, and collaborative editing.\n * \n * Industry alignment: Firebase Realtime Database, Socket.IO, Pusher\n */\n\n// ==========================================\n// Message Types\n// ==========================================\n\n/**\n * WebSocket Message Type Enum\n * Defines the types of messages that can be sent over WebSocket\n */\nexport const WebSocketMessageType = z.enum([\n 'subscribe', // Client subscribes to events\n 'unsubscribe', // Client unsubscribes from events\n 'event', // Server sends event to client\n 'ping', // Keepalive ping\n 'pong', // Keepalive pong response\n 'ack', // Acknowledgment of message receipt\n 'error', // Error message\n 'presence', // Presence update (user status)\n 'cursor', // Cursor position update (collaborative editing)\n 'edit', // Document edit operation (collaborative editing)\n]);\n\nexport type WebSocketMessageType = z.infer<typeof WebSocketMessageType>;\n\n// ==========================================\n// Event Subscription\n// ==========================================\n\n/**\n * Event Filter Operator Enum\n * SQL-like filter operators for event filtering\n */\nexport const FilterOperator = z.enum([\n 'eq', // Equal\n 'ne', // Not equal\n 'gt', // Greater than\n 'gte', // Greater than or equal\n 'lt', // Less than\n 'lte', // Less than or equal\n 'in', // In array\n 'nin', // Not in array\n 'contains', // String contains\n 'startsWith', // String starts with\n 'endsWith', // String ends with\n 'exists', // Field exists\n 'regex', // Regex match\n]);\n\nexport type FilterOperator = z.infer<typeof FilterOperator>;\n\n/**\n * Event Filter Condition\n * Defines a single filter condition for event filtering\n */\nexport const EventFilterCondition = z.object({\n field: z.string().describe('Field path to filter on (supports dot notation, e.g., \"user.email\")'),\n operator: FilterOperator.describe('Comparison operator'),\n value: z.unknown().optional().describe('Value to compare against (not needed for \"exists\" operator)'),\n});\n\nexport type EventFilterCondition = z.infer<typeof EventFilterCondition>;\n\n/**\n * Event Filter Schema\n * Logical combination of filter conditions\n */\nexport const EventFilterSchema: z.ZodType<{\n conditions?: EventFilterCondition[];\n and?: EventFilter[];\n or?: EventFilter[];\n not?: EventFilter;\n}> = z.object({\n conditions: z.array(EventFilterCondition).optional().describe('Array of filter conditions'),\n and: z.lazy(() => z.array(EventFilterSchema)).optional().describe('AND logical combination of filters'),\n or: z.lazy(() => z.array(EventFilterSchema)).optional().describe('OR logical combination of filters'),\n not: z.lazy(() => EventFilterSchema).optional().describe('NOT logical negation of filter'),\n});\n\nexport type EventFilter = z.infer<typeof EventFilterSchema>;\n\n/**\n * Event Pattern Schema\n * Event name pattern that supports wildcards for subscriptions\n */\nexport const EventPatternSchema = z\n .string()\n .min(1)\n .regex(/^[a-z*][a-z0-9_.*]*$/, {\n message: 'Event pattern must be lowercase and may contain letters, numbers, underscores, dots, or wildcards (e.g., \"record.*\", \"*.created\", \"user.login\")',\n })\n .describe('Event pattern (supports wildcards like \"record.*\" or \"*.created\")');\n\nexport type EventPattern = z.infer<typeof EventPatternSchema>;\n\n/**\n * Event Subscription Config\n * Configuration for subscribing to specific events\n */\nexport const EventSubscriptionSchema = z.object({\n subscriptionId: z.string().uuid().describe('Unique subscription identifier'),\n events: z.array(EventPatternSchema).describe('Event patterns to subscribe to (supports wildcards, e.g., \"record.*\", \"user.created\")'),\n objects: z.array(z.string()).optional().describe('Object names to filter events by (e.g., [\"account\", \"contact\"])'),\n filters: EventFilterSchema.optional().describe('Advanced filter conditions for event payloads'),\n channels: z.array(z.string()).optional().describe('Channel names for scoped subscriptions'),\n});\n\nexport type EventSubscription = z.infer<typeof EventSubscriptionSchema>;\n\n/**\n * Unsubscribe Request\n * Request to unsubscribe from events\n */\nexport const UnsubscribeRequestSchema = z.object({\n subscriptionId: z.string().uuid().describe('Subscription ID to unsubscribe from'),\n});\n\nexport type UnsubscribeRequest = z.infer<typeof UnsubscribeRequestSchema>;\n\n// ==========================================\n// Presence Tracking\n// ==========================================\n\n/**\n * Presence Status Enum\n * Re-exported from realtime.zod.ts for backward compatibility\n */\nexport const WebSocketPresenceStatus = RealtimePresenceStatus;\n\nexport type WebSocketPresenceStatus = z.infer<typeof WebSocketPresenceStatus>;\n\n/**\n * Presence State Schema\n * Tracks real-time user presence and activity\n */\nexport const PresenceStateSchema = z.object({\n userId: z.string().describe('User identifier'),\n sessionId: z.string().uuid().describe('Unique session identifier'),\n status: WebSocketPresenceStatus.describe('Current presence status'),\n lastSeen: z.string().datetime().describe('ISO 8601 datetime of last activity'),\n currentLocation: z.string().optional().describe('Current page/route user is viewing'),\n device: z.enum(['desktop', 'mobile', 'tablet', 'other']).optional().describe('Device type'),\n customStatus: z.string().optional().describe('Custom user status message'),\n metadata: z.record(z.string(), z.unknown()).optional().describe('Additional custom presence data'),\n});\n\nexport type PresenceState = z.infer<typeof PresenceStateSchema>;\n\n/**\n * Presence Update Request\n * Client request to update presence status\n */\nexport const PresenceUpdateSchema = z.object({\n status: WebSocketPresenceStatus.optional().describe('Updated presence status'),\n currentLocation: z.string().optional().describe('Updated current location'),\n customStatus: z.string().optional().describe('Updated custom status message'),\n metadata: z.record(z.string(), z.unknown()).optional().describe('Updated metadata'),\n});\n\nexport type PresenceUpdate = z.infer<typeof PresenceUpdateSchema>;\n\n// ==========================================\n// Collaborative Editing Protocol\n// ==========================================\n\n/**\n * Cursor Position Schema\n * Represents a cursor position in a document\n */\nexport const CursorPositionSchema = z.object({\n userId: z.string().describe('User identifier'),\n sessionId: z.string().uuid().describe('Session identifier'),\n documentId: z.string().describe('Document identifier being edited'),\n position: z.object({\n line: z.number().int().nonnegative().describe('Line number (0-indexed)'),\n column: z.number().int().nonnegative().describe('Column number (0-indexed)'),\n }).optional().describe('Cursor position in document'),\n selection: z.object({\n start: z.object({\n line: z.number().int().nonnegative(),\n column: z.number().int().nonnegative(),\n }),\n end: z.object({\n line: z.number().int().nonnegative(),\n column: z.number().int().nonnegative(),\n }),\n }).optional().describe('Selection range (if text is selected)'),\n color: z.string().optional().describe('Cursor color for visual representation'),\n userName: z.string().optional().describe('Display name of user'),\n lastUpdate: z.string().datetime().describe('ISO 8601 datetime of last cursor update'),\n});\n\nexport type CursorPosition = z.infer<typeof CursorPositionSchema>;\n\n/**\n * Edit Operation Type Enum\n * Types of edit operations for collaborative editing\n */\nexport const EditOperationType = z.enum([\n 'insert', // Insert text at position\n 'delete', // Delete text from range\n 'replace', // Replace text in range\n]);\n\nexport type EditOperationType = z.infer<typeof EditOperationType>;\n\n/**\n * Edit Operation Schema\n * Represents a single edit operation on a document\n * Supports Operational Transformation (OT) for conflict resolution\n */\nexport const EditOperationSchema = z.object({\n operationId: z.string().uuid().describe('Unique operation identifier'),\n documentId: z.string().describe('Document identifier'),\n userId: z.string().describe('User who performed the edit'),\n sessionId: z.string().uuid().describe('Session identifier'),\n type: EditOperationType.describe('Type of edit operation'),\n position: z.object({\n line: z.number().int().nonnegative().describe('Line number (0-indexed)'),\n column: z.number().int().nonnegative().describe('Column number (0-indexed)'),\n }).describe('Starting position of the operation'),\n endPosition: z.object({\n line: z.number().int().nonnegative(),\n column: z.number().int().nonnegative(),\n }).optional().describe('Ending position (for delete/replace operations)'),\n content: z.string().optional().describe('Content to insert/replace'),\n version: z.number().int().nonnegative().describe('Document version before this operation'),\n timestamp: z.string().datetime().describe('ISO 8601 datetime when operation was created'),\n baseOperationId: z.string().uuid().optional().describe('Previous operation ID this builds upon (for OT)'),\n});\n\nexport type EditOperation = z.infer<typeof EditOperationSchema>;\n\n/**\n * Document State Schema\n * Represents the current state of a collaborative document\n */\nexport const DocumentStateSchema = z.object({\n documentId: z.string().describe('Document identifier'),\n version: z.number().int().nonnegative().describe('Current document version'),\n content: z.string().describe('Current document content'),\n lastModified: z.string().datetime().describe('ISO 8601 datetime of last modification'),\n activeSessions: z.array(z.string().uuid()).describe('Active editing session IDs'),\n checksum: z.string().optional().describe('Content checksum for integrity verification'),\n});\n\nexport type DocumentState = z.infer<typeof DocumentStateSchema>;\n\n// ==========================================\n// WebSocket Messages\n// ==========================================\n\n/**\n * Base WebSocket Message\n * All WebSocket messages extend this base structure\n */\nconst BaseWebSocketMessage = z.object({\n messageId: z.string().uuid().describe('Unique message identifier'),\n type: WebSocketMessageType.describe('Message type'),\n timestamp: z.string().datetime().describe('ISO 8601 datetime when message was sent'),\n});\n\n/**\n * Subscribe Message\n * Client sends this to subscribe to events\n */\nexport const SubscribeMessageSchema = BaseWebSocketMessage.extend({\n type: z.literal('subscribe'),\n subscription: EventSubscriptionSchema.describe('Subscription configuration'),\n});\n\nexport type SubscribeMessage = z.infer<typeof SubscribeMessageSchema>;\n\n/**\n * Unsubscribe Message\n * Client sends this to unsubscribe from events\n */\nexport const UnsubscribeMessageSchema = BaseWebSocketMessage.extend({\n type: z.literal('unsubscribe'),\n request: UnsubscribeRequestSchema.describe('Unsubscribe request'),\n});\n\nexport type UnsubscribeMessage = z.infer<typeof UnsubscribeMessageSchema>;\n\n/**\n * Event Message\n * Server sends this when a subscribed event occurs\n */\nexport const EventMessageSchema = BaseWebSocketMessage.extend({\n type: z.literal('event'),\n subscriptionId: z.string().uuid().describe('Subscription ID this event belongs to'),\n eventName: EventNameSchema.describe('Event name'),\n object: z.string().optional().describe('Object name the event relates to'),\n payload: z.unknown().describe('Event payload data'),\n userId: z.string().optional().describe('User who triggered the event'),\n});\n\nexport type EventMessage = z.infer<typeof EventMessageSchema>;\n\n/**\n * Presence Message\n * Presence update message\n */\nexport const PresenceMessageSchema = BaseWebSocketMessage.extend({\n type: z.literal('presence'),\n presence: PresenceStateSchema.describe('Presence state'),\n});\n\nexport type PresenceMessage = z.infer<typeof PresenceMessageSchema>;\n\n/**\n * Cursor Message\n * Cursor position update for collaborative editing\n */\nexport const CursorMessageSchema = BaseWebSocketMessage.extend({\n type: z.literal('cursor'),\n cursor: CursorPositionSchema.describe('Cursor position'),\n});\n\nexport type CursorMessage = z.infer<typeof CursorMessageSchema>;\n\n/**\n * Edit Message\n * Document edit operation for collaborative editing\n */\nexport const EditMessageSchema = BaseWebSocketMessage.extend({\n type: z.literal('edit'),\n operation: EditOperationSchema.describe('Edit operation'),\n});\n\nexport type EditMessage = z.infer<typeof EditMessageSchema>;\n\n/**\n * Acknowledgment Message\n * Server acknowledges receipt of a message\n */\nexport const AckMessageSchema = BaseWebSocketMessage.extend({\n type: z.literal('ack'),\n ackMessageId: z.string().uuid().describe('ID of the message being acknowledged'),\n success: z.boolean().describe('Whether the operation was successful'),\n error: z.string().optional().describe('Error message if operation failed'),\n});\n\nexport type AckMessage = z.infer<typeof AckMessageSchema>;\n\n/**\n * Error Message\n * Server sends error information\n */\nexport const ErrorMessageSchema = BaseWebSocketMessage.extend({\n type: z.literal('error'),\n code: z.string().describe('Error code'),\n message: z.string().describe('Error message'),\n details: z.unknown().optional().describe('Additional error details'),\n});\n\nexport type ErrorMessage = z.infer<typeof ErrorMessageSchema>;\n\n/**\n * Ping Message\n * Keepalive ping from client or server\n */\nexport const PingMessageSchema = BaseWebSocketMessage.extend({\n type: z.literal('ping'),\n});\n\nexport type PingMessage = z.infer<typeof PingMessageSchema>;\n\n/**\n * Pong Message\n * Keepalive pong response\n */\nexport const PongMessageSchema = BaseWebSocketMessage.extend({\n type: z.literal('pong'),\n pingMessageId: z.string().uuid().optional().describe('ID of ping message being responded to'),\n});\n\nexport type PongMessage = z.infer<typeof PongMessageSchema>;\n\n/**\n * WebSocket Message Union\n * Discriminated union of all WebSocket message types\n */\nexport const WebSocketMessageSchema = z.discriminatedUnion('type', [\n SubscribeMessageSchema,\n UnsubscribeMessageSchema,\n EventMessageSchema,\n PresenceMessageSchema,\n CursorMessageSchema,\n EditMessageSchema,\n AckMessageSchema,\n ErrorMessageSchema,\n PingMessageSchema,\n PongMessageSchema,\n]);\n\nexport type WebSocketMessage = z.infer<typeof WebSocketMessageSchema>;\n\n// ==========================================\n// Connection Configuration\n// ==========================================\n\n/**\n * WebSocket Connection Config\n * Configuration for WebSocket connections\n */\nexport const WebSocketConfigSchema = z.object({\n url: z.string().url().describe('WebSocket server URL'),\n protocols: z.array(z.string()).optional().describe('WebSocket sub-protocols'),\n reconnect: z.boolean().optional().default(true).describe('Enable automatic reconnection'),\n reconnectInterval: z.number().int().positive().optional().default(1000).describe('Reconnection interval in milliseconds'),\n maxReconnectAttempts: z.number().int().positive().optional().default(5).describe('Maximum reconnection attempts'),\n pingInterval: z.number().int().positive().optional().default(30000).describe('Ping interval in milliseconds'),\n timeout: z.number().int().positive().optional().default(5000).describe('Message timeout in milliseconds'),\n headers: z.record(z.string(), z.string()).optional().describe('Custom headers for WebSocket handshake'),\n});\n\nexport type WebSocketConfig = z.infer<typeof WebSocketConfigSchema>;\n\n// ==========================================\n// Simplified Collaboration API\n// ==========================================\n\n/**\n * Simplified WebSocket Event Schema\n * \n * A simplified event schema for basic WebSocket communication.\n * Complements the comprehensive WebSocketMessageSchema above for simpler use cases.\n * \n * @example Subscribe to channel\n * ```typescript\n * {\n * type: 'subscribe',\n * channel: 'record.account.123',\n * payload: { events: ['created', 'updated'] },\n * timestamp: Date.now()\n * }\n * ```\n * \n * @example Data change notification\n * ```typescript\n * {\n * type: 'data-change',\n * channel: 'record.account.123',\n * payload: { id: '123', action: 'updated', data: {...} },\n * timestamp: Date.now()\n * }\n * ```\n */\nexport const WebSocketEventSchema = z.object({\n type: z.enum([\n 'subscribe', // Client subscribes to channel\n 'unsubscribe', // Client unsubscribes from channel\n 'data-change', // Data modification event\n 'presence-update', // User presence change\n 'cursor-update', // Cursor position change (collaborative editing)\n 'error', // Error message\n ]).describe('Event type'),\n channel: z.string().describe('Channel identifier (e.g., \"record.account.123\", \"user.456\")'),\n payload: z.unknown().describe('Event payload data'),\n timestamp: z.number().describe('Unix timestamp in milliseconds'),\n});\n\nexport type WebSocketEvent = z.infer<typeof WebSocketEventSchema>;\n\n/**\n * Simplified Presence State Schema\n * \n * A simplified presence schema for basic user presence tracking.\n * Complements the comprehensive PresenceStateSchema for simpler integrations.\n * \n * Use this for basic presence features. For advanced features like device tracking,\n * custom status, and session management, use the comprehensive PresenceStateSchema above.\n * \n * @example User online\n * ```typescript\n * {\n * userId: 'user123',\n * userName: 'John Doe',\n * status: 'online',\n * lastSeen: Date.now(),\n * metadata: { currentPage: '/dashboard' }\n * }\n * ```\n */\nexport const SimplePresenceStateSchema = z.object({\n userId: z.string().describe('User identifier'),\n userName: z.string().describe('User display name'),\n status: z.enum(['online', 'away', 'offline']).describe('User presence status'),\n lastSeen: z.number().describe('Unix timestamp of last activity in milliseconds'),\n metadata: z.record(z.string(), z.unknown()).optional().describe('Additional presence metadata (e.g., current page, custom status)'),\n});\n\nexport type SimplePresenceState = z.infer<typeof SimplePresenceStateSchema>;\n\n/**\n * Simplified Cursor Position Schema\n * \n * A simplified cursor position schema for basic collaborative editing.\n * Complements the comprehensive CursorPositionSchema for simpler use cases.\n * \n * Use this for basic cursor sharing. For advanced features like selections,\n * color coding, and document versioning, use the comprehensive CursorPositionSchema above.\n * \n * @example Cursor in text field\n * ```typescript\n * {\n * userId: 'user123',\n * recordId: 'account_456',\n * fieldName: 'description',\n * position: 42,\n * selection: { start: 42, end: 57 }\n * }\n * ```\n */\nexport const SimpleCursorPositionSchema = z.object({\n userId: z.string().describe('User identifier'),\n recordId: z.string().describe('Record identifier being edited'),\n fieldName: z.string().describe('Field name being edited'),\n position: z.number().describe('Cursor position (character offset from start)'),\n selection: z.object({\n start: z.number().describe('Selection start position'),\n end: z.number().describe('Selection end position'),\n }).optional().describe('Text selection range (if text is selected)'),\n});\n\nexport type SimpleCursorPosition = z.infer<typeof SimpleCursorPositionSchema>;\n\n/**\n * WebSocket Server Configuration Schema\n * \n * Server-side configuration for WebSocket services.\n * Controls features like presence tracking, cursor sharing, and connection management.\n * \n * @example Production configuration\n * ```typescript\n * {\n * enabled: true,\n * path: '/ws',\n * heartbeatInterval: 30000,\n * reconnectAttempts: 5,\n * presence: true,\n * cursorSharing: true\n * }\n * ```\n */\nexport const WebSocketServerConfigSchema = z.object({\n enabled: z.boolean().default(false).describe('Enable WebSocket server'),\n path: z.string().default('/ws').describe('WebSocket endpoint path'),\n heartbeatInterval: z.number().default(30000).describe('Heartbeat interval in milliseconds'),\n reconnectAttempts: z.number().default(5).describe('Maximum reconnection attempts for clients'),\n presence: z.boolean().default(false).describe('Enable presence tracking'),\n cursorSharing: z.boolean().default(false).describe('Enable collaborative cursor sharing'),\n});\n\nexport type WebSocketServerConfig = z.infer<typeof WebSocketServerConfigSchema>;\n","// Copyright (c) 2025 ObjectStack. Licensed under the Apache-2.0 license.\n\nimport { z } from 'zod';\n\n/**\n * System Identifier Schema\n * \n * Universal naming convention for all machine identifiers (API Names) in ObjectStack.\n * Enforces lowercase with underscores or dots to ensure:\n * - Cross-platform compatibility (case-insensitive filesystems)\n * - URL-friendliness (no encoding needed)\n * - Database consistency (no collation issues)\n * - Security (no case-sensitivity bugs in permission checks)\n * \n * **Applies to all metadata that acts as a machine identifier:**\n * - Object names (tables/collections)\n * - Field names\n * - Role names\n * - Permission set names\n * - Action/trigger names\n * - Event keys\n * - App IDs\n * - Menu/page IDs\n * - Select option values\n * - Workflow names\n * - Webhook names\n * \n * **Naming Convention Summary:**\n * | Type | Pattern | Example |\n * |------|---------|---------|\n * | Machine ID | snake_case | `crm_account`, `btn_submit`, `role_admin` |\n * | Event keys | dot.notation | `user.login`, `order.created` |\n * | Labels | Any case | `Client Account`, `Submit Form` |\n * \n * @example Valid identifiers\n * - 'account'\n * - 'crm_account'\n * - 'user_profile'\n * - 'order.created' (for events)\n * - 'api_v2_endpoint'\n * \n * @example Invalid identifiers (will be rejected)\n * - 'Account' (uppercase)\n * - 'CrmAccount' (camelCase)\n * - 'crm-account' (kebab-case - use underscore instead)\n * - 'user profile' (spaces)\n */\nexport const SystemIdentifierSchema = z\n .string()\n .min(2, { message: 'System identifier must be at least 2 characters' })\n .regex(/^[a-z][a-z0-9_.]*$/, {\n message:\n 'System identifier must be lowercase, starting with a letter, and may contain letters, numbers, underscores, or dots (e.g., \"user_profile\" or \"order.created\")',\n })\n .describe('System identifier (lowercase with underscores or dots)');\n\n/**\n * Strict Snake Case Identifier\n * \n * More restrictive than SystemIdentifierSchema - only allows underscores (no dots).\n * Use this for identifiers that should NOT contain dots (e.g., database table/column names).\n * \n * @example Valid\n * - 'account'\n * - 'crm_account'\n * - 'user_profile'\n * \n * @example Invalid\n * - 'user.profile' (dots not allowed)\n * - 'UserProfile' (uppercase)\n */\nexport const SnakeCaseIdentifierSchema = z\n .string()\n .min(2, { message: 'Identifier must be at least 2 characters' })\n .regex(/^[a-z][a-z0-9_]*$/, {\n message:\n 'Identifier must be lowercase snake_case, starting with a letter, and may contain only letters, numbers, and underscores (e.g., \"user_profile\")',\n })\n .describe('Snake case identifier (lowercase with underscores only)');\n\n/**\n * Event Name Identifier\n * \n * Specialized identifier for event names that encourages dot notation.\n * Used in event-driven systems, message queues, and webhooks.\n * \n * Pattern: `namespace.action` or `entity.event_type`\n * \n * @example Valid\n * - 'user.created'\n * - 'order.paid'\n * - 'user.login_success'\n * - 'alarm.high_cpu'\n * \n * @example Invalid\n * - 'UserCreated' (camelCase)\n * - 'user_created' (should use dots for namespacing)\n */\nexport const EventNameSchema = z\n .string()\n .min(3, { message: 'Event name must be at least 3 characters' })\n .regex(/^[a-z][a-z0-9_.]*$/, {\n message:\n 'Event name must be lowercase with dots for namespacing (e.g., \"user.created\", \"order.paid\")',\n })\n .describe('Event name (lowercase with dot notation for namespacing)');\n\n/**\n * Type Exports\n */\nexport type SystemIdentifier = z.infer<typeof SystemIdentifierSchema>;\nexport type SnakeCaseIdentifier = z.infer<typeof SnakeCaseIdentifierSchema>;\nexport type EventName = z.infer<typeof EventNameSchema>;\n","// Copyright (c) 2025 ObjectStack. Licensed under the Apache-2.0 license.\n\nimport { z } from 'zod';\nimport { CorsConfigSchema, StaticMountSchema, HttpMethod } from '../shared/http.zod';\n\n// Re-export HttpMethod for convenience\nexport { HttpMethod };\n\n/**\n * Route Category Enum\n * Classifies routes for middleware application and security policies.\n */\nexport const RouteCategory = z.enum([\n 'system', // Health, Metrics, Info (No Auth usually)\n 'api', // Business Logic API (Auth required)\n 'auth', // Login/Callback endpoints\n 'static', // Asset serving\n 'webhook', // External callbacks\n 'plugin' // Plugin extensions\n]);\n\nexport type RouteCategory = z.infer<typeof RouteCategory>;\n\n/**\n * Route Definition Schema\n * Describes a single routable endpoint in the Kernel.\n */\nexport const RouteDefinitionSchema = z.object({\n /**\n * HTTP Method\n */\n method: HttpMethod,\n \n /**\n * URL Path Pattern (supports parameters like /user/:id)\n */\n path: z.string().describe('URL Path pattern'),\n \n /**\n * Route Type/Category\n */\n category: RouteCategory.default('api'),\n \n /**\n * Handler Identifier\n * References an internal function or plugin action ID.\n */\n handler: z.string().describe('Unique handler identifier'),\n \n /**\n * Route specific metadata\n */\n summary: z.string().optional().describe('OpenAPI summary'),\n description: z.string().optional().describe('OpenAPI description'),\n \n /**\n * Security constraints\n */\n public: z.boolean().default(false).describe('Is publicly accessible'),\n permissions: z.array(z.string()).optional().describe('Required permissions'),\n \n /**\n * Performance hints\n */\n timeout: z.number().int().optional().describe('Execution timeout in ms'),\n rateLimit: z.string().optional().describe('Rate limit policy name'),\n});\n\nexport type RouteDefinition = z.infer<typeof RouteDefinitionSchema>;\n\n/**\n * Router Configuration Schema\n * Global routing table configuration.\n */\nexport const RouterConfigSchema = z.object({\n /**\n * URL Prefix for all kernel routes\n */\n basePath: z.string().default('/api').describe('Global API prefix'),\n \n /**\n * Standard Protocol Mounts (Relative to basePath)\n */\n mounts: z.object({\n data: z.string().default('/data').describe('Data Protocol (CRUD)'),\n metadata: z.string().default('/meta').describe('Metadata Protocol (Schemas)'),\n auth: z.string().default('/auth').describe('Auth Protocol'),\n automation: z.string().default('/automation').describe('Automation Protocol'),\n storage: z.string().default('/storage').describe('Storage Protocol'),\n analytics: z.string().default('/analytics').describe('Analytics Protocol'),\n graphql: z.string().default('/graphql').describe('GraphQL Endpoint'),\n ui: z.string().default('/ui').describe('UI Metadata Protocol (Views, Layouts)'),\n workflow: z.string().default('/workflow').describe('Workflow Engine Protocol'),\n realtime: z.string().default('/realtime').describe('Realtime/WebSocket Protocol'),\n notifications: z.string().default('/notifications').describe('Notification Protocol'),\n ai: z.string().default('/ai').describe('AI Engine Protocol (NLQ, Chat, Suggest)'),\n i18n: z.string().default('/i18n').describe('Internationalization Protocol'),\n packages: z.string().default('/packages').describe('Package Management Protocol'),\n }).default({\n data: '/data',\n metadata: '/meta',\n auth: '/auth',\n automation: '/automation',\n storage: '/storage',\n analytics: '/analytics',\n graphql: '/graphql',\n ui: '/ui',\n workflow: '/workflow',\n realtime: '/realtime',\n notifications: '/notifications',\n ai: '/ai',\n i18n: '/i18n',\n packages: '/packages',\n }), // Defaults match standardized spec\n\n /**\n * Cross-Origin Resource Sharing\n */\n cors: CorsConfigSchema.optional(),\n \n /**\n * Static asset mounts\n */\n staticMounts: z.array(StaticMountSchema).optional(),\n});\n\nexport type RouterConfig = z.infer<typeof RouterConfigSchema>;\n","// Copyright (c) 2025 ObjectStack. Licensed under the Apache-2.0 license.\n\nimport { z } from 'zod';\n\n/**\n * OData v4 Protocol Support\n * \n * Open Data Protocol (OData) v4 is an industry-standard protocol for building\n * and consuming RESTful APIs. It provides a uniform way to expose, structure,\n * query, and manipulate data.\n * \n * ## Overview\n * \n * OData v4 provides standardized URL conventions for querying data including:\n * - $select: Choose which fields to return\n * - $filter: Filter results with complex expressions\n * - $orderby: Sort results\n * - $top/$skip: Pagination\n * - $expand: Include related entities\n * - $count: Get total count\n * \n * ## Use Cases\n * \n * 1. **Enterprise Integration**\n * - Integrate with Microsoft Dynamics 365\n * - Connect to SharePoint Online\n * - SAP OData services\n * \n * 2. **API Standardization**\n * - Provide consistent query interface\n * - Standard pagination and filtering\n * - Industry-recognized protocol\n * \n * 3. **External Data Sources**\n * - Connect to OData-compliant systems\n * - Federated queries\n * - Data virtualization\n * \n * @see https://www.odata.org/documentation/\n * @see https://docs.oasis-open.org/odata/odata/v4.01/odata-v4.01-part2-url-conventions.html\n * \n * @example OData Query\n * ```\n * GET /api/odata/customers?\n * $select=name,email&\n * $filter=country eq 'US' and revenue gt 100000&\n * $orderby=revenue desc&\n * $top=10&\n * $skip=20&\n * $expand=orders&\n * $count=true\n * ```\n * \n * @example Programmatic Use\n * ```typescript\n * const query: ODataQuery = {\n * select: ['name', 'email'],\n * filter: \"country eq 'US' and revenue gt 100000\",\n * orderby: 'revenue desc',\n * top: 10,\n * skip: 20,\n * expand: ['orders'],\n * count: true\n * }\n * ```\n */\n\n/**\n * OData Query Options Schema\n * \n * System query options defined by OData v4 specification.\n * These are URL query parameters that control the query execution.\n * \n * @see https://docs.oasis-open.org/odata/odata/v4.01/odata-v4.01-part2-url-conventions.html#sec_SystemQueryOptions\n */\nexport const ODataQuerySchema = z.object({\n /**\n * $select - Select specific fields to return\n * \n * Comma-separated list of field names to include in the response.\n * Reduces payload size and improves performance.\n * \n * @example \"name,email,phone\"\n * @example \"id,customer/name\" - With navigation path\n */\n $select: z.union([\n z.string(), // \"name,email\"\n z.array(z.string()), // [\"name\", \"email\"]\n ]).optional().describe('Fields to select'),\n\n /**\n * $filter - Filter results with conditions\n * \n * OData filter expression using comparison operators, logical operators,\n * and functions.\n * \n * Comparison: eq, ne, lt, le, gt, ge\n * Logical: and, or, not\n * Functions: contains, startswith, endswith, length, indexof, substring, etc.\n * \n * @example \"age gt 18\"\n * @example \"country eq 'US' and revenue gt 100000\"\n * @example \"contains(name, 'Smith')\"\n * @example \"startswith(email, 'admin') and isActive eq true\"\n */\n $filter: z.string().optional().describe('Filter expression (OData filter syntax)'),\n\n /**\n * $orderby - Sort results\n * \n * Comma-separated list of fields with optional asc/desc.\n * Default is ascending.\n * \n * @example \"name\"\n * @example \"revenue desc\"\n * @example \"country asc, revenue desc\"\n */\n $orderby: z.union([\n z.string(), // \"name desc\"\n z.array(z.string()), // [\"name desc\", \"email asc\"]\n ]).optional().describe('Sort order'),\n\n /**\n * $top - Limit number of results\n * \n * Maximum number of results to return.\n * Equivalent to SQL LIMIT or FETCH FIRST.\n * \n * @example 10\n * @example 100\n */\n $top: z.number().int().min(0).optional().describe('Max results to return'),\n\n /**\n * $skip - Skip results for pagination\n * \n * Number of results to skip before returning results.\n * Equivalent to SQL OFFSET.\n * \n * @example 20\n * @example 100\n */\n $skip: z.number().int().min(0).optional().describe('Results to skip'),\n\n /**\n * $expand - Include related entities\n * \n * Comma-separated list of navigation properties to expand.\n * Loads related data in the same request.\n * \n * @example \"orders\"\n * @example \"customer,products\"\n * @example \"orders($select=id,total)\" - With nested query options\n */\n $expand: z.union([\n z.string(), // \"orders\"\n z.array(z.string()), // [\"orders\", \"customer\"]\n ]).optional().describe('Navigation properties to expand'),\n\n /**\n * $count - Include total count\n * \n * When true, includes totalResults count in response.\n * Useful for pagination UI.\n * \n * @example true\n */\n $count: z.boolean().optional().describe('Include total count'),\n\n /**\n * $search - Full-text search\n * \n * Free-text search expression.\n * Search implementation is service-specific.\n * \n * @example \"John Smith\"\n * @example \"urgent AND support\"\n */\n $search: z.string().optional().describe('Search expression'),\n\n /**\n * $format - Response format\n * \n * Preferred response format.\n * \n * @example \"json\"\n * @example \"xml\"\n */\n $format: z.enum(['json', 'xml', 'atom']).optional().describe('Response format'),\n\n /**\n * $apply - Data aggregation\n * \n * Aggregation transformations (groupby, aggregate, etc.)\n * Part of OData aggregation extension.\n * \n * @example \"groupby((country),aggregate(revenue with sum as totalRevenue))\"\n */\n $apply: z.string().optional().describe('Aggregation expression'),\n});\n\nexport type ODataQuery = z.infer<typeof ODataQuerySchema>;\n\n/**\n * OData Filter Operator\n * \n * Standard comparison and logical operators in OData filter expressions.\n */\nexport const ODataFilterOperatorSchema = z.enum([\n // Comparison Operators\n 'eq', // Equal to\n 'ne', // Not equal to\n 'lt', // Less than\n 'le', // Less than or equal to\n 'gt', // Greater than\n 'ge', // Greater than or equal to\n\n // Logical Operators\n 'and', // Logical AND\n 'or', // Logical OR\n 'not', // Logical NOT\n\n // Grouping\n '(', // Left parenthesis\n ')', // Right parenthesis\n\n // Other\n 'in', // Value in list\n 'has', // Has flag (for enum flags)\n]);\n\nexport type ODataFilterOperator = z.infer<typeof ODataFilterOperatorSchema>;\n\n/**\n * OData Filter Function\n * \n * Standard functions available in OData filter expressions.\n */\nexport const ODataFilterFunctionSchema = z.enum([\n // String Functions\n 'contains', // contains(field, 'value')\n 'startswith', // startswith(field, 'value')\n 'endswith', // endswith(field, 'value')\n 'length', // length(field)\n 'indexof', // indexof(field, 'substring')\n 'substring', // substring(field, start, length)\n 'tolower', // tolower(field)\n 'toupper', // toupper(field)\n 'trim', // trim(field)\n 'concat', // concat(field1, field2)\n\n // Date/Time Functions\n 'year', // year(dateField)\n 'month', // month(dateField)\n 'day', // day(dateField)\n 'hour', // hour(datetimeField)\n 'minute', // minute(datetimeField)\n 'second', // second(datetimeField)\n 'date', // date(datetimeField)\n 'time', // time(datetimeField)\n 'now', // now()\n 'maxdatetime', // maxdatetime()\n 'mindatetime', // mindatetime()\n\n // Math Functions\n 'round', // round(numField)\n 'floor', // floor(numField)\n 'ceiling', // ceiling(numField)\n\n // Type Functions\n 'cast', // cast(field, 'Edm.String')\n 'isof', // isof(field, 'Type')\n\n // Collection Functions\n 'any', // collection/any(d:d/prop eq value)\n 'all', // collection/all(d:d/prop eq value)\n]);\n\nexport type ODataFilterFunction = z.infer<typeof ODataFilterFunctionSchema>;\n\n/**\n * OData Response Schema\n * \n * Standard OData JSON response format.\n */\nexport const ODataResponseSchema = z.object({\n /**\n * OData context URL\n * Describes the payload structure\n */\n '@odata.context': z.string().url().optional().describe('Metadata context URL'),\n\n /**\n * Total count (when $count=true)\n */\n '@odata.count': z.number().int().optional().describe('Total results count'),\n\n /**\n * Next link for pagination\n */\n '@odata.nextLink': z.string().url().optional().describe('Next page URL'),\n\n /**\n * Result array\n */\n value: z.array(z.record(z.string(), z.unknown())).describe('Results array'),\n});\n\nexport type ODataResponse = z.infer<typeof ODataResponseSchema>;\n\n/**\n * OData Error Response Schema\n * \n * Standard OData error format.\n */\nexport const ODataErrorSchema = z.object({\n error: z.object({\n /**\n * Error code\n */\n code: z.string().describe('Error code'),\n\n /**\n * Error message\n */\n message: z.string().describe('Error message'),\n\n /**\n * Target of the error (field name, etc.)\n */\n target: z.string().optional().describe('Error target'),\n\n /**\n * Additional error details\n */\n details: z.array(z.object({\n code: z.string(),\n message: z.string(),\n target: z.string().optional(),\n })).optional().describe('Error details'),\n\n /**\n * Inner error for debugging\n */\n innererror: z.record(z.string(), z.unknown()).optional().describe('Inner error details'),\n }),\n});\n\nexport type ODataError = z.infer<typeof ODataErrorSchema>;\n\n/**\n * OData Metadata Configuration\n * \n * Configuration for OData metadata endpoint ($metadata).\n */\nexport const ODataMetadataSchema = z.object({\n /**\n * Service namespace\n */\n namespace: z.string().describe('Service namespace'),\n\n /**\n * Entity types to expose\n */\n entityTypes: z.array(z.object({\n name: z.string().describe('Entity type name'),\n key: z.array(z.string()).describe('Key fields'),\n properties: z.array(z.object({\n name: z.string(),\n type: z.string().describe('OData type (Edm.String, Edm.Int32, etc.)'),\n nullable: z.boolean().default(true),\n })),\n navigationProperties: z.array(z.object({\n name: z.string(),\n type: z.string(),\n partner: z.string().optional(),\n })).optional(),\n })).describe('Entity types'),\n\n /**\n * Entity sets\n */\n entitySets: z.array(z.object({\n name: z.string().describe('Entity set name'),\n entityType: z.string().describe('Entity type'),\n })).describe('Entity sets'),\n});\n\nexport type ODataMetadata = z.infer<typeof ODataMetadataSchema>;\n\n/**\n * Helper functions for OData operations\n */\nexport const OData = {\n /**\n * Build OData query URL\n */\n buildUrl: (baseUrl: string, query: ODataQuery): string => {\n const params = new URLSearchParams();\n\n if (query.$select) {\n params.append('$select', Array.isArray(query.$select) ? query.$select.join(',') : query.$select);\n }\n if (query.$filter) {\n params.append('$filter', query.$filter);\n }\n if (query.$orderby) {\n params.append('$orderby', Array.isArray(query.$orderby) ? query.$orderby.join(',') : query.$orderby);\n }\n if (query.$top !== undefined) {\n params.append('$top', query.$top.toString());\n }\n if (query.$skip !== undefined) {\n params.append('$skip', query.$skip.toString());\n }\n if (query.$expand) {\n params.append('$expand', Array.isArray(query.$expand) ? query.$expand.join(',') : query.$expand);\n }\n if (query.$count !== undefined) {\n params.append('$count', query.$count.toString());\n }\n if (query.$search) {\n params.append('$search', query.$search);\n }\n if (query.$format) {\n params.append('$format', query.$format);\n }\n if (query.$apply) {\n params.append('$apply', query.$apply);\n }\n\n const queryString = params.toString();\n return queryString ? `${baseUrl}?${queryString}` : baseUrl;\n },\n\n /**\n * Create a simple filter expression\n */\n filter: {\n eq: (field: string, value: string | number | boolean) => \n `${field} eq ${typeof value === 'string' ? `'${value}'` : value}`,\n ne: (field: string, value: string | number | boolean) => \n `${field} ne ${typeof value === 'string' ? `'${value}'` : value}`,\n gt: (field: string, value: number) => `${field} gt ${value}`,\n lt: (field: string, value: number) => `${field} lt ${value}`,\n contains: (field: string, value: string) => `contains(${field}, '${value}')`,\n and: (...expressions: string[]) => expressions.join(' and '),\n or: (...expressions: string[]) => expressions.join(' or '),\n },\n} as const;\n\n/**\n * OData Configuration Schema\n * \n * Configuration for enabling OData v4 API endpoint.\n */\nexport const ODataConfigSchema = z.object({\n /** Enable OData endpoint */\n enabled: z.boolean().default(true).describe('Enable OData API'),\n \n /** OData endpoint path */\n path: z.string().default('/odata').describe('OData endpoint path'),\n \n /** Metadata configuration */\n metadata: ODataMetadataSchema.optional().describe('OData metadata configuration'),\n}).passthrough(); // Allow additional properties for flexibility\n\nexport type ODataConfig = z.infer<typeof ODataConfigSchema>;\n","// Copyright (c) 2025 ObjectStack. Licensed under the Apache-2.0 license.\n\nimport { z } from 'zod';\nimport { FieldType } from '../data/field.zod';\n\n/**\n * GraphQL Protocol Support\n * \n * GraphQL is a query language for APIs and a runtime for executing those queries.\n * It provides a complete and understandable description of the data in your API,\n * gives clients the power to ask for exactly what they need, and enables powerful\n * developer tools.\n * \n * ## Overview\n * \n * GraphQL provides:\n * - Type-safe schema definition\n * - Precise data fetching (no over/under-fetching)\n * - Introspection and documentation\n * - Real-time subscriptions\n * - Batched queries with DataLoader\n * \n * ## Use Cases\n * \n * 1. **Modern API Development**\n * - Mobile and web applications\n * - Microservices federation\n * - Real-time dashboards\n * \n * 2. **Data Aggregation**\n * - Multi-source data integration\n * - Complex nested queries\n * - Efficient data loading\n * \n * 3. **Developer Experience**\n * - Self-documenting API\n * - Type safety and validation\n * - GraphQL playground\n * \n * @see https://graphql.org/\n * @see https://spec.graphql.org/\n * \n * @example GraphQL Query\n * ```graphql\n * query GetCustomer($id: ID!) {\n * customer(id: $id) {\n * id\n * name\n * email\n * orders(limit: 10, status: \"active\") {\n * id\n * total\n * items {\n * product {\n * name\n * price\n * }\n * }\n * }\n * }\n * }\n * ```\n * \n * @example GraphQL Mutation\n * ```graphql\n * mutation CreateOrder($input: CreateOrderInput!) {\n * createOrder(input: $input) {\n * id\n * orderNumber\n * status\n * }\n * }\n * ```\n */\n\n// ==========================================\n// 1. GraphQL Type System\n// ==========================================\n\n/**\n * GraphQL Scalar Types\n * \n * Built-in scalar types in GraphQL plus custom scalars.\n */\nexport const GraphQLScalarType = z.enum([\n // Built-in GraphQL Scalars\n 'ID',\n 'String',\n 'Int',\n 'Float',\n 'Boolean',\n \n // Extended Scalars (common custom types)\n 'DateTime',\n 'Date',\n 'Time',\n 'JSON',\n 'JSONObject',\n 'Upload',\n 'URL',\n 'Email',\n 'PhoneNumber',\n 'Currency',\n 'Decimal',\n 'BigInt',\n 'Long',\n 'UUID',\n 'Base64',\n 'Void',\n]);\n\nexport type GraphQLScalarType = z.infer<typeof GraphQLScalarType>;\n\n/**\n * GraphQL Type Configuration\n * \n * Configuration for generating GraphQL types from Object definitions.\n */\nexport const GraphQLTypeConfigSchema = z.object({\n /** Type name in GraphQL schema */\n name: z.string().describe('GraphQL type name (PascalCase recommended)'),\n \n /** Source Object name */\n object: z.string().describe('Source ObjectQL object name'),\n \n /** Description for GraphQL schema documentation */\n description: z.string().optional().describe('Type description'),\n \n /** Fields to include/exclude */\n fields: z.object({\n /** Include only these fields (allow list) */\n include: z.array(z.string()).optional().describe('Fields to include'),\n \n /** Exclude these fields (deny list) */\n exclude: z.array(z.string()).optional().describe('Fields to exclude (e.g., sensitive fields)'),\n \n /** Custom field mappings */\n mappings: z.record(z.string(), z.object({\n graphqlName: z.string().optional().describe('Custom GraphQL field name'),\n graphqlType: z.string().optional().describe('Override GraphQL type'),\n description: z.string().optional().describe('Field description'),\n deprecationReason: z.string().optional().describe('Why field is deprecated'),\n nullable: z.boolean().optional().describe('Override nullable'),\n })).optional().describe('Field-level customizations'),\n }).optional().describe('Field configuration'),\n \n /** Interfaces this type implements */\n interfaces: z.array(z.string()).optional().describe('GraphQL interface names'),\n \n /** Whether this is an interface definition */\n isInterface: z.boolean().optional().default(false).describe('Define as GraphQL interface'),\n \n /** Custom directives */\n directives: z.array(z.object({\n name: z.string().describe('Directive name'),\n args: z.record(z.string(), z.unknown()).optional().describe('Directive arguments'),\n })).optional().describe('GraphQL directives'),\n});\n\nexport type GraphQLTypeConfig = z.infer<typeof GraphQLTypeConfigSchema>;\nexport type GraphQLTypeConfigInput = z.input<typeof GraphQLTypeConfigSchema>;\n\n// ==========================================\n// 2. Query Generation Configuration\n// ==========================================\n\n/**\n * GraphQL Query Configuration\n * \n * Configuration for auto-generating query fields from Objects.\n */\nexport const GraphQLQueryConfigSchema = z.object({\n /** Query name */\n name: z.string().describe('Query field name (camelCase recommended)'),\n \n /** Source Object */\n object: z.string().describe('Source ObjectQL object name'),\n \n /** Query type: single record or list */\n type: z.enum(['get', 'list', 'search']).describe('Query type'),\n \n /** Description */\n description: z.string().optional().describe('Query description'),\n \n /** Input arguments */\n args: z.record(z.string(), z.object({\n type: z.string().describe('GraphQL type (e.g., \"ID!\", \"String\", \"Int\")'),\n description: z.string().optional().describe('Argument description'),\n defaultValue: z.unknown().optional().describe('Default value'),\n })).optional().describe('Query arguments'),\n \n /** Filtering configuration */\n filtering: z.object({\n enabled: z.boolean().default(true).describe('Allow filtering'),\n fields: z.array(z.string()).optional().describe('Filterable fields'),\n operators: z.array(z.enum([\n 'eq', 'ne', 'gt', 'gte', 'lt', 'lte',\n 'in', 'notIn', 'contains', 'startsWith', 'endsWith',\n 'isNull', 'isNotNull',\n ])).optional().describe('Allowed filter operators'),\n }).optional().describe('Filtering capabilities'),\n \n /** Sorting configuration */\n sorting: z.object({\n enabled: z.boolean().default(true).describe('Allow sorting'),\n fields: z.array(z.string()).optional().describe('Sortable fields'),\n defaultSort: z.object({\n field: z.string(),\n direction: z.enum(['ASC', 'DESC']),\n }).optional().describe('Default sort order'),\n }).optional().describe('Sorting capabilities'),\n \n /** Pagination configuration */\n pagination: z.object({\n enabled: z.boolean().default(true).describe('Enable pagination'),\n type: z.enum(['offset', 'cursor', 'relay']).default('offset').describe('Pagination style'),\n defaultLimit: z.number().int().min(1).default(20).describe('Default page size'),\n maxLimit: z.number().int().min(1).default(100).describe('Maximum page size'),\n cursors: z.object({\n field: z.string().default('id').describe('Field to use for cursor pagination'),\n }).optional(),\n }).optional().describe('Pagination configuration'),\n \n /** Field selection */\n fields: z.object({\n /** Always include these fields */\n required: z.array(z.string()).optional().describe('Required fields (always returned)'),\n \n /** Allow selecting these fields */\n selectable: z.array(z.string()).optional().describe('Selectable fields'),\n }).optional().describe('Field selection configuration'),\n \n /** Authorization */\n authRequired: z.boolean().default(true).describe('Require authentication'),\n permissions: z.array(z.string()).optional().describe('Required permissions'),\n \n /** Caching */\n cache: z.object({\n enabled: z.boolean().default(false).describe('Enable caching'),\n ttl: z.number().int().min(0).optional().describe('Cache TTL in seconds'),\n key: z.string().optional().describe('Cache key template'),\n }).optional().describe('Query caching'),\n});\n\nexport type GraphQLQueryConfig = z.infer<typeof GraphQLQueryConfigSchema>;\nexport type GraphQLQueryConfigInput = z.input<typeof GraphQLQueryConfigSchema>;\n\n// ==========================================\n// 3. Mutation Generation Configuration\n// ==========================================\n\n/**\n * GraphQL Mutation Configuration\n * \n * Configuration for auto-generating mutation fields from Objects.\n */\nexport const GraphQLMutationConfigSchema = z.object({\n /** Mutation name */\n name: z.string().describe('Mutation field name (camelCase recommended)'),\n \n /** Source Object */\n object: z.string().describe('Source ObjectQL object name'),\n \n /** Mutation type */\n type: z.enum(['create', 'update', 'delete', 'upsert', 'custom']).describe('Mutation type'),\n \n /** Description */\n description: z.string().optional().describe('Mutation description'),\n \n /** Input type configuration */\n input: z.object({\n /** Input type name */\n typeName: z.string().optional().describe('Custom input type name'),\n \n /** Fields to include in input */\n fields: z.object({\n include: z.array(z.string()).optional().describe('Fields to include'),\n exclude: z.array(z.string()).optional().describe('Fields to exclude'),\n required: z.array(z.string()).optional().describe('Required input fields'),\n }).optional().describe('Input field configuration'),\n \n /** Validation */\n validation: z.object({\n enabled: z.boolean().default(true).describe('Enable input validation'),\n rules: z.array(z.string()).optional().describe('Custom validation rules'),\n }).optional().describe('Input validation'),\n }).optional().describe('Input configuration'),\n \n /** Return type configuration */\n output: z.object({\n /** Type of output */\n type: z.enum(['object', 'payload', 'boolean', 'custom']).default('object').describe('Output type'),\n \n /** Include success/error envelope */\n includeEnvelope: z.boolean().optional().default(false).describe('Wrap in success/error payload'),\n \n /** Custom output type */\n customType: z.string().optional().describe('Custom output type name'),\n }).optional().describe('Output configuration'),\n \n /** Transaction handling */\n transaction: z.object({\n enabled: z.boolean().default(true).describe('Use database transaction'),\n isolationLevel: z.enum(['read_uncommitted', 'read_committed', 'repeatable_read', 'serializable']).optional().describe('Transaction isolation level'),\n }).optional().describe('Transaction configuration'),\n \n /** Authorization */\n authRequired: z.boolean().default(true).describe('Require authentication'),\n permissions: z.array(z.string()).optional().describe('Required permissions'),\n \n /** Hooks */\n hooks: z.object({\n before: z.array(z.string()).optional().describe('Pre-mutation hooks'),\n after: z.array(z.string()).optional().describe('Post-mutation hooks'),\n }).optional().describe('Lifecycle hooks'),\n});\n\nexport type GraphQLMutationConfig = z.infer<typeof GraphQLMutationConfigSchema>;\nexport type GraphQLMutationConfigInput = z.input<typeof GraphQLMutationConfigSchema>;\n\n// ==========================================\n// 4. Subscription Configuration\n// ==========================================\n\n/**\n * GraphQL Subscription Configuration\n * \n * Configuration for real-time GraphQL subscriptions.\n */\nexport const GraphQLSubscriptionConfigSchema = z.object({\n /** Subscription name */\n name: z.string().describe('Subscription field name (camelCase recommended)'),\n \n /** Source Object */\n object: z.string().describe('Source ObjectQL object name'),\n \n /** Subscription trigger events */\n events: z.array(z.enum(['created', 'updated', 'deleted', 'custom'])).describe('Events to subscribe to'),\n \n /** Description */\n description: z.string().optional().describe('Subscription description'),\n \n /** Filtering */\n filter: z.object({\n enabled: z.boolean().default(true).describe('Allow filtering subscriptions'),\n fields: z.array(z.string()).optional().describe('Filterable fields'),\n }).optional().describe('Subscription filtering'),\n \n /** Payload configuration */\n payload: z.object({\n /** Include the modified entity */\n includeEntity: z.boolean().default(true).describe('Include entity in payload'),\n \n /** Include previous values (for updates) */\n includePreviousValues: z.boolean().optional().default(false).describe('Include previous field values'),\n \n /** Include mutation metadata */\n includeMeta: z.boolean().optional().default(true).describe('Include metadata (timestamp, user, etc.)'),\n }).optional().describe('Payload configuration'),\n \n /** Authorization */\n authRequired: z.boolean().default(true).describe('Require authentication'),\n permissions: z.array(z.string()).optional().describe('Required permissions'),\n \n /** Rate limiting for subscriptions */\n rateLimit: z.object({\n enabled: z.boolean().default(true).describe('Enable rate limiting'),\n maxSubscriptionsPerUser: z.number().int().min(1).default(10).describe('Max concurrent subscriptions per user'),\n throttleMs: z.number().int().min(0).optional().describe('Throttle interval in milliseconds'),\n }).optional().describe('Subscription rate limiting'),\n});\n\nexport type GraphQLSubscriptionConfig = z.infer<typeof GraphQLSubscriptionConfigSchema>;\nexport type GraphQLSubscriptionConfigInput = z.input<typeof GraphQLSubscriptionConfigSchema>;\n\n// ==========================================\n// 5. Resolver Configuration\n// ==========================================\n\n/**\n * GraphQL Resolver Configuration\n * \n * Configuration for custom resolver logic.\n */\nexport const GraphQLResolverConfigSchema = z.object({\n /** Field path (e.g., \"Query.users\", \"Mutation.createUser\") */\n path: z.string().describe('Resolver path (Type.field)'),\n \n /** Resolver implementation type */\n type: z.enum(['datasource', 'computed', 'script', 'proxy']).describe('Resolver implementation type'),\n \n /** Implementation details */\n implementation: z.object({\n /** For datasource type */\n datasource: z.string().optional().describe('Datasource ID'),\n query: z.string().optional().describe('Query/SQL to execute'),\n \n /** For computed type */\n expression: z.string().optional().describe('Computation expression'),\n dependencies: z.array(z.string()).optional().describe('Dependent fields'),\n \n /** For script type */\n script: z.string().optional().describe('Script ID or inline code'),\n \n /** For proxy type */\n url: z.string().optional().describe('Proxy URL'),\n method: z.enum(['GET', 'POST', 'PUT', 'DELETE']).optional().describe('HTTP method'),\n }).optional().describe('Implementation configuration'),\n \n /** Caching */\n cache: z.object({\n enabled: z.boolean().default(false).describe('Enable resolver caching'),\n ttl: z.number().int().min(0).optional().describe('Cache TTL in seconds'),\n keyArgs: z.array(z.string()).optional().describe('Arguments to include in cache key'),\n }).optional().describe('Resolver caching'),\n});\n\nexport type GraphQLResolverConfig = z.infer<typeof GraphQLResolverConfigSchema>;\nexport type GraphQLResolverConfigInput = z.input<typeof GraphQLResolverConfigSchema>;\n\n// ==========================================\n// 6. DataLoader Configuration\n// ==========================================\n\n/**\n * GraphQL DataLoader Configuration\n * \n * Configuration for batching and caching with DataLoader pattern.\n * Prevents N+1 query problems in GraphQL.\n */\nexport const GraphQLDataLoaderConfigSchema = z.object({\n /** Loader name */\n name: z.string().describe('DataLoader name'),\n \n /** Source Object or datasource */\n source: z.string().describe('Source object or datasource'),\n \n /** Batch function configuration */\n batchFunction: z.object({\n /** Type of batch operation */\n type: z.enum(['findByIds', 'query', 'script', 'custom']).describe('Batch function type'),\n \n /** For findByIds */\n keyField: z.string().optional().describe('Field to batch on (e.g., \"id\")'),\n \n /** For query */\n query: z.string().optional().describe('Query template'),\n \n /** For script */\n script: z.string().optional().describe('Script ID'),\n \n /** Maximum batch size */\n maxBatchSize: z.number().int().min(1).optional().default(100).describe('Maximum batch size'),\n }).describe('Batch function configuration'),\n \n /** Caching */\n cache: z.object({\n enabled: z.boolean().default(true).describe('Enable per-request caching'),\n \n /** Cache key function */\n keyFn: z.string().optional().describe('Custom cache key function'),\n }).optional().describe('DataLoader caching'),\n \n /** Options */\n options: z.object({\n /** Batch multiple requests in single tick */\n batch: z.boolean().default(true).describe('Enable batching'),\n \n /** Cache loaded values */\n cache: z.boolean().default(true).describe('Enable caching'),\n \n /** Maximum cache size */\n maxCacheSize: z.number().int().min(0).optional().describe('Max cache entries'),\n }).optional().describe('DataLoader options'),\n});\n\nexport type GraphQLDataLoaderConfig = z.infer<typeof GraphQLDataLoaderConfigSchema>;\nexport type GraphQLDataLoaderConfigInput = z.input<typeof GraphQLDataLoaderConfigSchema>;\n\n// ==========================================\n// 7. GraphQL Directive Schema\n// ==========================================\n\n/**\n * GraphQL Directive Location\n * \n * Where a directive can be used in the schema.\n */\nexport const GraphQLDirectiveLocation = z.enum([\n // Executable Directive Locations\n 'QUERY',\n 'MUTATION',\n 'SUBSCRIPTION',\n 'FIELD',\n 'FRAGMENT_DEFINITION',\n 'FRAGMENT_SPREAD',\n 'INLINE_FRAGMENT',\n 'VARIABLE_DEFINITION',\n \n // Type System Directive Locations\n 'SCHEMA',\n 'SCALAR',\n 'OBJECT',\n 'FIELD_DEFINITION',\n 'ARGUMENT_DEFINITION',\n 'INTERFACE',\n 'UNION',\n 'ENUM',\n 'ENUM_VALUE',\n 'INPUT_OBJECT',\n 'INPUT_FIELD_DEFINITION',\n]);\n\nexport type GraphQLDirectiveLocation = z.infer<typeof GraphQLDirectiveLocation>;\n\n/**\n * GraphQL Directive Configuration\n * \n * Custom directives for schema metadata and behavior.\n */\nexport const GraphQLDirectiveConfigSchema = z.object({\n /** Directive name */\n name: z.string().regex(/^[a-z][a-zA-Z0-9]*$/).describe('Directive name (camelCase)'),\n \n /** Description */\n description: z.string().optional().describe('Directive description'),\n \n /** Where directive can be used */\n locations: z.array(GraphQLDirectiveLocation).describe('Directive locations'),\n \n /** Arguments */\n args: z.record(z.string(), z.object({\n type: z.string().describe('Argument type'),\n description: z.string().optional().describe('Argument description'),\n defaultValue: z.unknown().optional().describe('Default value'),\n })).optional().describe('Directive arguments'),\n \n /** Is repeatable */\n repeatable: z.boolean().optional().default(false).describe('Can be applied multiple times'),\n \n /** Implementation */\n implementation: z.object({\n /** Directive behavior type */\n type: z.enum(['auth', 'validation', 'transform', 'cache', 'deprecation', 'custom']).describe('Directive type'),\n \n /** Handler function */\n handler: z.string().optional().describe('Handler function name or script'),\n }).optional().describe('Directive implementation'),\n});\n\nexport type GraphQLDirectiveConfig = z.infer<typeof GraphQLDirectiveConfigSchema>;\nexport type GraphQLDirectiveConfigInput = z.input<typeof GraphQLDirectiveConfigSchema>;\n\n// ==========================================\n// 8. GraphQL Security - Query Depth Limiting\n// ==========================================\n\n/**\n * Query Depth Limiting Configuration\n * \n * Prevents deeply nested queries that could cause performance issues.\n */\nexport const GraphQLQueryDepthLimitSchema = z.object({\n /** Enable depth limiting */\n enabled: z.boolean().default(true).describe('Enable query depth limiting'),\n \n /** Maximum allowed depth */\n maxDepth: z.number().int().min(1).default(10).describe('Maximum query depth'),\n \n /** Fields to ignore in depth calculation */\n ignoreFields: z.array(z.string()).optional().describe('Fields excluded from depth calculation'),\n \n /** Callback on depth exceeded */\n onDepthExceeded: z.enum(['reject', 'log', 'warn']).default('reject').describe('Action when depth exceeded'),\n \n /** Custom error message */\n errorMessage: z.string().optional().describe('Custom error message for depth violations'),\n});\n\nexport type GraphQLQueryDepthLimit = z.infer<typeof GraphQLQueryDepthLimitSchema>;\nexport type GraphQLQueryDepthLimitInput = z.input<typeof GraphQLQueryDepthLimitSchema>;\n\n// ==========================================\n// 9. GraphQL Security - Query Complexity\n// ==========================================\n\n/**\n * Query Complexity Calculation Configuration\n * \n * Assigns complexity scores to fields and limits total query complexity.\n * Prevents expensive queries from overloading the server.\n */\nexport const GraphQLQueryComplexitySchema = z.object({\n /** Enable complexity limiting */\n enabled: z.boolean().default(true).describe('Enable query complexity limiting'),\n \n /** Maximum allowed complexity score */\n maxComplexity: z.number().int().min(1).default(1000).describe('Maximum query complexity'),\n \n /** Default field complexity */\n defaultFieldComplexity: z.number().int().min(0).default(1).describe('Default complexity per field'),\n \n /** Field-specific complexity scores */\n fieldComplexity: z.record(z.string(), z.union([\n z.number().int().min(0),\n z.object({\n /** Base complexity */\n base: z.number().int().min(0).describe('Base complexity'),\n \n /** Multiplier based on arguments */\n multiplier: z.string().optional().describe('Argument multiplier (e.g., \"limit\")'),\n \n /** Custom complexity calculation */\n calculator: z.string().optional().describe('Custom calculator function'),\n }),\n ])).optional().describe('Per-field complexity configuration'),\n \n /** List multiplier */\n listMultiplier: z.number().min(0).default(10).describe('Multiplier for list fields'),\n \n /** Callback on complexity exceeded */\n onComplexityExceeded: z.enum(['reject', 'log', 'warn']).default('reject').describe('Action when complexity exceeded'),\n \n /** Custom error message */\n errorMessage: z.string().optional().describe('Custom error message for complexity violations'),\n});\n\nexport type GraphQLQueryComplexity = z.infer<typeof GraphQLQueryComplexitySchema>;\nexport type GraphQLQueryComplexityInput = z.input<typeof GraphQLQueryComplexitySchema>;\n\n// ==========================================\n// 10. GraphQL Security - Rate Limiting\n// ==========================================\n\n/**\n * GraphQL Rate Limiting Configuration\n * \n * Rate limiting for GraphQL operations.\n */\nexport const GraphQLRateLimitSchema = z.object({\n /** Enable rate limiting */\n enabled: z.boolean().default(true).describe('Enable rate limiting'),\n \n /** Rate limit strategy */\n strategy: z.enum(['token_bucket', 'fixed_window', 'sliding_window', 'cost_based']).default('token_bucket').describe('Rate limiting strategy'),\n \n /** Global rate limits */\n global: z.object({\n /** Requests per time window */\n maxRequests: z.number().int().min(1).default(1000).describe('Maximum requests per window'),\n \n /** Time window in milliseconds */\n windowMs: z.number().int().min(1000).default(60000).describe('Time window in milliseconds'),\n }).optional().describe('Global rate limits'),\n \n /** Per-user rate limits */\n perUser: z.object({\n /** Requests per time window */\n maxRequests: z.number().int().min(1).default(100).describe('Maximum requests per user per window'),\n \n /** Time window in milliseconds */\n windowMs: z.number().int().min(1000).default(60000).describe('Time window in milliseconds'),\n }).optional().describe('Per-user rate limits'),\n \n /** Cost-based rate limiting */\n costBased: z.object({\n /** Enable cost-based limiting */\n enabled: z.boolean().default(false).describe('Enable cost-based rate limiting'),\n \n /** Maximum cost per time window */\n maxCost: z.number().int().min(1).default(10000).describe('Maximum cost per window'),\n \n /** Time window in milliseconds */\n windowMs: z.number().int().min(1000).default(60000).describe('Time window in milliseconds'),\n \n /** Use complexity as cost */\n useComplexityAsCost: z.boolean().default(true).describe('Use query complexity as cost'),\n }).optional().describe('Cost-based rate limiting'),\n \n /** Operation-specific limits */\n operations: z.record(z.string(), z.object({\n maxRequests: z.number().int().min(1).describe('Max requests for this operation'),\n windowMs: z.number().int().min(1000).describe('Time window'),\n })).optional().describe('Per-operation rate limits'),\n \n /** Callback on limit exceeded */\n onLimitExceeded: z.enum(['reject', 'queue', 'log']).default('reject').describe('Action when rate limit exceeded'),\n \n /** Custom error message */\n errorMessage: z.string().optional().describe('Custom error message for rate limit violations'),\n \n /** Headers to include in response */\n includeHeaders: z.boolean().default(true).describe('Include rate limit headers in response'),\n});\n\nexport type GraphQLRateLimit = z.infer<typeof GraphQLRateLimitSchema>;\nexport type GraphQLRateLimitInput = z.input<typeof GraphQLRateLimitSchema>;\n\n// ==========================================\n// 11. GraphQL Security - Persisted Queries\n// ==========================================\n\n/**\n * Persisted Queries Configuration\n * \n * Only allow pre-registered queries to execute (allow list approach).\n * Improves security and performance.\n */\nexport const GraphQLPersistedQuerySchema = z.object({\n /** Enable persisted queries */\n enabled: z.boolean().default(false).describe('Enable persisted queries'),\n \n /** Enforcement mode */\n mode: z.enum(['optional', 'required']).default('optional').describe('Persisted query mode (optional: allow both, required: only persisted)'),\n \n /** Query store configuration */\n store: z.object({\n /** Store type */\n type: z.enum(['memory', 'redis', 'database', 'file']).default('memory').describe('Query store type'),\n \n /** Store connection string */\n connection: z.string().optional().describe('Store connection string or path'),\n \n /** TTL for cached queries */\n ttl: z.number().int().min(0).optional().describe('TTL in seconds for stored queries'),\n }).optional().describe('Query store configuration'),\n \n /** Automatic Persisted Queries (APQ) */\n apq: z.object({\n /** Enable APQ */\n enabled: z.boolean().default(true).describe('Enable Automatic Persisted Queries'),\n \n /** Hash algorithm */\n hashAlgorithm: z.enum(['sha256', 'sha1', 'md5']).default('sha256').describe('Hash algorithm for query IDs'),\n \n /** Cache control */\n cache: z.object({\n /** Cache TTL */\n ttl: z.number().int().min(0).default(3600).describe('Cache TTL in seconds'),\n \n /** Max cache size */\n maxSize: z.number().int().min(1).optional().describe('Maximum number of cached queries'),\n }).optional().describe('APQ cache configuration'),\n }).optional().describe('Automatic Persisted Queries configuration'),\n \n /** Query allow list */\n allowlist: z.object({\n /** Enable allow list mode */\n enabled: z.boolean().default(false).describe('Enable query allow list (reject queries not in list)'),\n \n /** Allowed query IDs */\n queries: z.array(z.object({\n id: z.string().describe('Query ID or hash'),\n operation: z.string().optional().describe('Operation name'),\n query: z.string().optional().describe('Query string'),\n })).optional().describe('Allowed queries'),\n \n /** External allow list source */\n source: z.string().optional().describe('External allow list source (file path or URL)'),\n }).optional().describe('Query allow list configuration'),\n \n /** Security */\n security: z.object({\n /** Maximum query size */\n maxQuerySize: z.number().int().min(1).optional().describe('Maximum query string size in bytes'),\n \n /** Reject introspection in production */\n rejectIntrospection: z.boolean().default(false).describe('Reject introspection queries'),\n }).optional().describe('Security configuration'),\n});\n\nexport type GraphQLPersistedQuery = z.infer<typeof GraphQLPersistedQuerySchema>;\nexport type GraphQLPersistedQueryInput = z.input<typeof GraphQLPersistedQuerySchema>;\n\n// ==========================================\n// 12. Complete GraphQL Configuration\n// ==========================================\n\n/**\n * Complete GraphQL Configuration\n * \n * Root configuration for GraphQL API generation and security.\n */\nexport const GraphQLConfigSchema = z.object({\n /** Enable GraphQL API */\n enabled: z.boolean().default(true).describe('Enable GraphQL API'),\n \n /** GraphQL endpoint path */\n path: z.string().default('/graphql').describe('GraphQL endpoint path'),\n \n /** GraphQL Playground */\n playground: z.object({\n enabled: z.boolean().default(true).describe('Enable GraphQL Playground'),\n path: z.string().default('/playground').describe('Playground path'),\n }).optional().describe('GraphQL Playground configuration'),\n \n /** Schema generation */\n schema: z.object({\n /** Auto-generate types from Objects */\n autoGenerateTypes: z.boolean().default(true).describe('Auto-generate types from Objects'),\n \n /** Type configurations */\n types: z.array(GraphQLTypeConfigSchema).optional().describe('Type configurations'),\n \n /** Query configurations */\n queries: z.array(GraphQLQueryConfigSchema).optional().describe('Query configurations'),\n \n /** Mutation configurations */\n mutations: z.array(GraphQLMutationConfigSchema).optional().describe('Mutation configurations'),\n \n /** Subscription configurations */\n subscriptions: z.array(GraphQLSubscriptionConfigSchema).optional().describe('Subscription configurations'),\n \n /** Custom resolvers */\n resolvers: z.array(GraphQLResolverConfigSchema).optional().describe('Custom resolver configurations'),\n \n /** Custom directives */\n directives: z.array(GraphQLDirectiveConfigSchema).optional().describe('Custom directive configurations'),\n }).optional().describe('Schema generation configuration'),\n \n /** DataLoader configurations */\n dataLoaders: z.array(GraphQLDataLoaderConfigSchema).optional().describe('DataLoader configurations'),\n \n /** Security configuration */\n security: z.object({\n /** Query depth limiting */\n depthLimit: GraphQLQueryDepthLimitSchema.optional().describe('Query depth limiting'),\n \n /** Query complexity */\n complexity: GraphQLQueryComplexitySchema.optional().describe('Query complexity calculation'),\n \n /** Rate limiting */\n rateLimit: GraphQLRateLimitSchema.optional().describe('Rate limiting'),\n \n /** Persisted queries */\n persistedQueries: GraphQLPersistedQuerySchema.optional().describe('Persisted queries'),\n }).optional().describe('Security configuration'),\n});\n\nexport const GraphQLConfig = Object.assign(GraphQLConfigSchema, {\n create: <T extends z.input<typeof GraphQLConfigSchema>>(config: T) => config,\n});\n\nexport type GraphQLConfig = z.infer<typeof GraphQLConfigSchema>;\nexport type GraphQLConfigInput = z.input<typeof GraphQLConfigSchema>;\n\n// ==========================================\n// Helper Functions\n// ==========================================\n\n/**\n * Helper to map ObjectQL field type to GraphQL scalar type\n */\nexport const mapFieldTypeToGraphQL = (fieldType: z.infer<typeof FieldType>): string => {\n const mapping: Record<string, string> = {\n // Core Text\n 'text': 'String',\n 'textarea': 'String',\n 'email': 'Email',\n 'url': 'URL',\n 'phone': 'PhoneNumber',\n 'password': 'String',\n \n // Rich Content\n 'markdown': 'String',\n 'html': 'String',\n 'richtext': 'String',\n \n // Numbers\n 'number': 'Float',\n 'currency': 'Currency',\n 'percent': 'Float',\n \n // Date & Time\n 'date': 'Date',\n 'datetime': 'DateTime',\n 'time': 'Time',\n \n // Logic\n 'boolean': 'Boolean',\n 'toggle': 'Boolean',\n \n // Selection\n 'select': 'String',\n 'multiselect': '[String]',\n 'radio': 'String',\n 'checkboxes': '[String]',\n \n // Relational\n 'lookup': 'ID',\n 'master_detail': 'ID',\n 'tree': 'ID',\n \n // Media\n 'image': 'URL',\n 'file': 'URL',\n 'avatar': 'URL',\n 'video': 'URL',\n 'audio': 'URL',\n \n // Calculated\n 'formula': 'String',\n 'summary': 'Float',\n 'autonumber': 'String',\n \n // Enhanced Types\n 'location': 'JSONObject',\n 'address': 'JSONObject',\n 'code': 'String',\n 'json': 'JSON',\n 'color': 'String',\n 'rating': 'Float',\n 'slider': 'Float',\n 'signature': 'String',\n 'qrcode': 'String',\n 'progress': 'Float',\n 'tags': '[String]',\n \n // AI/ML\n 'vector': '[Float]',\n };\n \n return mapping[fieldType] || 'String';\n};\n","// Copyright (c) 2025 ObjectStack. Licensed under the Apache-2.0 license.\n\nimport { z } from 'zod';\nimport { ApiErrorSchema, BaseResponseSchema, RecordDataSchema } from './contract.zod';\n\n/**\n * Batch Operations API\n * \n * Provides efficient bulk data operations with transaction support.\n * Implements P0/P1 requirements for ObjectStack kernel.\n * \n * Features:\n * - Batch create/update/delete operations\n * - Atomic transaction support (all-or-none)\n * - Partial success handling\n * - Detailed error reporting per record\n * \n * Industry alignment: Salesforce Bulk API, Microsoft Dynamics Bulk Operations\n */\n\n// ==========================================\n// Batch Operation Types\n// ==========================================\n\n/**\n * Batch Operation Type Enum\n * Defines the type of batch operation to perform\n */\nexport const BatchOperationType = z.enum([\n 'create', // Batch insert\n 'update', // Batch update\n 'upsert', // Batch upsert (insert or update based on external ID)\n 'delete', // Batch delete\n]);\n\nexport type BatchOperationType = z.infer<typeof BatchOperationType>;\n\n// ==========================================\n// Batch Request Schemas\n// ==========================================\n\n/**\n * Batch Record Schema\n * Individual record in a batch operation\n */\nexport const BatchRecordSchema = z.object({\n id: z.string().optional().describe('Record ID (required for update/delete)'),\n data: RecordDataSchema.optional().describe('Record data (required for create/update/upsert)'),\n externalId: z.string().optional().describe('External ID for upsert matching'),\n});\n\nexport type BatchRecord = z.infer<typeof BatchRecordSchema>;\n\n/**\n * Batch Operation Options Schema\n * Configuration options for batch operations\n */\nexport const BatchOptionsSchema = z.object({\n atomic: z.boolean().optional().default(true).describe('If true, rollback entire batch on any failure (transaction mode)'),\n returnRecords: z.boolean().optional().default(false).describe('If true, return full record data in response'),\n continueOnError: z.boolean().optional().default(false).describe('If true (and atomic=false), continue processing remaining records after errors'),\n validateOnly: z.boolean().optional().default(false).describe('If true, validate records without persisting changes (dry-run mode)'),\n});\n\nexport type BatchOptions = z.infer<typeof BatchOptionsSchema>;\n\n/**\n * Batch Update Request Schema\n * Request payload for batch update operations\n * \n * @example\n * // POST /api/v1/data/{object}/batch\n * {\n * \"operation\": \"update\",\n * \"records\": [\n * { \"id\": \"1\", \"data\": { \"name\": \"Updated Name 1\", \"status\": \"active\" } },\n * { \"id\": \"2\", \"data\": { \"name\": \"Updated Name 2\", \"status\": \"active\" } }\n * ],\n * \"options\": {\n * \"atomic\": true,\n * \"returnRecords\": true\n * }\n * }\n */\nexport const BatchUpdateRequestSchema = z.object({\n operation: BatchOperationType.describe('Type of batch operation'),\n records: z.array(BatchRecordSchema).min(1).max(200).describe('Array of records to process (max 200 per batch)'),\n options: BatchOptionsSchema.optional().describe('Batch operation options'),\n});\n\nexport type BatchUpdateRequest = z.input<typeof BatchUpdateRequestSchema>;\n\n/**\n * Simplified Batch Update Request (for updateMany API)\n * Simplified request for batch updates without operation field\n * \n * @example\n * // POST /api/v1/data/{object}/updateMany\n * {\n * \"records\": [\n * { \"id\": \"1\", \"data\": { \"name\": \"Updated Name 1\" } },\n * { \"id\": \"2\", \"data\": { \"name\": \"Updated Name 2\" } }\n * ],\n * \"options\": { \"atomic\": true }\n * }\n */\nexport const UpdateManyRequestSchema = z.object({\n records: z.array(BatchRecordSchema).min(1).max(200).describe('Array of records to update (max 200 per batch)'),\n options: BatchOptionsSchema.optional().describe('Update options'),\n});\n\nexport type UpdateManyRequest = z.input<typeof UpdateManyRequestSchema>;\n\n// ==========================================\n// Batch Response Schemas\n// ==========================================\n\n/**\n * Batch Operation Result Schema\n * Result for a single record in a batch operation\n */\nexport const BatchOperationResultSchema = z.object({\n id: z.string().optional().describe('Record ID if operation succeeded'),\n success: z.boolean().describe('Whether this record was processed successfully'),\n errors: z.array(ApiErrorSchema).optional().describe('Array of errors if operation failed'),\n data: RecordDataSchema.optional().describe('Full record data (if returnRecords=true)'),\n index: z.number().optional().describe('Index of the record in the request array'),\n});\n\nexport type BatchOperationResult = z.infer<typeof BatchOperationResultSchema>;\n\n/**\n * Batch Update Response Schema\n * Response payload for batch operations\n * \n * @example Success Response\n * {\n * \"success\": true,\n * \"operation\": \"update\",\n * \"total\": 2,\n * \"succeeded\": 2,\n * \"failed\": 0,\n * \"results\": [\n * { \"id\": \"1\", \"success\": true, \"index\": 0 },\n * { \"id\": \"2\", \"success\": true, \"index\": 1 }\n * ],\n * \"meta\": {\n * \"timestamp\": \"2026-01-29T12:00:00Z\",\n * \"duration\": 150\n * }\n * }\n * \n * @example Partial Success Response (atomic=false)\n * {\n * \"success\": false,\n * \"operation\": \"update\",\n * \"total\": 2,\n * \"succeeded\": 1,\n * \"failed\": 1,\n * \"results\": [\n * { \"id\": \"1\", \"success\": true, \"index\": 0 },\n * { \n * \"success\": false, \n * \"index\": 1,\n * \"errors\": [{ \"code\": \"validation_error\", \"message\": \"Invalid email format\" }]\n * }\n * ],\n * \"meta\": {\n * \"timestamp\": \"2026-01-29T12:00:00Z\"\n * }\n * }\n */\nexport const BatchUpdateResponseSchema = BaseResponseSchema.extend({\n operation: BatchOperationType.optional().describe('Operation type that was performed'),\n total: z.number().describe('Total number of records in the batch'),\n succeeded: z.number().describe('Number of records that succeeded'),\n failed: z.number().describe('Number of records that failed'),\n results: z.array(BatchOperationResultSchema).describe('Detailed results for each record'),\n});\n\nexport type BatchUpdateResponse = z.infer<typeof BatchUpdateResponseSchema>;\n\n// ==========================================\n// Batch Delete Schemas\n// ==========================================\n\n/**\n * Batch Delete Request Schema\n * Simplified request for batch delete operations\n * \n * @example\n * // POST /api/v1/data/{object}/deleteMany\n * {\n * \"ids\": [\"1\", \"2\", \"3\"],\n * \"options\": { \"atomic\": true }\n * }\n */\nexport const DeleteManyRequestSchema = z.object({\n ids: z.array(z.string()).min(1).max(200).describe('Array of record IDs to delete (max 200)'),\n options: BatchOptionsSchema.optional().describe('Delete options'),\n});\n\nexport type DeleteManyRequest = z.infer<typeof DeleteManyRequestSchema>;\n\n// ==========================================\n// API Contract Exports\n// ==========================================\n\n/**\n * Batch API Contracts\n * Standardized contracts for batch operations\n */\nexport const BatchApiContracts = {\n batchOperation: {\n input: BatchUpdateRequestSchema,\n output: BatchUpdateResponseSchema,\n },\n updateMany: {\n input: UpdateManyRequestSchema,\n output: BatchUpdateResponseSchema,\n },\n deleteMany: {\n input: DeleteManyRequestSchema,\n output: BatchUpdateResponseSchema,\n },\n};\n\n/**\n * Batch Configuration Schema\n * \n * Configuration for enabling batch operations API.\n */\nexport const BatchConfigSchema = z.object({\n /** Enable batch operations */\n enabled: z.boolean().default(true).describe('Enable batch operations'),\n \n /** Maximum records per batch */\n maxRecordsPerBatch: z.number().int().min(1).max(1000).default(200).describe('Maximum records per batch'),\n \n /** Default options */\n defaultOptions: BatchOptionsSchema.optional().describe('Default batch options'),\n}).passthrough(); // Allow additional properties\n\nexport type BatchConfig = z.infer<typeof BatchConfigSchema>;\n","// Copyright (c) 2025 ObjectStack. Licensed under the Apache-2.0 license.\n\nimport { z } from 'zod';\n\n/**\n * HTTP Metadata Cache Protocol\n * \n * Implements efficient HTTP-level metadata caching with ETag support.\n * Implements P0 requirement for ObjectStack kernel.\n * \n * ## Caching in ObjectStack\n * \n * **HTTP Cache (`api/http-cache.zod.ts`) - This File**\n * - **Purpose**: Cache API responses at HTTP protocol level\n * - **Technologies**: HTTP headers (ETag, Last-Modified, Cache-Control), CDN\n * - **Configuration**: Cache-Control headers, validation tokens\n * - **Use case**: Reduce API response time for repeated metadata requests\n * - **Scope**: HTTP layer, client-server communication\n * \n * **Application Cache (`system/cache.zod.ts`)**\n * - **Purpose**: Cache computed data, query results, aggregations\n * - **Technologies**: Redis, Memcached, in-memory LRU\n * - **Configuration**: TTL, eviction policies, cache warming\n * - **Use case**: Cache expensive database queries, computed values\n * - **Scope**: Application layer, server-side data storage\n * \n * ## Features\n * - ETag-based conditional requests (HTTP 304 Not Modified)\n * - Cache-Control directives\n * - Metadata versioning\n * - Selective cache invalidation\n * \n * Industry alignment: HTTP Caching (RFC 7234), Salesforce Metadata API\n * \n * @see ../../system/cache.zod.ts for application-level caching\n */\n\n// ==========================================\n// Cache Control Headers\n// ==========================================\n\n/**\n * Cache Control Directive Enum\n * Standard HTTP cache control directives\n */\nexport const CacheDirective = z.enum([\n 'public', // Cacheable by any cache\n 'private', // Cacheable only by user-agent\n 'no-cache', // Must revalidate with server\n 'no-store', // Never cache\n 'must-revalidate', // Must revalidate stale responses\n 'max-age', // Maximum cache age in seconds\n]);\n\nexport type CacheDirective = z.infer<typeof CacheDirective>;\n\n/**\n * Cache Control Schema\n * HTTP cache control configuration\n * \n * @example\n * {\n * \"directives\": [\"public\", \"max-age\"],\n * \"maxAge\": 3600,\n * \"staleWhileRevalidate\": 86400\n * }\n */\nexport const CacheControlSchema = z.object({\n directives: z.array(CacheDirective).describe('Cache control directives'),\n maxAge: z.number().optional().describe('Maximum cache age in seconds'),\n staleWhileRevalidate: z.number().optional().describe('Allow serving stale content while revalidating (seconds)'),\n staleIfError: z.number().optional().describe('Allow serving stale content on error (seconds)'),\n});\n\nexport type CacheControl = z.infer<typeof CacheControlSchema>;\n\n// ==========================================\n// ETag Support\n// ==========================================\n\n/**\n * ETag Schema\n * Entity tag for cache validation\n * \n * ETags can be:\n * - Strong: Exact match required (e.g., \"686897696a7c876b7e\")\n * - Weak: Semantic equivalence (e.g., W/\"686897696a7c876b7e\")\n */\nexport const ETagSchema = z.object({\n value: z.string().describe('ETag value (hash or version identifier)'),\n weak: z.boolean().optional().default(false).describe('Whether this is a weak ETag'),\n});\n\nexport type ETag = z.infer<typeof ETagSchema>;\n\n// ==========================================\n// Metadata Cache Request\n// ==========================================\n\n/**\n * Metadata Cache Request Schema\n * Request with cache validation headers\n * \n * @example\n * // GET /api/v1/metadata/objects/account\n * // Headers:\n * // If-None-Match: \"686897696a7c876b7e\"\n * // If-Modified-Since: Wed, 21 Oct 2015 07:28:00 GMT\n */\nexport const MetadataCacheRequestSchema = z.object({\n ifNoneMatch: z.string().optional().describe('ETag value for conditional request (If-None-Match header)'),\n ifModifiedSince: z.string().datetime().optional().describe('Timestamp for conditional request (If-Modified-Since header)'),\n cacheControl: CacheControlSchema.optional().describe('Client cache control preferences'),\n});\n\nexport type MetadataCacheRequest = z.infer<typeof MetadataCacheRequestSchema>;\n\n// ==========================================\n// Metadata Cache Response\n// ==========================================\n\n/**\n * Metadata Cache Response Schema\n * Response with cache control headers\n * \n * @example Success Response (200 OK)\n * {\n * \"data\": { \"object\": \"account\" },\n * \"etag\": {\n * \"value\": \"686897696a7c876b7e\",\n * \"weak\": false\n * },\n * \"lastModified\": \"2026-01-29T12:00:00Z\",\n * \"cacheControl\": {\n * \"directives\": [\"public\", \"max-age\"],\n * \"maxAge\": 3600\n * }\n * }\n * \n * @example Not Modified Response (304 Not Modified)\n * {\n * \"notModified\": true,\n * \"etag\": {\n * \"value\": \"686897696a7c876b7e\"\n * }\n * }\n */\nexport const MetadataCacheResponseSchema = z.object({\n data: z.unknown().optional().describe('Metadata payload (omitted for 304 Not Modified)'),\n etag: ETagSchema.optional().describe('ETag for this resource version'),\n lastModified: z.string().datetime().optional().describe('Last modification timestamp'),\n cacheControl: CacheControlSchema.optional().describe('Cache control directives'),\n notModified: z.boolean().optional().default(false).describe('True if resource has not been modified (304 response)'),\n version: z.string().optional().describe('Metadata version identifier'),\n});\n\nexport type MetadataCacheResponse = z.infer<typeof MetadataCacheResponseSchema>;\n\n// ==========================================\n// Metadata Cache Invalidation\n// ==========================================\n\n/**\n * Cache Invalidation Target Enum\n * Specifies what to invalidate\n */\nexport const CacheInvalidationTarget = z.enum([\n 'all', // Invalidate all cached metadata\n 'object', // Invalidate specific object metadata\n 'field', // Invalidate specific field metadata\n 'permission', // Invalidate permission metadata\n 'layout', // Invalidate layout metadata\n 'custom', // Custom invalidation pattern\n]);\n\nexport type CacheInvalidationTarget = z.infer<typeof CacheInvalidationTarget>;\n\n/**\n * Cache Invalidation Request Schema\n * Request to invalidate cached metadata\n * \n * @example\n * // POST /api/v1/metadata/cache/invalidate\n * {\n * \"target\": \"object\",\n * \"identifiers\": [\"account\", \"contact\"],\n * \"cascade\": true\n * }\n */\nexport const CacheInvalidationRequestSchema = z.object({\n target: CacheInvalidationTarget.describe('What to invalidate'),\n identifiers: z.array(z.string()).optional().describe('Specific resources to invalidate (e.g., object names)'),\n cascade: z.boolean().optional().default(false).describe('If true, invalidate dependent resources'),\n pattern: z.string().optional().describe('Pattern for custom invalidation (supports wildcards)'),\n});\n\nexport type CacheInvalidationRequest = z.infer<typeof CacheInvalidationRequestSchema>;\n\n/**\n * Cache Invalidation Response Schema\n * Response for cache invalidation\n * \n * @example\n * {\n * \"success\": true,\n * \"invalidated\": 5,\n * \"targets\": [\"account\", \"contact\", \"opportunity\"]\n * }\n */\nexport const CacheInvalidationResponseSchema = z.object({\n success: z.boolean().describe('Whether invalidation succeeded'),\n invalidated: z.number().describe('Number of cache entries invalidated'),\n targets: z.array(z.string()).optional().describe('List of invalidated resources'),\n});\n\nexport type CacheInvalidationResponse = z.infer<typeof CacheInvalidationResponseSchema>;\n\n// ==========================================\n// Metadata Cache API Methods\n// ==========================================\n\n/**\n * Metadata Cache API Client Interface\n * \n * @example Usage\n * // Get metadata with cache support\n * const response = await client.meta.getCached('account', {\n * ifNoneMatch: '\"686897696a7c876b7e\"'\n * });\n * \n * if (response.notModified) {\n * // Use cached version\n * } else {\n * // Update cache with response.data\n * cache.set('account', response.data, {\n * etag: response.etag?.value,\n * maxAge: response.cacheControl?.maxAge\n * });\n * }\n */\nexport const MetadataCacheApi = {\n getCached: {\n input: MetadataCacheRequestSchema,\n output: MetadataCacheResponseSchema,\n },\n invalidate: {\n input: CacheInvalidationRequestSchema,\n output: CacheInvalidationResponseSchema,\n },\n};\n","// Copyright (c) 2025 ObjectStack. Licensed under the Apache-2.0 license.\n\nimport { z } from 'zod';\n\n/**\n * Standardized Error Codes Protocol\n * \n * Implements P0 requirement for ObjectStack kernel.\n * Provides consistent, machine-readable error codes across the platform.\n * \n * Features:\n * - Categorized error codes (validation, authentication, authorization, etc.)\n * - HTTP status code mapping\n * - Localization support\n * - Retry guidance\n * \n * Industry alignment: Google Cloud Errors, AWS Error Codes, Stripe API Errors\n */\n\n// ==========================================\n// Error Code Categories\n// ==========================================\n\n/**\n * Error Category Enum\n * High-level categorization of errors\n */\nexport const ErrorCategory = z.enum([\n 'validation', // Input validation errors (400)\n 'authentication', // Authentication failures (401)\n 'authorization', // Permission denied errors (403)\n 'not_found', // Resource not found (404)\n 'conflict', // Resource conflict (409)\n 'rate_limit', // Rate limiting (429)\n 'server', // Internal server errors (500)\n 'external', // External service errors (502/503)\n 'maintenance', // Planned maintenance (503)\n]);\n\nexport type ErrorCategory = z.infer<typeof ErrorCategory>;\n\n// ==========================================\n// Standard Error Codes\n// ==========================================\n\n/**\n * Standard Error Code Enum\n * Machine-readable error codes for common error scenarios\n */\nexport const StandardErrorCode = z.enum([\n // Validation Errors (400)\n 'validation_error', // Generic validation failure\n 'invalid_field', // Invalid field value\n 'missing_required_field', // Required field missing\n 'invalid_format', // Field format invalid (e.g., email, date)\n 'value_too_long', // Field value exceeds max length\n 'value_too_short', // Field value below min length\n 'value_out_of_range', // Numeric value out of range\n 'invalid_reference', // Invalid foreign key reference\n 'duplicate_value', // Unique constraint violation\n 'invalid_query', // Malformed query syntax\n 'invalid_filter', // Invalid filter expression\n 'invalid_sort', // Invalid sort specification\n 'max_records_exceeded', // Query would return too many records\n \n // Authentication Errors (401)\n 'unauthenticated', // No valid authentication provided\n 'invalid_credentials', // Wrong username/password\n 'expired_token', // Authentication token expired\n 'invalid_token', // Authentication token invalid\n 'session_expired', // User session expired\n 'mfa_required', // Multi-factor authentication required\n 'email_not_verified', // Email verification required\n \n // Authorization Errors (403)\n 'permission_denied', // User lacks required permission\n 'insufficient_privileges', // Operation requires higher privileges\n 'field_not_accessible', // Field-level security restriction\n 'record_not_accessible', // Sharing rule restriction\n 'license_required', // Feature requires license\n 'ip_restricted', // IP address not allowed\n 'time_restricted', // Access outside allowed time window\n \n // Not Found Errors (404)\n 'resource_not_found', // Generic resource not found\n 'object_not_found', // Object/table not found\n 'record_not_found', // Record with given ID not found\n 'field_not_found', // Field not found in object\n 'endpoint_not_found', // API endpoint not found\n \n // Conflict Errors (409)\n 'resource_conflict', // Generic resource conflict\n 'concurrent_modification', // Record modified by another user\n 'delete_restricted', // Cannot delete due to dependencies\n 'duplicate_record', // Record already exists\n 'lock_conflict', // Record is locked by another process\n \n // Rate Limiting (429)\n 'rate_limit_exceeded', // Too many requests\n 'quota_exceeded', // API quota exceeded\n 'concurrent_limit_exceeded', // Too many concurrent requests\n \n // Server Errors (500)\n 'internal_error', // Generic internal server error\n 'database_error', // Database operation failed\n 'timeout', // Operation timed out\n 'service_unavailable', // Service temporarily unavailable\n 'not_implemented', // Feature not yet implemented\n \n // External Service Errors (502/503)\n 'external_service_error', // External API call failed\n 'integration_error', // Integration service error\n 'webhook_delivery_failed', // Webhook delivery failed\n \n // Batch Operation Errors\n 'batch_partial_failure', // Batch operation partially succeeded\n 'batch_complete_failure', // Batch operation completely failed\n 'transaction_failed', // Transaction rolled back\n]);\n\nexport type StandardErrorCode = z.infer<typeof StandardErrorCode>;\n\n// ==========================================\n// Enhanced Error Schema\n// ==========================================\n\n/**\n * HTTP Status Code mapping for error categories\n */\nexport const ErrorHttpStatusMap: Record<string, number> = {\n validation: 400,\n authentication: 401,\n authorization: 403,\n not_found: 404,\n conflict: 409,\n rate_limit: 429,\n server: 500,\n external: 502,\n maintenance: 503,\n};\n\n/**\n * Retry Strategy Enum\n * Guidance on whether to retry failed requests\n */\nexport const RetryStrategy = z.enum([\n 'no_retry', // Do not retry (permanent failure)\n 'retry_immediate', // Retry immediately\n 'retry_backoff', // Retry with exponential backoff\n 'retry_after', // Retry after specified delay\n]);\n\nexport type RetryStrategy = z.infer<typeof RetryStrategy>;\n\n/**\n * Field Error Schema\n * Detailed error for a specific field\n */\nexport const FieldErrorSchema = z.object({\n field: z.string().describe('Field path (supports dot notation)'),\n code: StandardErrorCode.describe('Error code for this field'),\n message: z.string().describe('Human-readable error message'),\n value: z.unknown().optional().describe('The invalid value that was provided'),\n constraint: z.unknown().optional().describe('The constraint that was violated (e.g., max length)'),\n});\n\nexport type FieldError = z.infer<typeof FieldErrorSchema>;\n\n/**\n * Enhanced API Error Schema\n * Standardized error response with detailed metadata\n * \n * @example Validation Error\n * {\n * \"code\": \"validation_error\",\n * \"message\": \"Validation failed for 2 fields\",\n * \"category\": \"validation\",\n * \"httpStatus\": 400,\n * \"retryable\": false,\n * \"retryStrategy\": \"no_retry\",\n * \"details\": {\n * \"fieldErrors\": [\n * {\n * \"field\": \"email\",\n * \"code\": \"invalid_format\",\n * \"message\": \"Email format is invalid\",\n * \"value\": \"not-an-email\"\n * },\n * {\n * \"field\": \"age\",\n * \"code\": \"value_out_of_range\",\n * \"message\": \"Age must be between 0 and 120\",\n * \"value\": 150,\n * \"constraint\": { \"min\": 0, \"max\": 120 }\n * }\n * ]\n * },\n * \"timestamp\": \"2026-01-29T12:00:00Z\",\n * \"requestId\": \"req_123456\",\n * \"documentation\": \"https://docs.objectstack.dev/errors/validation_error\"\n * }\n * \n * @example Rate Limit Error\n * {\n * \"code\": \"rate_limit_exceeded\",\n * \"message\": \"Rate limit exceeded. Try again in 60 seconds.\",\n * \"category\": \"rate_limit\",\n * \"httpStatus\": 429,\n * \"retryable\": true,\n * \"retryStrategy\": \"retry_after\",\n * \"retryAfter\": 60,\n * \"details\": {\n * \"limit\": 1000,\n * \"remaining\": 0,\n * \"resetAt\": \"2026-01-29T13:00:00Z\"\n * }\n * }\n */\nexport const EnhancedApiErrorSchema = z.object({\n code: StandardErrorCode.describe('Machine-readable error code'),\n message: z.string().describe('Human-readable error message'),\n category: ErrorCategory.optional().describe('Error category'),\n httpStatus: z.number().optional().describe('HTTP status code'),\n retryable: z.boolean().default(false).describe('Whether the request can be retried'),\n retryStrategy: RetryStrategy.optional().describe('Recommended retry strategy'),\n retryAfter: z.number().optional().describe('Seconds to wait before retrying'),\n details: z.unknown().optional().describe('Additional error context'),\n fieldErrors: z.array(FieldErrorSchema).optional().describe('Field-specific validation errors'),\n timestamp: z.string().datetime().optional().describe('When the error occurred'),\n requestId: z.string().optional().describe('Request ID for tracking'),\n traceId: z.string().optional().describe('Distributed trace ID'),\n documentation: z.string().url().optional().describe('URL to error documentation'),\n helpText: z.string().optional().describe('Suggested actions to resolve the error'),\n});\n\nexport type EnhancedApiError = z.infer<typeof EnhancedApiErrorSchema>;\n\n// ==========================================\n// Error Response Schema\n// ==========================================\n\n/**\n * Standardized Error Response Schema\n * Complete error response envelope\n * \n * @example\n * {\n * \"success\": false,\n * \"error\": {\n * \"code\": \"permission_denied\",\n * \"message\": \"You do not have permission to update this record\",\n * \"category\": \"authorization\",\n * \"httpStatus\": 403,\n * \"retryable\": false\n * }\n * }\n */\nexport const ErrorResponseSchema = z.object({\n success: z.literal(false).describe('Always false for error responses'),\n error: EnhancedApiErrorSchema.describe('Error details'),\n meta: z.object({\n timestamp: z.string().datetime().optional(),\n requestId: z.string().optional(),\n traceId: z.string().optional(),\n }).optional().describe('Response metadata'),\n});\n\nexport type ErrorResponse = z.infer<typeof ErrorResponseSchema>;\n\n// ==========================================\n// Helper Functions\n// ==========================================\n\n/**\n * Get HTTP status code for an error category\n * @deprecated Move to @objectstack/core. Will be removed from spec in v2.0.0\n */\nexport function getHttpStatusForCategory(category: ErrorCategory): number {\n return ErrorHttpStatusMap[category] || 500;\n}\n\n/**\n * Create a standardized error response\n * @deprecated Move to @objectstack/core. Will be removed from spec in v2.0.0\n */\nexport function createErrorResponse(\n code: StandardErrorCode,\n message: string,\n options?: Partial<EnhancedApiError>\n): ErrorResponse {\n const category = getCategoryForCode(code);\n \n return {\n success: false,\n error: {\n code,\n message,\n category,\n httpStatus: getHttpStatusForCategory(category),\n timestamp: new Date().toISOString(),\n retryable: false,\n ...options,\n },\n };\n}\n\n/**\n * Infer error category from error code\n */\nfunction getCategoryForCode(code: StandardErrorCode): ErrorCategory {\n if (code.includes('validation') || code.includes('invalid') || code.includes('missing') || code.includes('duplicate')) {\n return 'validation';\n }\n if (code.includes('unauthenticated') || code.includes('token') || code.includes('credentials') || code.includes('session')) {\n return 'authentication';\n }\n if (code.includes('permission') || code.includes('privileges') || code.includes('accessible') || code.includes('restricted')) {\n return 'authorization';\n }\n if (code.includes('not_found')) {\n return 'not_found';\n }\n if (code.includes('conflict') || code.includes('concurrent') || code.includes('lock')) {\n return 'conflict';\n }\n if (code.includes('rate_limit') || code.includes('quota')) {\n return 'rate_limit';\n }\n if (code.includes('external') || code.includes('integration') || code.includes('webhook')) {\n return 'external';\n }\n if (code.includes('maintenance')) {\n return 'maintenance';\n }\n return 'server';\n}\n","// Copyright (c) 2025 ObjectStack. Licensed under the Apache-2.0 license.\n\nimport { z } from 'zod';\nimport { ViewSchema } from '../ui/view.zod';\nimport { ApiCapabilitiesSchema, ApiRoutesSchema, ServiceInfoSchema } from './discovery.zod';\nimport { BatchUpdateRequestSchema, BatchUpdateResponseSchema, BatchOptionsSchema } from './batch.zod';\nimport { MetadataCacheRequestSchema, MetadataCacheResponseSchema } from './http-cache.zod';\nimport { QuerySchema } from '../data/query.zod';\nimport { \n AnalyticsQueryRequestSchema, \n AnalyticsResultResponseSchema, \n GetAnalyticsMetaRequestSchema, \n AnalyticsMetadataResponseSchema \n} from './analytics.zod';\nimport { RealtimePresenceSchema, TransportProtocol } from './realtime.zod';\nimport { ObjectPermissionSchema, FieldPermissionSchema } from '../security/permission.zod';\nimport { WorkflowRuleSchema } from '../automation/workflow.zod';\nimport { TranslationDataSchema } from '../system/translation.zod';\nimport {\n ListPackagesRequestSchema,\n ListPackagesResponseSchema,\n GetPackageRequestSchema,\n GetPackageResponseSchema,\n InstallPackageRequestSchema,\n InstallPackageResponseSchema,\n UninstallPackageRequestSchema,\n UninstallPackageResponseSchema,\n EnablePackageRequestSchema,\n EnablePackageResponseSchema,\n DisablePackageRequestSchema,\n DisablePackageResponseSchema,\n} from '../kernel/package-registry.zod';\nimport type {\n ListPackagesRequest,\n ListPackagesResponse,\n GetPackageRequest,\n GetPackageResponse,\n InstallPackageRequest,\n InstallPackageResponse,\n UninstallPackageRequest,\n UninstallPackageResponse,\n EnablePackageRequest,\n EnablePackageResponse,\n DisablePackageRequest,\n DisablePackageResponse,\n InstalledPackage,\n PackageStatus,\n} from '../kernel/package-registry.zod';\n\nexport const AutomationTriggerRequestSchema = z.object({\n trigger: z.string(),\n payload: z.record(z.string(), z.unknown())\n});\n\nexport const AutomationTriggerResponseSchema = z.object({\n success: z.boolean(),\n jobId: z.string().optional(),\n result: z.unknown().optional()\n});\n\n/**\n * ObjectStack Protocol - Zod Schema Definitions\n * \n * Defines the runtime-validated contract for interacting with ObjectStack metadata and data.\n * Used by API adapters (HTTP, WebSocket, gRPC) to fetch data/metadata without knowing engine internals.\n * \n * This protocol enables:\n * - Runtime request/response validation at API gateway level\n * - Automatic API documentation generation\n * - Type-safe RPC communication between microservices\n * - Client SDK generation from schemas\n * \n * Architecture Alignment:\n * - Salesforce: REST API Request/Response schemas\n * - Kubernetes: API Resource schemas with runtime validation\n * - GraphQL: Schema-first API design\n */\n\n// ==========================================\n// Discovery & Metadata Operations\n// ==========================================\n\n/**\n * Get API Discovery Request\n * No parameters needed\n */\nexport const GetDiscoveryRequestSchema = z.object({});\n\n/**\n * Get API Discovery Response\n * Returns API version information and capabilities\n */\nexport const GetDiscoveryResponseSchema = z.object({\n version: z.string().describe('API version (e.g., \"v1\", \"2024-01\")'),\n apiName: z.string().describe('API name'),\n capabilities: ApiCapabilitiesSchema.optional().describe('Supported features/capabilities'),\n endpoints: ApiRoutesSchema.optional().describe('Available endpoint paths'),\n services: z.record(z.string(), ServiceInfoSchema).optional().describe('Per-service availability map'),\n});\n\n/**\n * Get Metadata Types Request\n */\nexport const GetMetaTypesRequestSchema = z.object({});\n\n/**\n * Get Metadata Types Response\n */\nexport const GetMetaTypesResponseSchema = z.object({\n types: z.array(z.string()).describe('Available metadata type names (e.g., \"object\", \"plugin\", \"view\")'),\n});\n\n/**\n * Get Metadata Items Request\n * Get all items of a specific metadata type\n */\nexport const GetMetaItemsRequestSchema = z.object({\n type: z.string().describe('Metadata type name (e.g., \"object\", \"plugin\")'),\n});\n\n/**\n * Get Metadata Items Response\n */\nexport const GetMetaItemsResponseSchema = z.object({\n type: z.string().describe('Metadata type name'),\n items: z.array(z.unknown()).describe('Array of metadata items'),\n});\n\n/**\n * Get Metadata Item Request\n * Get a specific metadata item by type and name\n */\nexport const GetMetaItemRequestSchema = z.object({\n type: z.string().describe('Metadata type name'),\n name: z.string().describe('Item name (snake_case identifier)'),\n});\n\n/**\n * Get Metadata Item Response\n */\nexport const GetMetaItemResponseSchema = z.object({\n type: z.string().describe('Metadata type name'),\n name: z.string().describe('Item name'),\n item: z.unknown().describe('Metadata item definition'),\n});\n\n/**\n * Save Metadata Item Request\n * Create or update a metadata item\n */\nexport const SaveMetaItemRequestSchema = z.object({\n type: z.string().describe('Metadata type name'),\n name: z.string().describe('Item name'),\n item: z.unknown().describe('Metadata item definition'),\n});\n\n/**\n * Save Metadata Item Response\n */\nexport const SaveMetaItemResponseSchema = z.object({\n success: z.boolean(),\n message: z.string().optional(),\n});\n\n/**\n * Get Metadata Item with Cache Request\n * Get a specific metadata item with HTTP cache validation support\n */\nexport const GetMetaItemCachedRequestSchema = z.object({\n type: z.string().describe('Metadata type name'),\n name: z.string().describe('Item name'),\n cacheRequest: MetadataCacheRequestSchema.optional().describe('Cache validation parameters'),\n});\n\n/**\n * Get Metadata Item with Cache Response\n * Uses MetadataCacheResponse from http-cache.zod.ts\n */\nexport const GetMetaItemCachedResponseSchema = MetadataCacheResponseSchema;\n\n/**\n * Get UI View Request\n * Resolves the appropriate UI view for an object based on context.\n * Unlike getMetaItem, this does not require a specific View ID.\n */\nexport const GetUiViewRequestSchema = z.object({\n object: z.string().describe('Object name (snake_case)'),\n type: z.enum(['list', 'form']).describe('View type'),\n});\n\n/**\n * Get UI View Response\n */\nexport const GetUiViewResponseSchema = ViewSchema;\n\n// ==========================================\n// Data Operations\n// ==========================================\n\n/**\n * Find Data Request\n * Defines a query to retrieve records from a specific object.\n * Supports filtering, sorting, pagination, and field selection.\n * \n * @example\n * {\n * \"object\": \"customers\",\n * \"query\": {\n * \"filters\": [[\"status\", \"=\", \"active\"], [\"revenue\", \">\", 10000]],\n * \"sort\": \"name desc\",\n * \"top\": 10\n * }\n * }\n */\nexport const FindDataRequestSchema = z.object({\n object: z.string().describe('The unique machine name of the object to query (e.g. \"account\").'),\n query: QuerySchema.optional().describe('Structured query definition (filter, sort, select, pagination).'),\n});\n\n/**\n * Find Data Response\n * Returns a list of records matching the query criteria.\n */\nexport const FindDataResponseSchema = z.object({\n object: z.string().describe('The object name for the returned records.'),\n records: z.array(z.record(z.string(), z.unknown())).describe('The list of matching records.'),\n total: z.number().optional().describe('Total number of records matching the filter (if requested).'),\n hasMore: z.boolean().optional().describe('True if there are more records available (pagination).'),\n});\n\n/**\n * Get Data Request\n * Retrieval of a single record by its unique identifier.\n * \n * @example\n * {\n * \"object\": \"contracts\",\n * \"id\": \"cnt_123456\"\n * }\n */\nexport const GetDataRequestSchema = z.object({\n object: z.string().describe('The object name.'),\n id: z.string().describe('The unique record identifier (primary key).'),\n});\n\n/**\n * Get Data Response\n */\nexport const GetDataResponseSchema = z.object({\n object: z.string().describe('The object name.'),\n id: z.string().describe('The record ID.'),\n record: z.record(z.string(), z.unknown()).describe('The complete record data.'),\n});\n\n/**\n * Create Data Request\n * Creation of a new record.\n * \n * @example\n * {\n * \"object\": \"leads\",\n * \"data\": {\n * \"first_name\": \"John\",\n * \"last_name\": \"Doe\",\n * \"company\": \"Acme Inc\"\n * }\n * }\n */\nexport const CreateDataRequestSchema = z.object({\n object: z.string().describe('The object name.'),\n data: z.record(z.string(), z.unknown()).describe('The dictionary of field values to insert.'),\n});\n\n/**\n * Create Data Response\n */\nexport const CreateDataResponseSchema = z.object({\n object: z.string().describe('The object name.'),\n id: z.string().describe('The ID of the newly created record.'),\n record: z.record(z.string(), z.unknown()).describe('The created record, including server-generated fields (created_at, owner).'),\n});\n\n/**\n * Update Data Request\n * Modification of an existing record.\n * \n * @example\n * {\n * \"object\": \"tasks\",\n * \"id\": \"tsk_001\",\n * \"data\": {\n * \"status\": \"completed\",\n * \"percent_complete\": 100\n * }\n * }\n */\nexport const UpdateDataRequestSchema = z.object({\n object: z.string().describe('The object name.'),\n id: z.string().describe('The ID of the record to update.'),\n data: z.record(z.string(), z.unknown()).describe('The fields to update (partial update).'),\n});\n\n/**\n * Update Data Response\n */\nexport const UpdateDataResponseSchema = z.object({\n object: z.string().describe('Object name'),\n id: z.string().describe('Updated record ID'),\n record: z.record(z.string(), z.unknown()).describe('Updated record'),\n});\n\n/**\n * Delete Data Request\n */\nexport const DeleteDataRequestSchema = z.object({\n object: z.string().describe('Object name'),\n id: z.string().describe('Record ID to delete'),\n});\n\n/**\n * Delete Data Response\n */\nexport const DeleteDataResponseSchema = z.object({\n object: z.string().describe('Object name'),\n id: z.string().describe('Deleted record ID'),\n success: z.boolean().describe('Whether deletion succeeded'),\n});\n\n// ==========================================\n// Batch Operations\n// ==========================================\n\n/**\n * Batch Data Request\n */\nexport const BatchDataRequestSchema = z.object({\n object: z.string().describe('Object name'),\n request: BatchUpdateRequestSchema.describe('Batch operation request'),\n});\n\n/**\n * Batch Data Response\n * Uses BatchUpdateResponse from batch.zod.ts\n */\nexport const BatchDataResponseSchema = BatchUpdateResponseSchema;\n\n/**\n * Create Many Data Request\n */\nexport const CreateManyDataRequestSchema = z.object({\n object: z.string().describe('Object name'),\n records: z.array(z.record(z.string(), z.unknown())).describe('Array of records to create'),\n});\n\n/**\n * Create Many Data Response\n */\nexport const CreateManyDataResponseSchema = z.object({\n object: z.string().describe('Object name'),\n records: z.array(z.record(z.string(), z.unknown())).describe('Created records'),\n count: z.number().describe('Number of records created'),\n});\n\n/**\n * Update Many Data Request\n */\nexport const UpdateManyDataRequestSchema = z.object({\n object: z.string().describe('Object name'),\n records: z.array(z.object({\n id: z.string().describe('Record ID'),\n data: z.record(z.string(), z.unknown()).describe('Fields to update'),\n })).describe('Array of updates'),\n options: BatchOptionsSchema.optional().describe('Update options'),\n});\n\n/**\n * Update Many Data Response\n * Uses BatchUpdateResponse for consistency\n */\nexport const UpdateManyDataResponseSchema = BatchUpdateResponseSchema;\n\n/**\n * Delete Many Data Request\n */\nexport const DeleteManyDataRequestSchema = z.object({\n object: z.string().describe('Object name'),\n ids: z.array(z.string()).describe('Array of record IDs to delete'),\n options: BatchOptionsSchema.optional().describe('Delete options'),\n});\n\n/**\n * Delete Many Data Response\n */\nexport const DeleteManyDataResponseSchema = BatchUpdateResponseSchema;\n\n// ==========================================\n// Package Management Operations\n// ==========================================\n\n/**\n * Re-export Package Management Request/Response schemas from kernel.\n * These define the contract for package lifecycle management:\n * - List installed packages (with filters)\n * - Get a specific package by ID\n * - Install a new package (from manifest)\n * - Uninstall a package\n * - Enable/Disable a package\n * \n * Key distinction: Package (ManifestSchema) is the unit of installation.\n * An App (AppSchema) is a UI navigation entity within a package.\n * A package may contain 0, 1, or many apps.\n */\nexport {\n ListPackagesRequestSchema,\n ListPackagesResponseSchema,\n GetPackageRequestSchema,\n GetPackageResponseSchema,\n InstallPackageRequestSchema,\n InstallPackageResponseSchema,\n UninstallPackageRequestSchema,\n UninstallPackageResponseSchema,\n EnablePackageRequestSchema,\n EnablePackageResponseSchema,\n DisablePackageRequestSchema,\n DisablePackageResponseSchema,\n};\n\n// ==========================================\n// View Management Operations\n// ==========================================\n\nexport const ListViewsRequestSchema = z.object({\n object: z.string().describe('Object name (snake_case)'),\n type: z.enum(['list', 'form']).optional().describe('Filter by view type'),\n});\n\nexport const ListViewsResponseSchema = z.object({\n object: z.string().describe('Object name'),\n views: z.array(ViewSchema).describe('Array of view definitions'),\n});\n\nexport const GetViewRequestSchema = z.object({\n object: z.string().describe('Object name (snake_case)'),\n viewId: z.string().describe('View identifier'),\n});\n\nexport const GetViewResponseSchema = z.object({\n object: z.string().describe('Object name'),\n view: ViewSchema.describe('View definition'),\n});\n\nexport const CreateViewRequestSchema = z.object({\n object: z.string().describe('Object name (snake_case)'),\n data: ViewSchema.describe('View definition to create'),\n});\n\nexport const CreateViewResponseSchema = z.object({\n object: z.string().describe('Object name'),\n viewId: z.string().describe('Created view identifier'),\n view: ViewSchema.describe('Created view definition'),\n});\n\nexport const UpdateViewRequestSchema = z.object({\n object: z.string().describe('Object name (snake_case)'),\n viewId: z.string().describe('View identifier'),\n data: ViewSchema.partial().describe('Partial view data to update'),\n});\n\nexport const UpdateViewResponseSchema = z.object({\n object: z.string().describe('Object name'),\n viewId: z.string().describe('Updated view identifier'),\n view: ViewSchema.describe('Updated view definition'),\n});\n\nexport const DeleteViewRequestSchema = z.object({\n object: z.string().describe('Object name (snake_case)'),\n viewId: z.string().describe('View identifier to delete'),\n});\n\nexport const DeleteViewResponseSchema = z.object({\n object: z.string().describe('Object name'),\n viewId: z.string().describe('Deleted view identifier'),\n success: z.boolean().describe('Whether deletion succeeded'),\n});\n\n// ==========================================\n// Permission Operations\n// ==========================================\n\nexport const CheckPermissionRequestSchema = z.object({\n object: z.string().describe('Object name to check permissions for'),\n action: z.enum(['create', 'read', 'edit', 'delete', 'transfer', 'restore', 'purge']).describe('Action to check'),\n recordId: z.string().optional().describe('Specific record ID (for record-level checks)'),\n field: z.string().optional().describe('Specific field name (for field-level checks)'),\n});\n\nexport const CheckPermissionResponseSchema = z.object({\n allowed: z.boolean().describe('Whether the action is permitted'),\n reason: z.string().optional().describe('Reason if denied'),\n});\n\nexport const GetObjectPermissionsRequestSchema = z.object({\n object: z.string().describe('Object name to get permissions for'),\n});\n\nexport const GetObjectPermissionsResponseSchema = z.object({\n object: z.string().describe('Object name'),\n permissions: ObjectPermissionSchema.describe('Object-level permissions'),\n fieldPermissions: z.record(z.string(), FieldPermissionSchema).optional().describe('Field-level permissions keyed by field name'),\n});\n\nexport const GetEffectivePermissionsRequestSchema = z.object({});\n\nexport const GetEffectivePermissionsResponseSchema = z.object({\n objects: z.record(z.string(), ObjectPermissionSchema).describe('Effective object permissions keyed by object name'),\n systemPermissions: z.array(z.string()).describe('Effective system-level permissions'),\n});\n\n// ==========================================\n// Workflow Operations\n// ==========================================\n\nexport const GetWorkflowConfigRequestSchema = z.object({\n object: z.string().describe('Object name to get workflow config for'),\n});\n\nexport const GetWorkflowConfigResponseSchema = z.object({\n object: z.string().describe('Object name'),\n workflows: z.array(WorkflowRuleSchema).describe('Active workflow rules for this object'),\n});\n\nexport const WorkflowStateSchema = z.object({\n currentState: z.string().describe('Current workflow state name'),\n availableTransitions: z.array(z.object({\n name: z.string().describe('Transition name'),\n targetState: z.string().describe('Target state after transition'),\n label: z.string().optional().describe('Display label'),\n requiresApproval: z.boolean().default(false).describe('Whether transition requires approval'),\n })).describe('Available transitions from current state'),\n history: z.array(z.object({\n fromState: z.string().describe('Previous state'),\n toState: z.string().describe('New state'),\n action: z.string().describe('Action that triggered the transition'),\n userId: z.string().describe('User who performed the action'),\n timestamp: z.string().datetime().describe('When the transition occurred'),\n comment: z.string().optional().describe('Optional comment'),\n })).optional().describe('State transition history'),\n});\n\nexport const GetWorkflowStateRequestSchema = z.object({\n object: z.string().describe('Object name'),\n recordId: z.string().describe('Record ID to get workflow state for'),\n});\n\nexport const GetWorkflowStateResponseSchema = z.object({\n object: z.string().describe('Object name'),\n recordId: z.string().describe('Record ID'),\n state: WorkflowStateSchema.describe('Current workflow state and available transitions'),\n});\n\nexport const WorkflowTransitionRequestSchema = z.object({\n object: z.string().describe('Object name'),\n recordId: z.string().describe('Record ID'),\n transition: z.string().describe('Transition name to execute'),\n comment: z.string().optional().describe('Optional comment for the transition'),\n data: z.record(z.string(), z.unknown()).optional().describe('Additional data for the transition'),\n});\n\nexport const WorkflowTransitionResponseSchema = z.object({\n object: z.string().describe('Object name'),\n recordId: z.string().describe('Record ID'),\n success: z.boolean().describe('Whether the transition succeeded'),\n state: WorkflowStateSchema.describe('New workflow state after transition'),\n});\n\nexport const WorkflowApproveRequestSchema = z.object({\n object: z.string().describe('Object name'),\n recordId: z.string().describe('Record ID'),\n comment: z.string().optional().describe('Approval comment'),\n data: z.record(z.string(), z.unknown()).optional().describe('Additional data'),\n});\n\nexport const WorkflowApproveResponseSchema = z.object({\n object: z.string().describe('Object name'),\n recordId: z.string().describe('Record ID'),\n success: z.boolean().describe('Whether the approval succeeded'),\n state: WorkflowStateSchema.describe('New workflow state after approval'),\n});\n\nexport const WorkflowRejectRequestSchema = z.object({\n object: z.string().describe('Object name'),\n recordId: z.string().describe('Record ID'),\n reason: z.string().describe('Rejection reason'),\n comment: z.string().optional().describe('Additional comment'),\n});\n\nexport const WorkflowRejectResponseSchema = z.object({\n object: z.string().describe('Object name'),\n recordId: z.string().describe('Record ID'),\n success: z.boolean().describe('Whether the rejection succeeded'),\n state: WorkflowStateSchema.describe('New workflow state after rejection'),\n});\n\n// ==========================================\n// Realtime Operations\n// ==========================================\n\nexport const RealtimeConnectRequestSchema = z.object({\n transport: TransportProtocol.optional().describe('Preferred transport protocol'),\n channels: z.array(z.string()).optional().describe('Channels to subscribe to on connect'),\n token: z.string().optional().describe('Authentication token'),\n});\n\nexport const RealtimeConnectResponseSchema = z.object({\n connectionId: z.string().describe('Unique connection identifier'),\n transport: TransportProtocol.describe('Negotiated transport protocol'),\n url: z.string().optional().describe('WebSocket/SSE endpoint URL'),\n});\n\nexport const RealtimeDisconnectRequestSchema = z.object({\n connectionId: z.string().optional().describe('Connection ID to disconnect'),\n});\n\nexport const RealtimeDisconnectResponseSchema = z.object({\n success: z.boolean().describe('Whether disconnection succeeded'),\n});\n\nexport const RealtimeSubscribeRequestSchema = z.object({\n channel: z.string().describe('Channel name to subscribe to'),\n events: z.array(z.string()).optional().describe('Specific event types to listen for'),\n filter: z.record(z.string(), z.unknown()).optional().describe('Event filter criteria'),\n});\n\nexport const RealtimeSubscribeResponseSchema = z.object({\n subscriptionId: z.string().describe('Unique subscription identifier'),\n channel: z.string().describe('Subscribed channel name'),\n});\n\nexport const RealtimeUnsubscribeRequestSchema = z.object({\n subscriptionId: z.string().describe('Subscription ID to cancel'),\n});\n\nexport const RealtimeUnsubscribeResponseSchema = z.object({\n success: z.boolean().describe('Whether unsubscription succeeded'),\n});\n\nexport const SetPresenceRequestSchema = z.object({\n channel: z.string().describe('Channel to set presence in'),\n state: RealtimePresenceSchema.describe('Presence state to set'),\n});\n\nexport const SetPresenceResponseSchema = z.object({\n success: z.boolean().describe('Whether presence was set'),\n});\n\nexport const GetPresenceRequestSchema = z.object({\n channel: z.string().describe('Channel to get presence for'),\n});\n\nexport const GetPresenceResponseSchema = z.object({\n channel: z.string().describe('Channel name'),\n members: z.array(RealtimePresenceSchema).describe('Active members and their presence state'),\n});\n\n// ==========================================\n// Notification Operations\n// ==========================================\n\nexport const RegisterDeviceRequestSchema = z.object({\n token: z.string().describe('Device push notification token'),\n platform: z.enum(['ios', 'android', 'web']).describe('Device platform'),\n deviceId: z.string().optional().describe('Unique device identifier'),\n name: z.string().optional().describe('Device friendly name'),\n});\n\nexport const RegisterDeviceResponseSchema = z.object({\n deviceId: z.string().describe('Registered device ID'),\n success: z.boolean().describe('Whether registration succeeded'),\n});\n\nexport const UnregisterDeviceRequestSchema = z.object({\n deviceId: z.string().describe('Device ID to unregister'),\n});\n\nexport const UnregisterDeviceResponseSchema = z.object({\n success: z.boolean().describe('Whether unregistration succeeded'),\n});\n\nexport const NotificationPreferencesSchema = z.object({\n email: z.boolean().default(true).describe('Receive email notifications'),\n push: z.boolean().default(true).describe('Receive push notifications'),\n inApp: z.boolean().default(true).describe('Receive in-app notifications'),\n digest: z.enum(['none', 'daily', 'weekly']).default('none').describe('Email digest frequency'),\n channels: z.record(z.string(), z.object({\n enabled: z.boolean().default(true).describe('Whether this channel is enabled'),\n email: z.boolean().optional().describe('Override email setting'),\n push: z.boolean().optional().describe('Override push setting'),\n })).optional().describe('Per-channel notification preferences'),\n});\n\nexport const GetNotificationPreferencesRequestSchema = z.object({});\n\nexport const GetNotificationPreferencesResponseSchema = z.object({\n preferences: NotificationPreferencesSchema.describe('Current notification preferences'),\n});\n\nexport const UpdateNotificationPreferencesRequestSchema = z.object({\n preferences: NotificationPreferencesSchema.partial().describe('Preferences to update'),\n});\n\nexport const UpdateNotificationPreferencesResponseSchema = z.object({\n preferences: NotificationPreferencesSchema.describe('Updated notification preferences'),\n});\n\nexport const NotificationSchema = z.object({\n id: z.string().describe('Notification ID'),\n type: z.string().describe('Notification type'),\n title: z.string().describe('Notification title'),\n body: z.string().describe('Notification body text'),\n read: z.boolean().default(false).describe('Whether notification has been read'),\n data: z.record(z.string(), z.unknown()).optional().describe('Additional notification data'),\n actionUrl: z.string().optional().describe('URL to navigate to when clicked'),\n createdAt: z.string().datetime().describe('When notification was created'),\n});\n\nexport const ListNotificationsRequestSchema = z.object({\n read: z.boolean().optional().describe('Filter by read status'),\n type: z.string().optional().describe('Filter by notification type'),\n limit: z.number().default(20).describe('Maximum number of notifications to return'),\n cursor: z.string().optional().describe('Pagination cursor'),\n});\n\nexport const ListNotificationsResponseSchema = z.object({\n notifications: z.array(NotificationSchema).describe('List of notifications'),\n unreadCount: z.number().describe('Total number of unread notifications'),\n cursor: z.string().optional().describe('Next page cursor'),\n});\n\nexport const MarkNotificationsReadRequestSchema = z.object({\n ids: z.array(z.string()).describe('Notification IDs to mark as read'),\n});\n\nexport const MarkNotificationsReadResponseSchema = z.object({\n success: z.boolean().describe('Whether the operation succeeded'),\n readCount: z.number().describe('Number of notifications marked as read'),\n});\n\nexport const MarkAllNotificationsReadRequestSchema = z.object({});\n\nexport const MarkAllNotificationsReadResponseSchema = z.object({\n success: z.boolean().describe('Whether the operation succeeded'),\n readCount: z.number().describe('Number of notifications marked as read'),\n});\n\n// ==========================================\n// AI Operations\n// ==========================================\n\nexport const AiNlqRequestSchema = z.object({\n query: z.string().describe('Natural language query string'),\n object: z.string().optional().describe('Target object context'),\n conversationId: z.string().optional().describe('Conversation ID for multi-turn queries'),\n});\n\nexport const AiNlqResponseSchema = z.object({\n query: z.unknown().describe('Generated structured query (AST)'),\n explanation: z.string().optional().describe('Human-readable explanation of the query'),\n confidence: z.number().min(0).max(1).optional().describe('Confidence score (0-1)'),\n suggestions: z.array(z.string()).optional().describe('Suggested follow-up queries'),\n});\n\nexport const AiChatRequestSchema = z.object({\n message: z.string().describe('User message'),\n conversationId: z.string().optional().describe('Conversation ID for context'),\n context: z.record(z.string(), z.unknown()).optional().describe('Additional context data'),\n});\n\nexport const AiChatResponseSchema = z.object({\n message: z.string().describe('Assistant response message'),\n conversationId: z.string().describe('Conversation ID'),\n actions: z.array(z.object({\n type: z.string().describe('Action type'),\n label: z.string().describe('Action display label'),\n data: z.record(z.string(), z.unknown()).optional().describe('Action data'),\n })).optional().describe('Suggested actions'),\n});\n\nexport const AiSuggestRequestSchema = z.object({\n object: z.string().describe('Object name for context'),\n field: z.string().optional().describe('Field to suggest values for'),\n recordId: z.string().optional().describe('Record ID for context'),\n partial: z.string().optional().describe('Partial input for completion'),\n});\n\nexport const AiSuggestResponseSchema = z.object({\n suggestions: z.array(z.object({\n value: z.unknown().describe('Suggested value'),\n label: z.string().describe('Display label'),\n confidence: z.number().min(0).max(1).optional().describe('Confidence score (0-1)'),\n reason: z.string().optional().describe('Reason for this suggestion'),\n })).describe('Suggested values'),\n});\n\nexport const AiInsightsRequestSchema = z.object({\n object: z.string().describe('Object name to analyze'),\n recordId: z.string().optional().describe('Specific record to analyze'),\n type: z.enum(['summary', 'trends', 'anomalies', 'recommendations']).optional().describe('Type of insight'),\n});\n\nexport const AiInsightsResponseSchema = z.object({\n insights: z.array(z.object({\n type: z.string().describe('Insight type'),\n title: z.string().describe('Insight title'),\n description: z.string().describe('Detailed description'),\n confidence: z.number().min(0).max(1).optional().describe('Confidence score (0-1)'),\n data: z.record(z.string(), z.unknown()).optional().describe('Supporting data'),\n })).describe('Generated insights'),\n});\n\n// ==========================================\n// i18n Operations\n// ==========================================\n\nexport const GetLocalesRequestSchema = z.object({});\n\nexport const GetLocalesResponseSchema = z.object({\n locales: z.array(z.object({\n code: z.string().describe('BCP-47 locale code (e.g., en-US, zh-CN)'),\n label: z.string().describe('Display name of the locale'),\n isDefault: z.boolean().default(false).describe('Whether this is the default locale'),\n })).describe('Available locales'),\n});\n\nexport const GetTranslationsRequestSchema = z.object({\n locale: z.string().describe('BCP-47 locale code'),\n namespace: z.string().optional().describe('Translation namespace (e.g., objects, apps, messages)'),\n keys: z.array(z.string()).optional().describe('Specific translation keys to fetch'),\n});\n\nexport const GetTranslationsResponseSchema = z.object({\n locale: z.string().describe('Locale code'),\n translations: TranslationDataSchema.describe('Translation data'),\n});\n\nexport const GetFieldLabelsRequestSchema = z.object({\n object: z.string().describe('Object name'),\n locale: z.string().describe('BCP-47 locale code'),\n});\n\nexport const GetFieldLabelsResponseSchema = z.object({\n object: z.string().describe('Object name'),\n locale: z.string().describe('Locale code'),\n labels: z.record(z.string(), z.object({\n label: z.string().describe('Translated field label'),\n help: z.string().optional().describe('Translated help text'),\n options: z.record(z.string(), z.string()).optional().describe('Translated option labels'),\n })).describe('Field labels keyed by field name'),\n});\n\n// ==========================================\n// Protocol Interface Schema\n// ==========================================\n\n/**\n * ObjectStack Protocol Contract\n * \n * This schema defines the complete API contract as a Zod schema.\n * Unlike the old TypeScript interface, this provides runtime validation\n * and can be used for:\n * - API Gateway validation\n * - RPC call validation\n * - Client SDK generation\n * - API documentation generation\n * \n * Each method is defined with its request and response schemas.\n */\nexport const ObjectStackProtocolSchema = z.object({\n // Discovery & Metadata\n getDiscovery: z.function()\n .describe('Get API discovery information'),\n\n getMetaTypes: z.function()\n .describe('Get available metadata types'),\n\n getMetaItems: z.function()\n .describe('Get all items of a metadata type'),\n\n getMetaItem: z.function()\n .describe('Get a specific metadata item'),\n saveMetaItem: z.function()\n .describe('Save metadata item'),\n getMetaItemCached: z.function()\n .describe('Get a metadata item with cache validation'),\n\n getUiView: z.function()\n .describe('Get UI view definition'),\n\n // Analytics Operations\n analyticsQuery: z.function()\n .describe('Execute analytics query'),\n\n getAnalyticsMeta: z.function()\n .describe('Get analytics metadata (cubes)'),\n\n // Automation Operations\n triggerAutomation: z.function()\n .describe('Trigger an automation flow or script'),\n\n // Package Management Operations\n listPackages: z.function()\n .describe('List installed packages with optional filters'),\n\n getPackage: z.function()\n .describe('Get a specific installed package by ID'),\n\n installPackage: z.function()\n .describe('Install a new package from manifest'),\n\n uninstallPackage: z.function()\n .describe('Uninstall a package by ID'),\n\n enablePackage: z.function()\n .describe('Enable a disabled package'),\n\n disablePackage: z.function()\n .describe('Disable an installed package'),\n\n // Data Operations\n findData: z.function()\n .describe('Find data records'),\n\n getData: z.function()\n .describe('Get single data record'),\n\n createData: z.function()\n .describe('Create a data record'),\n\n updateData: z.function()\n .describe('Update a data record'),\n\n deleteData: z.function()\n .describe('Delete a data record'),\n\n // Batch Operations\n batchData: z.function()\n .describe('Perform batch operations'),\n\n createManyData: z.function()\n .describe('Create multiple records'),\n\n updateManyData: z.function()\n .describe('Update multiple records'),\n\n deleteManyData: z.function()\n .describe('Delete multiple records'),\n\n // View Management Operations\n listViews: z.function()\n .describe('List views for an object'),\n getView: z.function()\n .describe('Get a specific view'),\n createView: z.function()\n .describe('Create a new view'),\n updateView: z.function()\n .describe('Update an existing view'),\n deleteView: z.function()\n .describe('Delete a view'),\n\n // Permission Operations\n checkPermission: z.function()\n .describe('Check if an action is permitted'),\n getObjectPermissions: z.function()\n .describe('Get permissions for an object'),\n getEffectivePermissions: z.function()\n .describe('Get effective permissions for current user'),\n\n // Workflow Operations\n getWorkflowConfig: z.function()\n .describe('Get workflow configuration for an object'),\n getWorkflowState: z.function()\n .describe('Get workflow state for a record'),\n workflowTransition: z.function()\n .describe('Execute a workflow state transition'),\n workflowApprove: z.function()\n .describe('Approve a workflow step'),\n workflowReject: z.function()\n .describe('Reject a workflow step'),\n\n // Realtime Operations\n realtimeConnect: z.function()\n .describe('Establish realtime connection'),\n realtimeDisconnect: z.function()\n .describe('Close realtime connection'),\n realtimeSubscribe: z.function()\n .describe('Subscribe to a realtime channel'),\n realtimeUnsubscribe: z.function()\n .describe('Unsubscribe from a realtime channel'),\n setPresence: z.function()\n .describe('Set user presence state'),\n getPresence: z.function()\n .describe('Get channel presence information'),\n\n // Notification Operations\n registerDevice: z.function()\n .describe('Register a device for push notifications'),\n unregisterDevice: z.function()\n .describe('Unregister a device'),\n getNotificationPreferences: z.function()\n .describe('Get notification preferences'),\n updateNotificationPreferences: z.function()\n .describe('Update notification preferences'),\n listNotifications: z.function()\n .describe('List notifications'),\n markNotificationsRead: z.function()\n .describe('Mark specific notifications as read'),\n markAllNotificationsRead: z.function()\n .describe('Mark all notifications as read'),\n\n // AI Operations\n aiNlq: z.function()\n .describe('Natural language query'),\n aiChat: z.function()\n .describe('AI chat interaction'),\n aiSuggest: z.function()\n .describe('Get AI-powered suggestions'),\n aiInsights: z.function()\n .describe('Get AI-generated insights'),\n\n // i18n Operations\n getLocales: z.function()\n .describe('Get available locales'),\n getTranslations: z.function()\n .describe('Get translations for a locale'),\n getFieldLabels: z.function()\n .describe('Get translated field labels for an object'),\n});\n\n/**\n * TypeScript Types\n * Derived from Zod schemas using z.infer\n */\nexport type GetDiscoveryRequest = z.infer<typeof GetDiscoveryRequestSchema>;\nexport type GetDiscoveryResponse = z.infer<typeof GetDiscoveryResponseSchema>;\nexport type GetMetaTypesRequest = z.infer<typeof GetMetaTypesRequestSchema>;\nexport type GetMetaTypesResponse = z.infer<typeof GetMetaTypesResponseSchema>;\nexport type GetMetaItemsRequest = z.infer<typeof GetMetaItemsRequestSchema>;\nexport type GetMetaItemsResponse = z.infer<typeof GetMetaItemsResponseSchema>;\nexport type GetMetaItemRequest = z.infer<typeof GetMetaItemRequestSchema>;\nexport type GetMetaItemResponse = z.infer<typeof GetMetaItemResponseSchema>;\nexport type SaveMetaItemRequest = z.infer<typeof SaveMetaItemRequestSchema>;\nexport type SaveMetaItemResponse = z.infer<typeof SaveMetaItemResponseSchema>;\nexport type GetMetaItemCachedRequest = z.infer<typeof GetMetaItemCachedRequestSchema>;\nexport type GetMetaItemCachedResponse = z.infer<typeof GetMetaItemCachedResponseSchema>;\nexport type GetUiViewRequest = z.infer<typeof GetUiViewRequestSchema>;\nexport type GetUiViewResponse = z.infer<typeof GetUiViewResponseSchema>;\n\nexport type AnalyticsQueryRequest = z.infer<typeof AnalyticsQueryRequestSchema>;\nexport type AnalyticsResultResponse = z.infer<typeof AnalyticsResultResponseSchema>;\nexport type GetAnalyticsMetaRequest = z.infer<typeof GetAnalyticsMetaRequestSchema>;\nexport type GetAnalyticsMetaResponse = z.infer<typeof AnalyticsMetadataResponseSchema>;\n\nexport type AutomationTriggerRequest = z.infer<typeof AutomationTriggerRequestSchema>;\nexport type AutomationTriggerResponse = z.infer<typeof AutomationTriggerResponseSchema>;\n\nexport type FindDataRequest = z.input<typeof FindDataRequestSchema>;\nexport type FindDataResponse = z.infer<typeof FindDataResponseSchema>;\nexport type GetDataRequest = z.input<typeof GetDataRequestSchema>;\nexport type GetDataResponse = z.infer<typeof GetDataResponseSchema>;\nexport type CreateDataRequest = z.input<typeof CreateDataRequestSchema>;\nexport type CreateDataResponse = z.infer<typeof CreateDataResponseSchema>;\nexport type UpdateDataRequest = z.input<typeof UpdateDataRequestSchema>;\nexport type UpdateDataResponse = z.infer<typeof UpdateDataResponseSchema>;\nexport type DeleteDataRequest = z.input<typeof DeleteDataRequestSchema>;\nexport type DeleteDataResponse = z.infer<typeof DeleteDataResponseSchema>;\n\nexport type BatchDataRequest = z.input<typeof BatchDataRequestSchema>;\nexport type BatchDataResponse = z.infer<typeof BatchDataResponseSchema>;\nexport type CreateManyDataRequest = z.input<typeof CreateManyDataRequestSchema>;\nexport type CreateManyDataResponse = z.infer<typeof CreateManyDataResponseSchema>;\nexport type UpdateManyDataRequest = z.input<typeof UpdateManyDataRequestSchema>;\nexport type UpdateManyDataResponse = z.infer<typeof UpdateManyDataResponseSchema>;\nexport type DeleteManyDataRequest = z.input<typeof DeleteManyDataRequestSchema>;\nexport type DeleteManyDataResponse = z.infer<typeof DeleteManyDataResponseSchema>;\n\n// View Management Types\nexport type ListViewsRequest = z.input<typeof ListViewsRequestSchema>;\nexport type ListViewsResponse = z.infer<typeof ListViewsResponseSchema>;\nexport type GetViewRequest = z.input<typeof GetViewRequestSchema>;\nexport type GetViewResponse = z.infer<typeof GetViewResponseSchema>;\nexport type CreateViewRequest = z.input<typeof CreateViewRequestSchema>;\nexport type CreateViewResponse = z.infer<typeof CreateViewResponseSchema>;\nexport type UpdateViewRequest = z.input<typeof UpdateViewRequestSchema>;\nexport type UpdateViewResponse = z.infer<typeof UpdateViewResponseSchema>;\nexport type DeleteViewRequest = z.input<typeof DeleteViewRequestSchema>;\nexport type DeleteViewResponse = z.infer<typeof DeleteViewResponseSchema>;\n\n// Permission Types\nexport type CheckPermissionRequest = z.input<typeof CheckPermissionRequestSchema>;\nexport type CheckPermissionResponse = z.infer<typeof CheckPermissionResponseSchema>;\nexport type GetObjectPermissionsRequest = z.input<typeof GetObjectPermissionsRequestSchema>;\nexport type GetObjectPermissionsResponse = z.infer<typeof GetObjectPermissionsResponseSchema>;\nexport type GetEffectivePermissionsRequest = z.input<typeof GetEffectivePermissionsRequestSchema>;\nexport type GetEffectivePermissionsResponse = z.infer<typeof GetEffectivePermissionsResponseSchema>;\n\n// Workflow Types\nexport type GetWorkflowConfigRequest = z.input<typeof GetWorkflowConfigRequestSchema>;\nexport type GetWorkflowConfigResponse = z.infer<typeof GetWorkflowConfigResponseSchema>;\nexport type WorkflowState = z.infer<typeof WorkflowStateSchema>;\nexport type GetWorkflowStateRequest = z.input<typeof GetWorkflowStateRequestSchema>;\nexport type GetWorkflowStateResponse = z.infer<typeof GetWorkflowStateResponseSchema>;\nexport type WorkflowTransitionRequest = z.input<typeof WorkflowTransitionRequestSchema>;\nexport type WorkflowTransitionResponse = z.infer<typeof WorkflowTransitionResponseSchema>;\nexport type WorkflowApproveRequest = z.input<typeof WorkflowApproveRequestSchema>;\nexport type WorkflowApproveResponse = z.infer<typeof WorkflowApproveResponseSchema>;\nexport type WorkflowRejectRequest = z.input<typeof WorkflowRejectRequestSchema>;\nexport type WorkflowRejectResponse = z.infer<typeof WorkflowRejectResponseSchema>;\n\n// Realtime Types\nexport type RealtimeConnectRequest = z.input<typeof RealtimeConnectRequestSchema>;\nexport type RealtimeConnectResponse = z.infer<typeof RealtimeConnectResponseSchema>;\nexport type RealtimeDisconnectRequest = z.input<typeof RealtimeDisconnectRequestSchema>;\nexport type RealtimeDisconnectResponse = z.infer<typeof RealtimeDisconnectResponseSchema>;\nexport type RealtimeSubscribeRequest = z.input<typeof RealtimeSubscribeRequestSchema>;\nexport type RealtimeSubscribeResponse = z.infer<typeof RealtimeSubscribeResponseSchema>;\nexport type RealtimeUnsubscribeRequest = z.input<typeof RealtimeUnsubscribeRequestSchema>;\nexport type RealtimeUnsubscribeResponse = z.infer<typeof RealtimeUnsubscribeResponseSchema>;\nexport type SetPresenceRequest = z.input<typeof SetPresenceRequestSchema>;\nexport type SetPresenceResponse = z.infer<typeof SetPresenceResponseSchema>;\nexport type GetPresenceRequest = z.input<typeof GetPresenceRequestSchema>;\nexport type GetPresenceResponse = z.infer<typeof GetPresenceResponseSchema>;\n\n// Notification Types\nexport type RegisterDeviceRequest = z.input<typeof RegisterDeviceRequestSchema>;\nexport type RegisterDeviceResponse = z.infer<typeof RegisterDeviceResponseSchema>;\nexport type UnregisterDeviceRequest = z.input<typeof UnregisterDeviceRequestSchema>;\nexport type UnregisterDeviceResponse = z.infer<typeof UnregisterDeviceResponseSchema>;\nexport type NotificationPreferences = z.infer<typeof NotificationPreferencesSchema>;\nexport type NotificationPreferencesInput = z.input<typeof NotificationPreferencesSchema>;\nexport type GetNotificationPreferencesRequest = z.input<typeof GetNotificationPreferencesRequestSchema>;\nexport type GetNotificationPreferencesResponse = z.infer<typeof GetNotificationPreferencesResponseSchema>;\nexport type UpdateNotificationPreferencesRequest = z.input<typeof UpdateNotificationPreferencesRequestSchema>;\nexport type UpdateNotificationPreferencesResponse = z.infer<typeof UpdateNotificationPreferencesResponseSchema>;\nexport type Notification = z.infer<typeof NotificationSchema>;\nexport type NotificationInput = z.input<typeof NotificationSchema>;\nexport type ListNotificationsRequest = z.input<typeof ListNotificationsRequestSchema>;\nexport type ListNotificationsResponse = z.infer<typeof ListNotificationsResponseSchema>;\nexport type MarkNotificationsReadRequest = z.input<typeof MarkNotificationsReadRequestSchema>;\nexport type MarkNotificationsReadResponse = z.infer<typeof MarkNotificationsReadResponseSchema>;\nexport type MarkAllNotificationsReadRequest = z.input<typeof MarkAllNotificationsReadRequestSchema>;\nexport type MarkAllNotificationsReadResponse = z.infer<typeof MarkAllNotificationsReadResponseSchema>;\n\n// AI Types\nexport type AiNlqRequest = z.input<typeof AiNlqRequestSchema>;\nexport type AiNlqResponse = z.infer<typeof AiNlqResponseSchema>;\nexport type AiChatRequest = z.input<typeof AiChatRequestSchema>;\nexport type AiChatResponse = z.infer<typeof AiChatResponseSchema>;\nexport type AiSuggestRequest = z.input<typeof AiSuggestRequestSchema>;\nexport type AiSuggestResponse = z.infer<typeof AiSuggestResponseSchema>;\nexport type AiInsightsRequest = z.input<typeof AiInsightsRequestSchema>;\nexport type AiInsightsResponse = z.infer<typeof AiInsightsResponseSchema>;\n\n// i18n Types\nexport type GetLocalesRequest = z.input<typeof GetLocalesRequestSchema>;\nexport type GetLocalesResponse = z.infer<typeof GetLocalesResponseSchema>;\nexport type GetTranslationsRequest = z.input<typeof GetTranslationsRequestSchema>;\nexport type GetTranslationsResponse = z.infer<typeof GetTranslationsResponseSchema>;\nexport type GetFieldLabelsRequest = z.input<typeof GetFieldLabelsRequestSchema>;\nexport type GetFieldLabelsResponse = z.infer<typeof GetFieldLabelsResponseSchema>;\n\n// Package Management Types (re-exported from kernel for convenience)\nexport type { \n ListPackagesRequest,\n ListPackagesResponse,\n GetPackageRequest,\n GetPackageResponse,\n InstallPackageRequest,\n InstallPackageResponse,\n UninstallPackageRequest,\n UninstallPackageResponse,\n EnablePackageRequest,\n EnablePackageResponse,\n DisablePackageRequest,\n DisablePackageResponse,\n InstalledPackage,\n PackageStatus,\n};\n\n/**\n * Zod-inferred protocol type (for runtime validation only).\n * Use ObjectStackProtocol interface for implementation contracts.\n */\nexport type ObjectStackProtocolZod = z.infer<typeof ObjectStackProtocolSchema>;\n\n/**\n * ObjectStack Protocol Interface\n * \n * Properly typed interface for implementing the ObjectStack API protocol.\n * The Zod schema (ObjectStackProtocolSchema) is used for runtime validation,\n * while this interface provides compile-time type safety for implementations.\n */\nexport interface ObjectStackProtocol {\n // Discovery & Metadata (core)\n getDiscovery(request?: GetDiscoveryRequest): Promise<GetDiscoveryResponse>;\n getMetaTypes(request?: GetMetaTypesRequest): Promise<GetMetaTypesResponse>;\n getMetaItems(request: GetMetaItemsRequest): Promise<GetMetaItemsResponse>;\n getMetaItem(request: GetMetaItemRequest): Promise<GetMetaItemResponse>;\n saveMetaItem(request: SaveMetaItemRequest): Promise<SaveMetaItemResponse>;\n getMetaItemCached?(request: GetMetaItemCachedRequest): Promise<GetMetaItemCachedResponse>;\n getUiView?(request: GetUiViewRequest): Promise<GetUiViewResponse>;\n \n // Analytics (optional)\n analyticsQuery?(request: AnalyticsQueryRequest): Promise<AnalyticsResultResponse>;\n getAnalyticsMeta?(request: GetAnalyticsMetaRequest): Promise<GetAnalyticsMetaResponse>;\n\n // Automation (optional)\n triggerAutomation?(request: AutomationTriggerRequest): Promise<AutomationTriggerResponse>;\n\n // Package Management (optional)\n listPackages?(request: ListPackagesRequest): Promise<ListPackagesResponse>;\n getPackage?(request: GetPackageRequest): Promise<GetPackageResponse>;\n installPackage?(request: InstallPackageRequest): Promise<InstallPackageResponse>;\n uninstallPackage?(request: UninstallPackageRequest): Promise<UninstallPackageResponse>;\n enablePackage?(request: EnablePackageRequest): Promise<EnablePackageResponse>;\n disablePackage?(request: DisablePackageRequest): Promise<DisablePackageResponse>;\n\n // Data Operations (core)\n findData(request: FindDataRequest): Promise<FindDataResponse>;\n getData(request: GetDataRequest): Promise<GetDataResponse>;\n createData(request: CreateDataRequest): Promise<CreateDataResponse>;\n updateData(request: UpdateDataRequest): Promise<UpdateDataResponse>;\n deleteData(request: DeleteDataRequest): Promise<DeleteDataResponse>;\n \n // Batch Operations (optional)\n batchData?(request: BatchDataRequest): Promise<BatchDataResponse>;\n createManyData?(request: CreateManyDataRequest): Promise<CreateManyDataResponse>;\n updateManyData?(request: UpdateManyDataRequest): Promise<UpdateManyDataResponse>;\n deleteManyData?(request: DeleteManyDataRequest): Promise<DeleteManyDataResponse>;\n\n // View Management (optional)\n listViews?(request: ListViewsRequest): Promise<ListViewsResponse>;\n getView?(request: GetViewRequest): Promise<GetViewResponse>;\n createView?(request: CreateViewRequest): Promise<CreateViewResponse>;\n updateView?(request: UpdateViewRequest): Promise<UpdateViewResponse>;\n deleteView?(request: DeleteViewRequest): Promise<DeleteViewResponse>;\n\n // Permissions (optional)\n checkPermission?(request: CheckPermissionRequest): Promise<CheckPermissionResponse>;\n getObjectPermissions?(request: GetObjectPermissionsRequest): Promise<GetObjectPermissionsResponse>;\n getEffectivePermissions?(request: GetEffectivePermissionsRequest): Promise<GetEffectivePermissionsResponse>;\n\n // Workflows (optional)\n getWorkflowConfig?(request: GetWorkflowConfigRequest): Promise<GetWorkflowConfigResponse>;\n getWorkflowState?(request: GetWorkflowStateRequest): Promise<GetWorkflowStateResponse>;\n workflowTransition?(request: WorkflowTransitionRequest): Promise<WorkflowTransitionResponse>;\n workflowApprove?(request: WorkflowApproveRequest): Promise<WorkflowApproveResponse>;\n workflowReject?(request: WorkflowRejectRequest): Promise<WorkflowRejectResponse>;\n\n // Realtime (optional)\n realtimeConnect?(request: RealtimeConnectRequest): Promise<RealtimeConnectResponse>;\n realtimeDisconnect?(request: RealtimeDisconnectRequest): Promise<RealtimeDisconnectResponse>;\n realtimeSubscribe?(request: RealtimeSubscribeRequest): Promise<RealtimeSubscribeResponse>;\n realtimeUnsubscribe?(request: RealtimeUnsubscribeRequest): Promise<RealtimeUnsubscribeResponse>;\n setPresence?(request: SetPresenceRequest): Promise<SetPresenceResponse>;\n getPresence?(request: GetPresenceRequest): Promise<GetPresenceResponse>;\n\n // Notifications (optional)\n registerDevice?(request: RegisterDeviceRequest): Promise<RegisterDeviceResponse>;\n unregisterDevice?(request: UnregisterDeviceRequest): Promise<UnregisterDeviceResponse>;\n getNotificationPreferences?(request: GetNotificationPreferencesRequest): Promise<GetNotificationPreferencesResponse>;\n updateNotificationPreferences?(request: UpdateNotificationPreferencesRequest): Promise<UpdateNotificationPreferencesResponse>;\n listNotifications?(request: ListNotificationsRequest): Promise<ListNotificationsResponse>;\n markNotificationsRead?(request: MarkNotificationsReadRequest): Promise<MarkNotificationsReadResponse>;\n markAllNotificationsRead?(request: MarkAllNotificationsReadRequest): Promise<MarkAllNotificationsReadResponse>;\n\n // AI (optional)\n aiNlq?(request: AiNlqRequest): Promise<AiNlqResponse>;\n aiChat?(request: AiChatRequest): Promise<AiChatResponse>;\n aiSuggest?(request: AiSuggestRequest): Promise<AiSuggestResponse>;\n aiInsights?(request: AiInsightsRequest): Promise<AiInsightsResponse>;\n\n // i18n (optional)\n getLocales?(request: GetLocalesRequest): Promise<GetLocalesResponse>;\n getTranslations?(request: GetTranslationsRequest): Promise<GetTranslationsResponse>;\n getFieldLabels?(request: GetFieldLabelsRequest): Promise<GetFieldLabelsResponse>;\n}\n","// Copyright (c) 2025 ObjectStack. Licensed under the Apache-2.0 license.\n\nimport { z } from 'zod';\nimport { SnakeCaseIdentifierSchema } from '../shared/identifiers.zod';\n\n/**\n * HTTP Method Enum\n */\nexport const HttpMethodSchema = z.enum(['GET', 'POST', 'PUT', 'PATCH', 'DELETE']);\n\n/**\n * HTTP Request Configuration for API Provider\n */\nexport const HttpRequestSchema = z.object({\n url: z.string().describe('API endpoint URL'),\n method: HttpMethodSchema.optional().default('GET').describe('HTTP method'),\n headers: z.record(z.string(), z.string()).optional().describe('Custom HTTP headers'),\n params: z.record(z.string(), z.unknown()).optional().describe('Query parameters'),\n body: z.unknown().optional().describe('Request body for POST/PUT/PATCH'),\n});\n\n/**\n * View Data Source Configuration\n * Supports three modes:\n * 1. 'object': Standard Protocol - Auto-connects to ObjectStack Metadata and Data APIs\n * 2. 'api': Custom API - Explicitly provided API URLs\n * 3. 'value': Static Data - Hardcoded data array\n */\nexport const ViewDataSchema = z.discriminatedUnion('provider', [\n z.object({\n provider: z.literal('object'),\n object: z.string().describe('Target object name'),\n }),\n z.object({\n provider: z.literal('api'),\n read: HttpRequestSchema.optional().describe('Configuration for fetching data'),\n write: HttpRequestSchema.optional().describe('Configuration for submitting data (for forms/editable tables)'),\n }),\n z.object({\n provider: z.literal('value'),\n items: z.array(z.unknown()).describe('Static data array'),\n }),\n]);\n\n/**\n * List Column Configuration Schema\n * Detailed configuration for individual list view columns\n */\nexport const ListColumnSchema = z.object({\n field: z.string().describe('Field name (snake_case)'),\n label: z.string().optional().describe('Display label override'),\n width: z.number().positive().optional().describe('Column width in pixels'),\n align: z.enum(['left', 'center', 'right']).optional().describe('Text alignment'),\n hidden: z.boolean().optional().describe('Hide column by default'),\n sortable: z.boolean().optional().describe('Allow sorting by this column'),\n resizable: z.boolean().optional().describe('Allow resizing this column'),\n wrap: z.boolean().optional().describe('Allow text wrapping'),\n type: z.string().optional().describe('Renderer type override (e.g., \"currency\", \"date\")'),\n\n /** Interaction */\n link: z.boolean().optional().describe('Functions as the primary navigation link (triggers View navigation)'),\n action: z.string().optional().describe('Registered Action ID to execute when clicked'),\n});\n\n/**\n * List View Selection Configuration\n */\nexport const SelectionConfigSchema = z.object({\n type: z.enum(['none', 'single', 'multiple']).default('none').describe('Selection mode'),\n});\n\n/**\n * List View Pagination Configuration\n */\nexport const PaginationConfigSchema = z.object({\n pageSize: z.number().int().positive().default(25).describe('Number of records per page'),\n pageSizeOptions: z.array(z.number().int().positive()).optional().describe('Available page size options'),\n});\n\n/**\n * Kanban Settings\n */\nexport const KanbanConfigSchema = z.object({\n groupByField: z.string().describe('Field to group columns by (usually status/select)'),\n summarizeField: z.string().optional().describe('Field to sum at top of column (e.g. amount)'),\n columns: z.array(z.string()).describe('Fields to show on cards'),\n});\n\n/**\n * Calendar Settings\n */\nexport const CalendarConfigSchema = z.object({\n startDateField: z.string(),\n endDateField: z.string().optional(),\n titleField: z.string(),\n colorField: z.string().optional(),\n});\n\n/**\n * Gantt Settings\n */\nexport const GanttConfigSchema = z.object({\n startDateField: z.string(),\n endDateField: z.string(),\n titleField: z.string(),\n progressField: z.string().optional(),\n dependenciesField: z.string().optional(),\n});\n\n/**\n * Navigation Mode Enum\n * Defines how to navigate to the detail view from a list item.\n */\nexport const NavigationModeSchema = z.enum([\n 'page', // Navigate to a new route (default)\n 'drawer', // Open details in a side drawer/panel\n 'modal', // Open details in a modal dialog\n 'split', // Show details side-by-side with the list (master-detail)\n 'popover', // Show details in a popover (lightweight)\n 'new_window', // Open in new browser tab/window\n 'none' // No navigation (read-only list)\n]);\n\n/**\n * Navigation Configuration Schema\n */\nexport const NavigationConfigSchema = z.object({\n mode: NavigationModeSchema.default('page'),\n \n /** Target View Config */\n view: z.string().optional().describe('Name of the form view to use for details (e.g. \"summary_view\", \"edit_form\")'),\n \n /** Interaction Triggers */\n preventNavigation: z.boolean().default(false).describe('Disable standard navigation entirely'),\n openNewTab: z.boolean().default(false).describe('Force open in new tab (applies to page mode)'),\n \n /** Dimensions (for modal/drawer) */\n width: z.union([z.string(), z.number()]).optional().describe('Width of the drawer/modal (e.g. \"600px\", \"50%\")'),\n});\n\n/**\n * List View Schema (Expanded)\n * Defines how a collection of records is displayed to the user.\n * \n * **NAMING CONVENTION:**\n * View names (when provided) are machine identifiers and must be lowercase snake_case.\n * \n * @example Standard Grid\n * {\n * name: \"all_active\",\n * label: \"All Active\",\n * type: \"grid\",\n * columns: [\"name\", \"status\", \"created_at\"],\n * filter: [[\"status\", \"=\", \"active\"]]\n * }\n * \n * @example Kanban Board\n * {\n * type: \"kanban\",\n * columns: [\"name\", \"amount\"],\n * kanban: {\n * groupByField: \"stage\",\n * summarizeField: \"amount\",\n * columns: [\"name\", \"close_date\"]\n * }\n * }\n */\nexport const ListViewSchema = z.object({\n name: SnakeCaseIdentifierSchema.optional().describe('Internal view name (lowercase snake_case)'),\n label: z.string().optional(), // Display label override\n type: z.enum([\n 'grid', // Standard Data Table\n 'kanban', // Board / Columns\n 'gallery', // Card Deck / Masonry\n 'calendar', // Monthly/Weekly/Daily\n 'timeline', // Chronological Stream (Feed)\n 'gantt', // Project Timeline\n 'map' // Geospatial\n ]).default('grid'),\n \n /** Data Source Configuration */\n data: ViewDataSchema.optional().describe('Data source configuration (defaults to \"object\" provider)'),\n \n /** Shared Query Config */\n columns: z.union([\n z.array(z.string()), // Legacy: simple field names\n z.array(ListColumnSchema), // Enhanced: detailed column config\n ]).describe('Fields to display as columns'),\n filter: z.array(z.unknown()).optional().describe('Filter criteria (JSON Rules)'),\n sort: z.union([\n z.string(), //Legacy \"field desc\"\n z.array(z.object({\n field: z.string(),\n order: z.enum(['asc', 'desc'])\n }))\n ]).optional(),\n \n /** Search & Filter */\n searchableFields: z.array(z.string()).optional().describe('Fields enabled for search'),\n filterableFields: z.array(z.string()).optional().describe('Fields enabled for end-user filtering in the top bar'),\n\n /** Grid Features */\n resizable: z.boolean().optional().describe('Enable column resizing'),\n striped: z.boolean().optional().describe('Striped row styling'),\n bordered: z.boolean().optional().describe('Show borders'),\n\n /** Selection */\n selection: SelectionConfigSchema.optional().describe('Row selection configuration'),\n\n /** Navigation / Interaction */\n navigation: NavigationConfigSchema.optional().describe('Configuration for item click navigation (page, drawer, modal, etc.)'),\n\n /** Pagination */\n pagination: PaginationConfigSchema.optional().describe('Pagination configuration'),\n\n /** Type Specific Config */\n kanban: KanbanConfigSchema.optional(),\n calendar: CalendarConfigSchema.optional(),\n gantt: GanttConfigSchema.optional(),\n\n /** Row & Bulk Actions */\n rowActions: z.array(z.string()).optional().describe('Actions available for individual row items'),\n bulkActions: z.array(z.string()).optional().describe('Actions available when multiple rows are selected'),\n\n /** Performance */\n virtualScroll: z.boolean().optional().describe('Enable virtual scrolling for large datasets'),\n\n /** Conditional Formatting */\n conditionalFormatting: z.array(z.object({\n condition: z.string().describe('Condition expression to evaluate'),\n style: z.record(z.string(), z.string()).describe('CSS styles to apply when condition is true'),\n })).optional().describe('Conditional formatting rules for list rows'),\n\n /** Inline Edit */\n inlineEdit: z.boolean().optional().describe('Allow inline editing of records directly in the list view'),\n\n /** Export */\n exportOptions: z.array(z.enum(['csv', 'xlsx', 'pdf', 'json'])).optional().describe('Available export format options'),\n\n /** Empty State */\n emptyState: z.object({\n title: z.string().optional(),\n message: z.string().optional(),\n icon: z.string().optional(),\n }).optional().describe('Empty state configuration when no records found'),\n});\n\n/**\n * Form Field Configuration Schema\n * Detailed configuration for individual form fields\n */\nexport const FormFieldSchema = z.object({\n field: z.string().describe('Field name (snake_case)'),\n label: z.string().optional().describe('Display label override'),\n placeholder: z.string().optional().describe('Placeholder text'),\n helpText: z.string().optional().describe('Help/hint text'),\n readonly: z.boolean().optional().describe('Read-only override'),\n required: z.boolean().optional().describe('Required override'),\n hidden: z.boolean().optional().describe('Hidden override'),\n colSpan: z.number().int().min(1).max(4).optional().describe('Column span in grid layout (1-4)'),\n widget: z.string().optional().describe('Custom widget/component name'),\n dependsOn: z.string().optional().describe('Parent field name for cascading'),\n visibleOn: z.string().optional().describe('Visibility condition expression'),\n});\n\n/**\n * Form Layout Section\n */\nexport const FormSectionSchema = z.object({\n label: z.string().optional(),\n collapsible: z.boolean().default(false),\n collapsed: z.boolean().default(false),\n columns: z.enum(['1', '2', '3', '4']).default('2').transform(val => parseInt(val) as 1 | 2 | 3 | 4),\n fields: z.array(z.union([\n z.string(), // Legacy: simple field name\n FormFieldSchema, // Enhanced: detailed field config\n ])),\n});\n\n/**\n * Form View Schema\n * Defines the layout for creating or editing a single record.\n * \n * @example Simple Sectioned Form\n * {\n * type: \"simple\",\n * sections: [\n * {\n * label: \"General Info\",\n * columns: 2,\n * fields: [\"name\", \"status\"]\n * },\n * {\n * label: \"Details\",\n * fields: [\"description\", { field: \"priority\", widget: \"rating\" }]\n * }\n * ]\n * }\n */\nexport const FormViewSchema = z.object({\n type: z.enum([\n 'simple', // Single column or sections\n 'tabbed', // Tabs\n 'wizard', // Step by step\n 'split', // Master-Detail split\n 'drawer', // Side panel\n 'modal' // Dialog\n ]).default('simple'),\n \n /** Data Source Configuration */\n data: ViewDataSchema.optional().describe('Data source configuration (defaults to \"object\" provider)'),\n \n sections: z.array(FormSectionSchema).optional(), // For simple layout\n groups: z.array(FormSectionSchema).optional(), // Legacy support -> alias to sections\n});\n\n/**\n * Master View Schema\n * Can define multiple named views.\n */\n/**\n * View Container Schema\n * Aggregates all view definitions for a specific object or context.\n * \n * @example\n * {\n * list: { type: \"grid\", columns: [\"name\"] },\n * form: { type: \"simple\", fields: [\"name\"] },\n * listViews: {\n * \"all\": { label: \"All\", filter: [] },\n * \"my\": { label: \"Mine\", filter: [[\"owner\", \"=\", \"{user_id}\"]] }\n * }\n * }\n */\nexport const ViewSchema = z.object({\n list: ListViewSchema.optional(), // Default list view\n form: FormViewSchema.optional(), // Default form view\n listViews: z.record(z.string(), ListViewSchema).optional().describe('Additional named list views'),\n formViews: z.record(z.string(), FormViewSchema).optional().describe('Additional named form views'),\n});\n\nexport type View = z.infer<typeof ViewSchema>;\nexport type ListView = z.infer<typeof ListViewSchema>;\nexport type FormView = z.infer<typeof FormViewSchema>;\nexport type FormSection = z.infer<typeof FormSectionSchema>;\nexport type ListColumn = z.infer<typeof ListColumnSchema>;\nexport type FormField = z.infer<typeof FormFieldSchema>;\nexport type SelectionConfig = z.infer<typeof SelectionConfigSchema>;\nexport type NavigationConfig = z.infer<typeof NavigationConfigSchema>;\nexport type PaginationConfig = z.infer<typeof PaginationConfigSchema>;\nexport type ViewData = z.infer<typeof ViewDataSchema>;\nexport type HttpRequest = z.infer<typeof HttpRequestSchema>;\nexport type HttpMethod = z.infer<typeof HttpMethodSchema>;\n","// Copyright (c) 2025 ObjectStack. Licensed under the Apache-2.0 license.\n\nimport { z } from 'zod';\nimport { SnakeCaseIdentifierSchema } from '../shared/identifiers.zod';\nimport { RowLevelSecurityPolicySchema } from './rls.zod';\n\n/**\n * Entity (Object) Level Permissions\n * Defines CRUD + VAMA (View All / Modify All) + Lifecycle access.\n * \n * Refined with enterprise data lifecycle controls:\n * - Transfer (Ownership change)\n * - Restore (Soft delete recovery)\n * - Purge (Hard delete / Compliance)\n */\nexport const ObjectPermissionSchema = z.object({\n /** C: Create */\n allowCreate: z.boolean().default(false).describe('Create permission'),\n /** R: Read (Owned records or Shared records) */\n allowRead: z.boolean().default(false).describe('Read permission'),\n /** U: Edit (Owned records or Shared records) */\n allowEdit: z.boolean().default(false).describe('Edit permission'),\n /** D: Delete (Owned records or Shared records) */\n allowDelete: z.boolean().default(false).describe('Delete permission'),\n \n /** Lifecycle Operations */\n allowTransfer: z.boolean().default(false).describe('Change record ownership'),\n allowRestore: z.boolean().default(false).describe('Restore from trash (Undelete)'),\n allowPurge: z.boolean().default(false).describe('Permanently delete (Hard Delete/GDPR)'),\n\n /** \n * View All Records: Super-user read access. \n * Bypasses Sharing Rules and Ownership checks.\n * Equivalent to Microsoft Dataverse \"Organization\" level read access.\n */\n viewAllRecords: z.boolean().default(false).describe('View All Data (Bypass Sharing)'),\n \n /** \n * Modify All Records: Super-user write access. \n * Bypasses Sharing Rules and Ownership checks.\n * Equivalent to Microsoft Dataverse \"Organization\" level write access.\n */\n modifyAllRecords: z.boolean().default(false).describe('Modify All Data (Bypass Sharing)'),\n});\n\n/**\n * Field Level Security (FLS)\n */\nexport const FieldPermissionSchema = z.object({\n /** Can see this field */\n readable: z.boolean().default(true).describe('Field read access'),\n /** Can edit this field */\n editable: z.boolean().default(false).describe('Field edit access'),\n});\n\n/**\n * Permission Set Schema\n * Defines a collection of permissions that can be assigned to users.\n * \n * DIFFERENTIATION:\n * - Profile: The ONE primary functional definition of a user (e.g. Standard User).\n * - Permission Set: Add-on capabilities assigned to users (e.g. Export Reports).\n * - Role: (Defined in src/system/role.zod.ts) Defines data visibility hierarchy.\n * \n * **NAMING CONVENTION:**\n * Permission set names MUST be lowercase snake_case to prevent security issues.\n * \n * @example Good permission set names\n * - 'read_only'\n * - 'system_admin'\n * - 'standard_user'\n * - 'api_access'\n * \n * @example Bad permission set names (will be rejected)\n * - 'ReadOnly' (camelCase)\n * - 'SystemAdmin' (mixed case)\n * - 'Read Only' (spaces)\n */\nexport const PermissionSetSchema = z.object({\n /** Unique permission set name */\n name: SnakeCaseIdentifierSchema.describe('Permission set unique name (lowercase snake_case)'),\n \n /** Display label */\n label: z.string().optional().describe('Display label'),\n \n /** Is this a Profile? (Base set for a user) */\n isProfile: z.boolean().default(false).describe('Whether this is a user profile'),\n \n /** Object Permissions Map: <entity_name> -> permissions */\n objects: z.record(z.string(), ObjectPermissionSchema).describe('Entity permissions'),\n \n /** Field Permissions Map: <entity_name>.<field_name> -> permissions */\n fields: z.record(z.string(), FieldPermissionSchema).optional().describe('Field level security'),\n \n /** System permissions (e.g., \"manage_users\") */\n systemPermissions: z.array(z.string()).optional().describe('System level capabilities'),\n \n /** \n * Row-Level Security Rules\n * \n * Row-level security policies that filter records based on user context.\n * These rules are applied in addition to object-level permissions.\n * \n * Uses the canonical RLS protocol from rls.zod.ts for comprehensive\n * row-level security features including PostgreSQL-style USING and CHECK clauses.\n * \n * @see {@link RowLevelSecurityPolicySchema} for full RLS specification\n * @see {@link file://./rls.zod.ts} for comprehensive RLS documentation\n * \n * @example Multi-tenant isolation\n * ```typescript\n * rls: [{\n * name: 'tenant_filter',\n * object: 'account',\n * operation: 'select',\n * using: 'tenant_id = current_user.tenant_id'\n * }]\n * ```\n */\n rowLevelSecurity: z.array(RowLevelSecurityPolicySchema).optional()\n .describe('Row-level security policies (see rls.zod.ts for full spec)'),\n \n /**\n * Context-Based Access Control Variables\n * \n * Custom context variables that can be referenced in RLS rules.\n * These variables are evaluated at runtime based on the user's session.\n * \n * Common context variables:\n * - `current_user.id` - Current user ID\n * - `current_user.tenant_id` - User's tenant/organization ID\n * - `current_user.department` - User's department\n * - `current_user.role` - User's role\n * - `current_user.region` - User's geographic region\n * \n * @example Custom context\n * ```typescript\n * contextVariables: {\n * allowed_regions: ['US', 'EU'],\n * access_level: 2,\n * custom_attribute: 'value'\n * }\n * ```\n */\n contextVariables: z.record(z.string(), z.unknown()).optional().describe('Context variables for RLS evaluation'),\n});\n\nexport type PermissionSet = z.infer<typeof PermissionSetSchema>;\nexport type ObjectPermission = z.infer<typeof ObjectPermissionSchema>;\nexport type FieldPermission = z.infer<typeof FieldPermissionSchema>;\n","// Copyright (c) 2025 ObjectStack. Licensed under the Apache-2.0 license.\n\nimport { z } from 'zod';\n\n/**\n * # Row-Level Security (RLS) Protocol\n * \n * Implements fine-grained record-level access control inspired by PostgreSQL RLS\n * and Salesforce Criteria-Based Sharing Rules.\n * \n * ## Overview\n * \n * Row-Level Security (RLS) allows you to control which rows users can access\n * in database tables based on their identity and role. Unlike object-level\n * permissions (CRUD), RLS provides record-level filtering.\n * \n * ## Use Cases\n * \n * 1. **Multi-Tenant Data Isolation**\n * - Users only see records from their organization\n * - `using: \"tenant_id = current_user.tenant_id\"`\n * \n * 2. **Ownership-Based Access**\n * - Users only see records they own\n * - `using: \"owner_id = current_user.id\"`\n * \n * 3. **Department-Based Access**\n * - Users only see records from their department\n * - `using: \"department = current_user.department\"`\n * \n * 4. **Regional Access Control**\n * - Sales reps only see accounts in their territory\n * - `using: \"region IN (current_user.assigned_regions)\"`\n * \n * 5. **Time-Based Access**\n * - Users can only access active records\n * - `using: \"status = 'active' AND expiry_date > NOW()\"`\n * \n * ## PostgreSQL RLS Comparison\n * \n * PostgreSQL RLS Example:\n * ```sql\n * CREATE POLICY tenant_isolation ON accounts\n * FOR SELECT\n * USING (tenant_id = current_setting('app.current_tenant_id')::uuid);\n * \n * CREATE POLICY account_insert ON accounts\n * FOR INSERT\n * WITH CHECK (tenant_id = current_setting('app.current_tenant_id')::uuid);\n * ```\n * \n * ObjectStack RLS Equivalent:\n * ```typescript\n * {\n * name: 'tenant_isolation',\n * object: 'account',\n * operation: 'select',\n * using: 'tenant_id = current_user.tenant_id'\n * }\n * ```\n * \n * ## Salesforce Sharing Rules Comparison\n * \n * Salesforce uses \"Sharing Rules\" and \"Role Hierarchy\" for record-level access.\n * ObjectStack RLS provides similar functionality with more flexibility.\n * \n * Salesforce:\n * - Criteria-Based Sharing: Share records matching criteria with users/roles\n * - Owner-Based Sharing: Share records based on owner's role\n * - Manual Sharing: Individual record sharing\n * \n * ObjectStack RLS:\n * - More flexible formula-based conditions\n * - Direct SQL-like syntax\n * - Supports complex logic with AND/OR/NOT\n * \n * ## Best Practices\n * \n * 1. **Always Define SELECT Policy**: Control what users can view\n * 2. **Define INSERT/UPDATE CHECK Policies**: Prevent data leakage\n * 3. **Use Role-Based Policies**: Apply different rules to different roles\n * 4. **Test Thoroughly**: RLS can have complex interactions\n * 5. **Monitor Performance**: Complex RLS policies can impact query performance\n * \n * ## Security Considerations\n * \n * 1. **Defense in Depth**: RLS is one layer; use with object permissions\n * 2. **Default Deny**: If no policy matches, access is denied\n * 3. **Policy Precedence**: More permissive policy wins (OR logic)\n * 4. **Context Variables**: Ensure current_user context is always set\n * \n * @see https://www.postgresql.org/docs/current/ddl-rowsecurity.html\n * @see https://help.salesforce.com/s/articleView?id=sf.security_sharing_rules.htm\n */\n\n/**\n * RLS Operation Enum\n * Specifies which database operation this policy applies to.\n * \n * - **select**: Controls which rows can be read (SELECT queries)\n * - **insert**: Controls which rows can be inserted (INSERT statements)\n * - **update**: Controls which rows can be updated (UPDATE statements)\n * - **delete**: Controls which rows can be deleted (DELETE statements)\n * - **all**: Shorthand for all operations (equivalent to defining 4 separate policies)\n */\nexport const RLSOperation = z.enum(['select', 'insert', 'update', 'delete', 'all']);\n\nexport type RLSOperation = z.infer<typeof RLSOperation>;\n\n/**\n * Row-Level Security Policy Schema\n * \n * Defines a single RLS policy that filters records based on conditions.\n * Multiple policies can be defined for the same object, and they are\n * combined with OR logic (union of results).\n * \n * @example Multi-Tenant Isolation\n * ```typescript\n * {\n * name: 'tenant_isolation',\n * label: 'Multi-Tenant Data Isolation',\n * object: 'account',\n * operation: 'select',\n * using: 'tenant_id = current_user.tenant_id',\n * enabled: true\n * }\n * ```\n * \n * @example Owner-Based Access\n * ```typescript\n * {\n * name: 'owner_access',\n * label: 'Users Can View Their Own Records',\n * object: 'opportunity',\n * operation: 'select',\n * using: 'owner_id = current_user.id',\n * enabled: true\n * }\n * ```\n * \n * @example Manager Can View Team Records\n * ```typescript\n * {\n * name: 'manager_team_access',\n * label: 'Managers Can View Team Records',\n * object: 'task',\n * operation: 'select',\n * using: 'assigned_to_id IN (SELECT id FROM users WHERE manager_id = current_user.id)',\n * roles: ['manager', 'director'],\n * enabled: true\n * }\n * ```\n * \n * @example Prevent Cross-Tenant Data Insertion\n * ```typescript\n * {\n * name: 'tenant_insert_check',\n * label: 'Prevent Cross-Tenant Data Creation',\n * object: 'account',\n * operation: 'insert',\n * check: 'tenant_id = current_user.tenant_id',\n * enabled: true\n * }\n * ```\n * \n * @example Regional Sales Access\n * ```typescript\n * {\n * name: 'regional_sales_access',\n * label: 'Sales Reps Access Regional Accounts',\n * object: 'account',\n * operation: 'select',\n * using: 'region = current_user.region OR region IS NULL',\n * roles: ['sales_rep'],\n * enabled: true\n * }\n * ```\n * \n * @example Time-Based Access Control\n * ```typescript\n * {\n * name: 'active_records_only',\n * label: 'Users Only Access Active Records',\n * object: 'contract',\n * operation: 'select',\n * using: 'status = \"active\" AND start_date <= NOW() AND end_date >= NOW()',\n * enabled: true\n * }\n * ```\n * \n * @example Hierarchical Access (Role-Based)\n * ```typescript\n * {\n * name: 'executive_full_access',\n * label: 'Executives See All Records',\n * object: 'account',\n * operation: 'all',\n * using: '1 = 1', // Always true - see everything\n * roles: ['ceo', 'cfo', 'cto'],\n * enabled: true\n * }\n * ```\n */\nexport const RowLevelSecurityPolicySchema = z.object({\n /**\n * Unique identifier for this policy.\n * Must be unique within the object.\n * Use snake_case following ObjectStack naming conventions.\n * \n * @example \"tenant_isolation\", \"owner_access\", \"manager_team_view\"\n */\n name: z.string()\n .regex(/^[a-z_][a-z0-9_]*$/)\n .describe('Policy unique identifier (snake_case)'),\n\n /**\n * Human-readable label for the policy.\n * Used in admin UI and logs.\n * \n * @example \"Multi-Tenant Data Isolation\", \"Owner-Based Access\"\n */\n label: z.string()\n .optional()\n .describe('Human-readable policy label'),\n\n /**\n * Description explaining what this policy does and why.\n * Helps with governance and compliance.\n * \n * @example \"Ensures users can only access records from their own tenant organization\"\n */\n description: z.string()\n .optional()\n .describe('Policy description and business justification'),\n\n /**\n * Target object (table) this policy applies to.\n * Must reference a valid ObjectStack object name.\n * \n * @example \"account\", \"opportunity\", \"contact\", \"custom_object\"\n */\n object: z.string()\n .describe('Target object name'),\n\n /**\n * Database operation(s) this policy applies to.\n * \n * - **select**: Controls read access (SELECT queries)\n * - **insert**: Controls insert access (INSERT statements)\n * - **update**: Controls update access (UPDATE statements)\n * - **delete**: Controls delete access (DELETE statements)\n * - **all**: Applies to all operations\n * \n * @example \"select\" - Most common, controls what users can view\n * @example \"all\" - Apply same rule to all operations\n */\n operation: RLSOperation\n .describe('Database operation this policy applies to'),\n\n /**\n * USING clause - Filter condition for SELECT/UPDATE/DELETE.\n * \n * This is a SQL-like expression evaluated for each row.\n * Only rows where this expression returns TRUE are accessible.\n * \n * **Note**: For INSERT-only policies, USING is not required (only CHECK is needed).\n * For SELECT/UPDATE/DELETE operations, USING is required.\n * \n * **Security Note**: RLS conditions are executed at the database level with\n * parameterized queries. The implementation must use prepared statements\n * to prevent SQL injection. Never concatenate user input directly into\n * RLS conditions.\n * \n * **SQL Dialect**: Compatible with PostgreSQL SQL syntax. Implementations\n * may adapt to other databases (MySQL, SQL Server, etc.) but should maintain\n * semantic equivalence.\n * \n * Available context variables:\n * - `current_user.id` - Current user's ID\n * - `current_user.tenant_id` - Current user's tenant (maps to `tenantId` in RLSUserContext)\n * - `current_user.role` - Current user's role\n * - `current_user.department` - Current user's department\n * - `current_user.*` - Any custom user field\n * - `NOW()` - Current timestamp\n * - `CURRENT_DATE` - Current date\n * - `CURRENT_TIME` - Current time\n * \n * **Context Variable Mapping**: The RLSUserContext schema uses camelCase (e.g., `tenantId`),\n * but expressions use snake_case with `current_user.` prefix (e.g., `current_user.tenant_id`).\n * Implementations must handle this mapping.\n * \n * Supported operators:\n * - Comparison: =, !=, <, >, <=, >=, <> (not equal)\n * - Logical: AND, OR, NOT\n * - NULL checks: IS NULL, IS NOT NULL\n * - Set operations: IN, NOT IN\n * - String: LIKE, NOT LIKE, ILIKE (case-insensitive)\n * - Pattern matching: ~ (regex), !~ (not regex)\n * - Subqueries: (SELECT ...)\n * - Array operations: ANY, ALL\n * \n * **Prohibited**: Dynamic SQL, DDL statements, DML statements (INSERT/UPDATE/DELETE)\n * \n * @example \"tenant_id = current_user.tenant_id\"\n * @example \"owner_id = current_user.id OR created_by = current_user.id\"\n * @example \"department IN (SELECT department FROM user_departments WHERE user_id = current_user.id)\"\n * @example \"status = 'active' AND expiry_date > NOW()\"\n */\n using: z.string()\n .optional()\n .describe('Filter condition for SELECT/UPDATE/DELETE (PostgreSQL SQL WHERE clause syntax with parameterized context variables). Optional for INSERT-only policies.'),\n\n /**\n * CHECK clause - Validation for INSERT/UPDATE operations.\n * \n * Similar to USING but applies to new/modified rows.\n * Prevents users from creating/updating rows they wouldn't be able to see.\n * \n * **Default Behavior**: If not specified, implementations should use the\n * USING clause as the CHECK clause. This ensures data integrity by preventing\n * users from creating records they cannot view.\n * \n * Use cases:\n * - Prevent cross-tenant data creation\n * - Enforce mandatory field values\n * - Validate data integrity rules\n * - Restrict certain operations (e.g., only allow creating \"draft\" status)\n * \n * @example \"tenant_id = current_user.tenant_id\"\n * @example \"status IN ('draft', 'pending')\" - Only allow certain statuses\n * @example \"created_by = current_user.id\" - Must be the creator\n */\n check: z.string()\n .optional()\n .describe('Validation condition for INSERT/UPDATE (defaults to USING clause if not specified - enforced at application level)'),\n\n /**\n * Restrict this policy to specific roles.\n * If specified, only users with these roles will have this policy applied.\n * If omitted, policy applies to all users (except those with bypassRLS permission).\n * \n * Role names must match defined roles in the system.\n * \n * @example [\"sales_rep\", \"account_manager\"]\n * @example [\"employee\"] - Apply to all employees\n * @example [\"guest\"] - Special restrictions for guests\n */\n roles: z.array(z.string())\n .optional()\n .describe('Roles this policy applies to (omit for all roles)'),\n\n /**\n * Whether this policy is currently active.\n * Disabled policies are not evaluated.\n * Useful for temporary policy changes without deletion.\n * \n * @default true\n */\n enabled: z.boolean()\n .default(true)\n .describe('Whether this policy is active'),\n\n /**\n * Policy priority for conflict resolution.\n * Higher numbers = higher priority.\n * When multiple policies apply, the most permissive wins (OR logic).\n * Priority is only used for ordering evaluation (performance).\n * \n * @default 0\n */\n priority: z.number()\n .int()\n .default(0)\n .describe('Policy evaluation priority (higher = evaluated first)'),\n\n /**\n * Tags for policy categorization and reporting.\n * Useful for governance, compliance, and auditing.\n * \n * @example [\"compliance\", \"gdpr\", \"pci\"]\n * @example [\"multi-tenant\", \"security\"]\n */\n tags: z.array(z.string())\n .optional()\n .describe('Policy categorization tags'),\n}).superRefine((data, ctx) => {\n // Ensure at least one of USING or CHECK is provided\n if (!data.using && !data.check) {\n ctx.addIssue({\n code: z.ZodIssueCode.custom,\n message: 'At least one of \"using\" or \"check\" must be specified. For SELECT/UPDATE/DELETE operations, provide \"using\". For INSERT operations, provide \"check\".',\n });\n }\n \n // For non-insert operations, USING should typically be present\n // This is a soft warning through documentation, not enforced here\n // since 'all' and mixed operation types are valid\n});\n\n/**\n * RLS Configuration Schema\n * \n * Global configuration for the Row-Level Security system.\n * Defines how RLS is enforced across the entire platform.\n */\nexport const RLSConfigSchema = z.object({\n /**\n * Global RLS enable/disable flag.\n * When false, all RLS policies are ignored (use with caution!).\n * \n * @default true\n */\n enabled: z.boolean()\n .default(true)\n .describe('Enable RLS enforcement globally'),\n\n /**\n * Default behavior when no policies match.\n * \n * - **deny**: Deny access (secure default)\n * - **allow**: Allow access (permissive mode, not recommended)\n * \n * @default \"deny\"\n */\n defaultPolicy: z.enum(['deny', 'allow'])\n .default('deny')\n .describe('Default action when no policies match'),\n\n /**\n * Whether to allow superusers to bypass RLS.\n * Superusers include system administrators and service accounts.\n * \n * @default true\n */\n allowSuperuserBypass: z.boolean()\n .default(true)\n .describe('Allow superusers to bypass RLS'),\n\n /**\n * List of roles that can bypass RLS.\n * Users with these roles see all records regardless of policies.\n * \n * @example [\"system_admin\", \"data_auditor\"]\n */\n bypassRoles: z.array(z.string())\n .optional()\n .describe('Roles that bypass RLS (see all data)'),\n\n /**\n * Whether to log RLS policy evaluations.\n * Useful for debugging and auditing.\n * Can impact performance if enabled globally.\n * \n * @default false\n */\n logEvaluations: z.boolean()\n .default(false)\n .describe('Log RLS policy evaluations for debugging'),\n\n /**\n * Cache RLS policy evaluation results.\n * Can improve performance for frequently accessed records.\n * Cache is invalidated when policies change or user context changes.\n * \n * @default true\n */\n cacheResults: z.boolean()\n .default(true)\n .describe('Cache RLS evaluation results'),\n\n /**\n * Cache TTL in seconds.\n * How long to cache RLS evaluation results.\n * \n * @default 300 (5 minutes)\n */\n cacheTtlSeconds: z.number()\n .int()\n .positive()\n .default(300)\n .describe('Cache TTL in seconds'),\n\n /**\n * Performance optimization: Pre-fetch user context.\n * Load user context once per request instead of per-query.\n * \n * @default true\n */\n prefetchUserContext: z.boolean()\n .default(true)\n .describe('Pre-fetch user context for performance'),\n});\n\n/**\n * User Context Schema\n * \n * Represents the current user's context for RLS evaluation.\n * This data is used to evaluate USING and CHECK clauses.\n */\nexport const RLSUserContextSchema = z.object({\n /**\n * User ID\n */\n id: z.string()\n .describe('User ID'),\n\n /**\n * User email\n */\n email: z.string()\n .email()\n .optional()\n .describe('User email'),\n\n /**\n * Tenant/Organization ID\n */\n tenantId: z.string()\n .optional()\n .describe('Tenant/Organization ID'),\n\n /**\n * User role(s)\n */\n role: z.union([\n z.string(),\n z.array(z.string()),\n ])\n .optional()\n .describe('User role(s)'),\n\n /**\n * User department\n */\n department: z.string()\n .optional()\n .describe('User department'),\n\n /**\n * Additional custom attributes\n * Can include any custom user fields for RLS evaluation\n */\n attributes: z.record(z.string(), z.unknown())\n .optional()\n .describe('Additional custom user attributes'),\n});\n\n/**\n * RLS Policy Evaluation Result\n * \n * Result of evaluating an RLS policy for a specific record.\n * Used for debugging and audit logging.\n */\nexport const RLSEvaluationResultSchema = z.object({\n /**\n * Policy name that was evaluated\n */\n policyName: z.string()\n .describe('Policy name'),\n\n /**\n * Whether access was granted\n */\n granted: z.boolean()\n .describe('Whether access was granted'),\n\n /**\n * Evaluation duration in milliseconds\n */\n durationMs: z.number()\n .optional()\n .describe('Evaluation duration in milliseconds'),\n\n /**\n * Error message if evaluation failed\n */\n error: z.string()\n .optional()\n .describe('Error message if evaluation failed'),\n\n /**\n * Evaluated USING clause result\n */\n usingResult: z.boolean()\n .optional()\n .describe('USING clause evaluation result'),\n\n /**\n * Evaluated CHECK clause result (for INSERT/UPDATE)\n */\n checkResult: z.boolean()\n .optional()\n .describe('CHECK clause evaluation result'),\n});\n\n/**\n * Type exports\n */\nexport type RowLevelSecurityPolicy = z.infer<typeof RowLevelSecurityPolicySchema>;\nexport type RLSConfig = z.infer<typeof RLSConfigSchema>;\nexport type RLSUserContext = z.infer<typeof RLSUserContextSchema>;\nexport type RLSEvaluationResult = z.infer<typeof RLSEvaluationResultSchema>;\n\n/**\n * Helper factory for creating RLS policies\n */\nexport const RLS = {\n /**\n * Create a simple owner-based policy\n */\n ownerPolicy: (object: string, ownerField: string = 'owner_id'): RowLevelSecurityPolicy => ({\n name: `${object}_owner_access`,\n label: `Owner Access for ${object}`,\n object,\n operation: 'all',\n using: `${ownerField} = current_user.id`,\n enabled: true,\n priority: 0,\n }),\n\n /**\n * Create a tenant isolation policy\n */\n tenantPolicy: (object: string, tenantField: string = 'tenant_id'): RowLevelSecurityPolicy => ({\n name: `${object}_tenant_isolation`,\n label: `Tenant Isolation for ${object}`,\n object,\n operation: 'all',\n using: `${tenantField} = current_user.tenant_id`,\n check: `${tenantField} = current_user.tenant_id`,\n enabled: true,\n priority: 0,\n }),\n\n /**\n * Create a role-based policy\n */\n rolePolicy: (object: string, roles: string[], condition: string): RowLevelSecurityPolicy => ({\n name: `${object}_${roles.join('_')}_access`,\n label: `${roles.join(', ')} Access for ${object}`,\n object,\n operation: 'select',\n using: condition,\n roles,\n enabled: true,\n priority: 0,\n }),\n\n /**\n * Create a permissive policy (allow all for specific roles)\n */\n allowAllPolicy: (object: string, roles: string[]): RowLevelSecurityPolicy => ({\n name: `${object}_${roles.join('_')}_full_access`,\n label: `Full Access for ${roles.join(', ')}`,\n object,\n operation: 'all',\n using: '1 = 1', // Always true\n roles,\n enabled: true,\n priority: 0,\n }),\n} as const;\n","// Copyright (c) 2025 ObjectStack. Licensed under the Apache-2.0 license.\n\nimport { z } from 'zod';\nimport { SnakeCaseIdentifierSchema } from '../shared/identifiers.zod';\n\n/**\n * Trigger events for workflow automation\n */\nexport const WorkflowTriggerType = z.enum([\n 'on_create', // When record is created\n 'on_update', // When record is updated\n 'on_create_or_update', // Both\n 'on_delete', // When record is deleted\n 'schedule' // Time-based (cron)\n]);\n\n/**\n * Schema for Workflow Field Update Action\n * @example\n * {\n * name: \"update_status\",\n * type: \"field_update\",\n * field: \"status\",\n * value: \"approved\"\n * }\n */\nexport const FieldUpdateActionSchema = z.object({\n name: z.string().describe('Action name'),\n type: z.literal('field_update'),\n field: z.string().describe('Field to update'),\n value: z.unknown().describe('Value or Formula to set'),\n});\n\n/**\n * Schema for Workflow Email Alert Action\n * @example\n * {\n * name: \"send_approval_email\",\n * type: \"email_alert\",\n * template: \"approval_request_email\",\n * recipients: [\"user_id_123\", \"manager_field\"]\n * }\n */\nexport const EmailAlertActionSchema = z.object({\n name: z.string().describe('Action name'),\n type: z.literal('email_alert'),\n template: z.string().describe('Email template ID/DevName'),\n recipients: z.array(z.string()).describe('List of recipient emails or user IDs'),\n});\n\n/**\n * Schema for Connector Action Reference\n * Executes a capability defined in an integration connector.\n * Replaces hardcoded vendor actions (Slack, Twilio, etc).\n * \n * @example Send Slack Message\n * {\n * name: \"notify_slack\",\n * type: \"connector_action\",\n * connectorId: \"slack\",\n * actionId: \"post_message\",\n * input: {\n * channel: \"#general\",\n * text: \"New deal closed: {name}\"\n * }\n * }\n */\nexport const ConnectorActionRefSchema = z.object({\n name: z.string().describe('Action name'),\n type: z.literal('connector_action'),\n connectorId: z.string().describe('Target Connector ID (e.g. slack, twilio)'),\n actionId: z.string().describe('Target Action ID (e.g. send_message)'),\n input: z.record(z.string(), z.unknown()).describe('Input parameters matching the action schema'),\n});\n\n/**\n * Schema for HTTP Callout Action\n * Makes a REST API call to an external service.\n * @example\n * {\n * name: \"sync_to_erp\",\n * type: \"http_call\",\n * url: \"https://erp.api/orders\",\n * method: \"POST\",\n * headers: { \"Authorization\": \"Bearer {token}\" },\n * body: \"{ ... }\"\n * }\n */\nexport const HttpCallActionSchema = z.object({\n name: z.string().describe('Action name'),\n type: z.literal('http_call'),\n url: z.string().describe('Target URL'),\n method: z.enum(['GET', 'POST', 'PUT', 'DELETE', 'PATCH']).default('POST').describe('HTTP Method'),\n headers: z.record(z.string(), z.string()).optional().describe('HTTP Headers'),\n body: z.string().optional().describe('Request body (JSON or text)'),\n});\n\n/**\n * Schema for Workflow Task Creation Action\n * @example\n * {\n * name: \"create_followup_task\",\n * type: \"task_creation\",\n * taskObject: \"tasks\",\n * subject: \"Follow up with client\",\n * dueDate: \"TODAY() + 3\"\n * }\n */\nexport const TaskCreationActionSchema = z.object({\n name: z.string().describe('Action name'),\n type: z.literal('task_creation'),\n taskObject: z.string().describe('Task object name (e.g., \"task\", \"project_task\")'),\n subject: z.string().describe('Task subject/title'),\n description: z.string().optional().describe('Task description'),\n assignedTo: z.string().optional().describe('User ID or field reference for assignee'),\n dueDate: z.string().optional().describe('Due date (ISO string or formula)'),\n priority: z.string().optional().describe('Task priority'),\n relatedTo: z.string().optional().describe('Related record ID or field reference'),\n additionalFields: z.record(z.string(), z.unknown()).optional().describe('Additional custom fields'),\n});\n\n/**\n * Schema for Workflow Push Notification Action\n */\nexport const PushNotificationActionSchema = z.object({\n name: z.string().describe('Action name'),\n type: z.literal('push_notification'),\n title: z.string().describe('Notification title'),\n body: z.string().describe('Notification body text'),\n recipients: z.array(z.string()).describe('User IDs or device tokens'),\n data: z.record(z.string(), z.unknown()).optional().describe('Additional data payload'),\n badge: z.number().optional().describe('Badge count (iOS)'),\n sound: z.string().optional().describe('Notification sound'),\n clickAction: z.string().optional().describe('Action/URL when notification is clicked'),\n});\n\n/**\n * Schema for Workflow Custom Script Action\n */\nexport const CustomScriptActionSchema = z.object({\n name: z.string().describe('Action name'),\n type: z.literal('custom_script'),\n language: z.enum(['javascript', 'typescript', 'python']).default('javascript').describe('Script language'),\n code: z.string().describe('Script code to execute'),\n timeout: z.number().default(30000).describe('Execution timeout in milliseconds'),\n context: z.record(z.string(), z.unknown()).optional().describe('Additional context variables'),\n});\n\n/**\n * Universal Workflow Action Schema\n * Union of all supported action types.\n */\nexport const WorkflowActionSchema = z.discriminatedUnion('type', [\n FieldUpdateActionSchema,\n EmailAlertActionSchema,\n HttpCallActionSchema,\n ConnectorActionRefSchema,\n TaskCreationActionSchema,\n PushNotificationActionSchema,\n CustomScriptActionSchema,\n]);\n\nexport type WorkflowAction = z.infer<typeof WorkflowActionSchema>;\n\n/**\n * Time Trigger Definition\n * Schedules actions to run relative to a specific time or date field.\n */\nexport const TimeTriggerSchema = z.object({\n id: z.string().optional().describe('Unique identifier'),\n \n /** Timing Logic */\n timeLength: z.number().int().describe('Duration amount (e.g. 1, 30)'),\n timeUnit: z.enum(['minutes', 'hours', 'days']).describe('Unit of time'),\n \n /** Reference Point */\n offsetDirection: z.enum(['before', 'after']).describe('Before or After the reference date'),\n offsetFrom: z.enum(['trigger_date', 'date_field']).describe('Basis for calculation'),\n dateField: z.string().optional().describe('Date field to calculate from (required if offsetFrom is date_field)'),\n \n /** Actions */\n actions: z.array(WorkflowActionSchema).describe('Actions to execute at the scheduled time'),\n});\n\n/**\n * Schema for Workflow Rules (Automation)\n * \n * **NAMING CONVENTION:**\n * Workflow names are machine identifiers and must be lowercase snake_case.\n * \n * @example Good workflow names\n * - 'send_welcome_email'\n * - 'update_lead_status'\n * - 'notify_manager_on_close'\n * - 'calculate_discount'\n * \n * @example Bad workflow names (will be rejected)\n * - 'SendWelcomeEmail' (PascalCase)\n * - 'updateLeadStatus' (camelCase)\n * - 'Send Welcome Email' (spaces)\n * \n * @example Complete Workflow\n * {\n * name: \"new_lead_process\",\n * objectName: \"lead\",\n * triggerType: \"on_create\",\n * criteria: \"amount > 1000\",\n * active: true,\n * actions: [\n * {\n * name: \"set_status\",\n * type: \"field_update\",\n * field: \"status\",\n * value: \"new\"\n * },\n * {\n * name: \"notify_team\",\n * type: \"connector_action\",\n * connectorId: \"slack\",\n * actionId: \"post_message\",\n * input: { channel: \"#sales\", text: \"New high value lead!\" }\n * }\n * ],\n * timeTriggers: [\n * {\n * timeLength: 2,\n * timeUnit: \"days\",\n * offsetDirection: \"after\",\n * offsetFrom: \"trigger_date\",\n * actions: [\n * {\n * name: \"followup_check\",\n * type: \"task_creation\",\n * taskObject: \"task\",\n * subject: \"Follow up lead\",\n * dueDate: \"TODAY()\"\n * }\n * ]\n * }\n * ]\n * }\n */\nexport const WorkflowRuleSchema = z.object({\n /** Machine name */\n name: SnakeCaseIdentifierSchema.describe('Unique workflow name (lowercase snake_case)'),\n \n /** Target Object */\n objectName: z.string().describe('Target Object'),\n \n /** When to evaluate the rule */\n triggerType: WorkflowTriggerType.describe('When to evaluate'),\n \n /** \n * Condition to start the workflow.\n * If empty, runs on every trigger event.\n */\n criteria: z.string().optional().describe('Formula condition. If TRUE, actions execute.'),\n \n /** Actions to execute immediately */\n actions: z.array(WorkflowActionSchema).optional().describe('Immediate actions'),\n \n /** \n * Time-Dependent Actions \n * Actions scheduled to run in the future.\n */\n timeTriggers: z.array(TimeTriggerSchema).optional().describe('Scheduled actions relative to trigger or date field'),\n \n /** Active status */\n active: z.boolean().default(true).describe('Whether this workflow is active'),\n \n /** Recursion Control */\n reevaluateOnChange: z.boolean().default(false).describe('Re-evaluate rule if field updates change the record validity'),\n});\n\nexport type WorkflowRule = z.infer<typeof WorkflowRuleSchema>;\nexport type TimeTrigger = z.infer<typeof TimeTriggerSchema>;\n","// Copyright (c) 2025 ObjectStack. Licensed under the Apache-2.0 license.\n\nimport { z } from 'zod';\n\n/**\n * Translation Schema\n * Supports i18n for labels, messages, and options.\n * Example structure:\n * ```json\n * {\n * \"en\": { \"objects\": { \"account\": { \"label\": \"Account\" } } },\n * \"zh-CN\": { \"objects\": { \"account\": { \"label\": \"客户\" } } }\n * }\n * ```\n */\nexport const TranslationDataSchema = z.object({\n /** Object translations */\n objects: z.record(z.string(), z.object({\n label: z.string().describe('Translated singular label'),\n pluralLabel: z.string().optional().describe('Translated plural label'),\n fields: z.record(z.string(), z.object({\n label: z.string().optional().describe('Translated field label'),\n help: z.string().optional().describe('Translated help text'),\n options: z.record(z.string(), z.string()).optional().describe('Option value to translated label map'),\n })).optional().describe('Field-level translations'),\n })).optional().describe('Object translations keyed by object name'),\n \n /** App/Menu translations */\n apps: z.record(z.string(), z.object({\n label: z.string().describe('Translated app label'),\n description: z.string().optional().describe('Translated app description'),\n })).optional().describe('App translations keyed by app name'),\n\n /** UI Messages */\n messages: z.record(z.string(), z.string()).optional().describe('UI message translations keyed by message ID'),\n}).describe('Translation data for objects, apps, and UI messages');\n\nexport const LocaleSchema = z.string().describe('BCP-47 Language Tag (e.g. en-US, zh-CN)');\n\nexport const TranslationBundleSchema = z.record(LocaleSchema, TranslationDataSchema).describe('Map of locale codes to translation data');\n\nexport type TranslationBundle = z.infer<typeof TranslationBundleSchema>;\n","// Copyright (c) 2025 ObjectStack. Licensed under the Apache-2.0 license.\n\nimport { z } from 'zod';\nimport { ManifestSchema } from './manifest.zod';\n\n/**\n * # Package Registry Protocol\n * \n * Defines the runtime state and lifecycle operations for installed packages.\n * \n * ## Key Distinction: Package vs App\n * - **Package (Manifest)**: The unit of installation — a deployable artifact containing\n * metadata (objects, actions, flows, etc.) and optionally one or more Apps.\n * - **App (AppSchema)**: A UI navigation shell defined inside a package.\n * \n * A package may contain:\n * - Zero apps (pure functionality plugin, e.g. a storage driver)\n * - One app (typical business application)\n * - Multiple apps (suite of applications)\n * \n * ## Architecture Alignment\n * - **Salesforce**: Managed Packages with install/uninstall lifecycle\n * - **VS Code**: Extension marketplace with enable/disable per-workspace\n * - **Kubernetes**: Helm charts with release state tracking\n * - **npm**: Package registry with install/uninstall/version management\n */\n\n// ==========================================\n// Package Status & Lifecycle\n// ==========================================\n\n/**\n * Package installation status.\n */\nexport const PackageStatusEnum = z.enum([\n 'installed', // Successfully installed and enabled\n 'disabled', // Installed but disabled (metadata not active)\n 'installing', // Installation in progress\n 'uninstalling', // Removal in progress\n 'error', // Installation or runtime error\n]);\nexport type PackageStatus = z.infer<typeof PackageStatusEnum>;\n\n/**\n * Installed Package Schema\n * \n * Wraps a ManifestSchema with runtime lifecycle state.\n * This is the \"row\" in the installed packages table.\n */\nexport const InstalledPackageSchema = z.object({\n /** \n * The full package manifest (source of truth for package definition).\n */\n manifest: ManifestSchema,\n\n /**\n * Current lifecycle status.\n */\n status: PackageStatusEnum.default('installed'),\n\n /**\n * Whether the package is currently enabled (active).\n * When disabled, the package's metadata is not loaded into the registry.\n */\n enabled: z.boolean().default(true),\n\n /**\n * ISO 8601 timestamp of when the package was installed.\n */\n installedAt: z.string().datetime().optional(),\n\n /**\n * ISO 8601 timestamp of last update.\n */\n updatedAt: z.string().datetime().optional(),\n\n /**\n * ISO 8601 timestamp of when the package was last enabled/disabled.\n */\n statusChangedAt: z.string().datetime().optional(),\n\n /**\n * Error message if status is 'error'.\n */\n errorMessage: z.string().optional(),\n\n /**\n * Configuration values set by the user for this package.\n * Keys correspond to the package's `configuration.properties`.\n */\n settings: z.record(z.string(), z.unknown()).optional(),\n});\nexport type InstalledPackage = z.infer<typeof InstalledPackageSchema>;\n\n// ==========================================\n// Package Registry Request/Response Schemas\n// ==========================================\n\n/**\n * List Packages Request\n */\nexport const ListPackagesRequestSchema = z.object({\n /** Filter by status */\n status: PackageStatusEnum.optional(),\n /** Filter by package type */\n type: ManifestSchema.shape.type.optional(),\n /** Filter by enabled state */\n enabled: z.boolean().optional(),\n});\nexport type ListPackagesRequest = z.infer<typeof ListPackagesRequestSchema>;\n\n/**\n * List Packages Response\n */\nexport const ListPackagesResponseSchema = z.object({\n packages: z.array(InstalledPackageSchema),\n total: z.number(),\n});\nexport type ListPackagesResponse = z.infer<typeof ListPackagesResponseSchema>;\n\n/**\n * Get Package Request\n */\nexport const GetPackageRequestSchema = z.object({\n /** Package ID (reverse domain identifier from manifest) */\n id: z.string(),\n});\nexport type GetPackageRequest = z.infer<typeof GetPackageRequestSchema>;\n\n/**\n * Get Package Response\n */\nexport const GetPackageResponseSchema = z.object({\n package: InstalledPackageSchema,\n});\nexport type GetPackageResponse = z.infer<typeof GetPackageResponseSchema>;\n\n/**\n * Install Package Request\n * \n * Accepts a full manifest to install. In a production system,\n * this might also accept a package ID to fetch from a marketplace.\n */\nexport const InstallPackageRequestSchema = z.object({\n /** The package manifest to install */\n manifest: ManifestSchema,\n /** Optional: user-provided settings at install time */\n settings: z.record(z.string(), z.unknown()).optional(),\n /** Whether to enable immediately after install (default: true) */\n enableOnInstall: z.boolean().default(true),\n});\nexport type InstallPackageRequest = z.infer<typeof InstallPackageRequestSchema>;\n\n/**\n * Install Package Response\n */\nexport const InstallPackageResponseSchema = z.object({\n package: InstalledPackageSchema,\n message: z.string().optional(),\n});\nexport type InstallPackageResponse = z.infer<typeof InstallPackageResponseSchema>;\n\n/**\n * Uninstall Package Request\n */\nexport const UninstallPackageRequestSchema = z.object({\n /** Package ID to uninstall */\n id: z.string(),\n});\nexport type UninstallPackageRequest = z.infer<typeof UninstallPackageRequestSchema>;\n\n/**\n * Uninstall Package Response\n */\nexport const UninstallPackageResponseSchema = z.object({\n id: z.string(),\n success: z.boolean(),\n message: z.string().optional(),\n});\nexport type UninstallPackageResponse = z.infer<typeof UninstallPackageResponseSchema>;\n\n/**\n * Enable Package Request\n */\nexport const EnablePackageRequestSchema = z.object({\n /** Package ID to enable */\n id: z.string(),\n});\nexport type EnablePackageRequest = z.infer<typeof EnablePackageRequestSchema>;\n\n/**\n * Enable Package Response\n */\nexport const EnablePackageResponseSchema = z.object({\n package: InstalledPackageSchema,\n message: z.string().optional(),\n});\nexport type EnablePackageResponse = z.infer<typeof EnablePackageResponseSchema>;\n\n/**\n * Disable Package Request\n */\nexport const DisablePackageRequestSchema = z.object({\n /** Package ID to disable */\n id: z.string(),\n});\nexport type DisablePackageRequest = z.infer<typeof DisablePackageRequestSchema>;\n\n/**\n * Disable Package Response\n */\nexport const DisablePackageResponseSchema = z.object({\n package: InstalledPackageSchema,\n message: z.string().optional(),\n});\nexport type DisablePackageResponse = z.infer<typeof DisablePackageResponseSchema>;\n","// Copyright (c) 2025 ObjectStack. Licensed under the Apache-2.0 license.\n\nimport { z } from 'zod';\nimport { PluginCapabilityManifestSchema } from './plugin-capability.zod';\nimport { PluginLoadingConfigSchema } from './plugin-loading.zod';\nimport { CORE_PLUGIN_TYPES } from './plugin.zod';\nimport { DatasetSchema } from '../data/dataset.zod';\n\n/**\n * Schema for the ObjectStack Manifest.\n * This defines the structure of a package configuration in the ObjectStack ecosystem.\n * All packages (apps, plugins, drivers, modules) must conform to this schema.\n * \n * @example App Package\n * ```yaml\n * id: com.acme.crm\n * version: 1.0.0\n * type: app\n * name: Acme CRM\n * description: Customer Relationship Management system\n * permissions:\n * - system.user.read\n * - system.object.create\n * objects:\n * - \"./src/objects/*.object.yml\"\n * ```\n */\nexport const ManifestSchema = z.object({\n /** \n * Unique package identifier using reverse domain notation.\n * Must be unique across the entire ecosystem.\n * \n * @example \"com.steedos.crm\"\n * @example \"org.apache.superset\"\n */\n id: z.string().describe('Unique package identifier (reverse domain style)'),\n \n /**\n * Short namespace identifier for metadata scoping.\n * Used as a prefix for objects and other metadata to prevent naming collisions\n * across packages from different vendors.\n * \n * Rules:\n * - 2-20 characters, lowercase letters, digits, and underscores only.\n * - Must be unique within a running instance.\n * - Platform-reserved namespaces (no prefix applied): \"base\", \"system\".\n * - FQN (Fully Qualified Name) = `{namespace}__{short_name}` (double underscore separator).\n * \n * @example \"crm\" → objects become crm__account, crm__deal\n * @example \"todo\" → objects become todo__task\n * @example \"base\" → objects keep short name (platform reserved)\n */\n namespace: z.string()\n .regex(/^[a-z][a-z0-9_]{1,19}$/, 'Namespace must be 2-20 chars, lowercase alphanumeric + underscore')\n .optional()\n .describe('Short namespace identifier for metadata scoping (e.g. \"crm\", \"todo\")'),\n \n /** \n * Package version following semantic versioning (major.minor.patch).\n * \n * @example \"1.0.0\"\n * @example \"2.1.0-beta.1\"\n */\n version: z.string().regex(/^\\d+\\.\\d+\\.\\d+$/).describe('Package version (semantic versioning)'),\n \n /** \n * Type of the package in the ObjectStack ecosystem.\n * - plugin: General-purpose functionality extension (Runtime: standard)\n * - app: Business application package\n * - driver: Connectivity adapter\n * - server: Protocol gateway (Hono, GraphQL)\n * - ui: Frontend package (Static/SPA)\n * - theme: UI Theme\n * - agent: AI Agent\n * - module: Reusable code library/shared module\n * - objectql: Core engine\n * - adapter: Host adapter (Express, Fastify)\n */\n type: z.enum([\n 'plugin', \n ...CORE_PLUGIN_TYPES,\n 'module', \n 'gateway', // Deprecated: use 'server'\n 'adapter'\n ]).describe('Type of package'),\n \n /** \n * Human-readable name of the package.\n * Displayed in the UI for users.\n * \n * @example \"Project Management\"\n */\n name: z.string().describe('Human-readable package name'),\n \n /** \n * Brief description of the package functionality.\n * Displayed in the marketplace and plugin manager.\n */\n description: z.string().optional().describe('Package description'),\n \n /** \n * Array of permission strings that the package requires.\n * These form the \"Scope\" requested by the package at installation.\n * \n * @example [\"system.user.read\", \"system.data.write\"]\n */\n permissions: z.array(z.string()).optional().describe('Array of required permission strings'),\n \n /** \n * Glob patterns specifying ObjectQL schemas files.\n * Matches `*.object.yml` or `*.object.ts` files to load business objects.\n * \n * @example [\"./src/objects/*.object.yml\"]\n */\n objects: z.array(z.string()).optional().describe('Glob patterns for ObjectQL schemas files'),\n\n /**\n * Defines system level DataSources.\n * Matches `*.datasource.yml` files.\n * \n * @example [\"./src/datasources/*.datasource.mongo.yml\"]\n */\n datasources: z.array(z.string()).optional().describe('Glob patterns for Datasource definitions'),\n\n /**\n * Package Dependencies.\n * Map of package IDs to version requirements.\n * \n * @example { \"@steedos/plugin-auth\": \"^2.0.0\" }\n */\n dependencies: z.record(z.string(), z.string()).optional().describe('Package dependencies'),\n\n /**\n * Plugin Configuration Schema.\n * Defines the settings this plugin exposes to the user via UI/ENV.\n * Uses a simplified JSON Schema format.\n * \n * @example\n * {\n * \"title\": \"Stripe Config\",\n * \"properties\": {\n * \"apiKey\": { \"type\": \"string\", \"secret\": true },\n * \"currency\": { \"type\": \"string\", \"default\": \"USD\" }\n * }\n * }\n */\n configuration: z.object({\n title: z.string().optional(),\n properties: z.record(z.string(), z.object({\n type: z.enum(['string', 'number', 'boolean', 'array', 'object']).describe('Data type of the setting'),\n default: z.unknown().optional().describe('Default value'),\n description: z.string().optional().describe('Tooltip description'),\n required: z.boolean().optional().describe('Is this setting required?'),\n secret: z.boolean().optional().describe('If true, value is encrypted/masked (e.g. API Keys)'),\n enum: z.array(z.string()).optional().describe('Allowed values for select inputs'),\n })).describe('Map of configuration keys to their definitions')\n }).optional().describe('Plugin configuration settings'),\n\n /**\n * Contribution Points (VS Code Style).\n * formalized way to extend the platform capabilities.\n */\n contributes: z.object({\n /**\n * Register new Metadata Kinds (CRDs).\n * Enables the system to parse and validate new file types.\n * Example: Registering a BI plugin to handle *.report.ts\n */\n kinds: z.array(z.object({\n id: z.string().describe('The generic identifier of the kind (e.g., \"sys.bi.report\")'),\n globs: z.array(z.string()).describe('File patterns to watch (e.g., [\"**/*.report.ts\"])'),\n description: z.string().optional().describe('Description of what this kind represents'),\n })).optional().describe('New Metadata Types to recognize'),\n\n /**\n * Register System Hooks.\n * Declares that this plugin listens to specific system events.\n */\n events: z.array(z.string()).optional().describe('Events this plugin listens to'),\n\n /**\n * Register UI Menus.\n */\n menus: z.record(z.string(), z.array(z.object({\n id: z.string(),\n label: z.string(),\n command: z.string().optional(),\n }))).optional().describe('UI Menu contributions'),\n\n /**\n * Register Custom Themes.\n */\n themes: z.array(z.object({\n id: z.string(),\n label: z.string(),\n path: z.string(),\n })).optional().describe('Theme contributions'),\n\n /**\n * Register Translations.\n * Path to translation files (e.g. \"locales/en.json\").\n */\n translations: z.array(z.object({\n locale: z.string(),\n path: z.string(),\n })).optional().describe('Translation resources'),\n\n /**\n * Register Server Actions.\n * Invocable functions exposed to Flows or API.\n */\n actions: z.array(z.object({\n name: z.string().describe('Unique action name'),\n label: z.string().optional(),\n description: z.string().optional(),\n input: z.unknown().optional().describe('Input validation schema'),\n output: z.unknown().optional().describe('Output schema'),\n })).optional().describe('Exposed server actions'),\n\n /**\n * Register Storage Drivers.\n * Enables connecting to new types of datasources.\n */\n drivers: z.array(z.object({\n id: z.string().describe('Driver unique identifier (e.g. \"postgres\", \"mongo\")'),\n label: z.string().describe('Human readable name'),\n description: z.string().optional(),\n })).optional().describe('Driver contributions'),\n\n /**\n * Register Custom Field Types.\n * Extends the data model with new widget types.\n */\n fieldTypes: z.array(z.object({\n name: z.string().describe('Unique field type name (e.g. \"vector\")'),\n label: z.string().describe('Display label'),\n description: z.string().optional(),\n })).optional().describe('Field Type contributions'),\n \n /**\n * Register Custom Query Operators/Functions.\n * Extends ObjectQL with new functions (e.g. distance()).\n */\n functions: z.array(z.object({\n name: z.string().describe('Function name (e.g. \"distance\")'),\n description: z.string().optional(),\n args: z.array(z.string()).optional().describe('Argument types'),\n returnType: z.string().optional(),\n })).optional().describe('Query Function contributions'),\n\n /**\n * Register API Route Namespaces.\n * Declares the API endpoints this plugin provides to the HttpDispatcher.\n * The kernel routes matching prefixes to this plugin's handler.\n * \n * @example\n * routes: [\n * { prefix: '/api/v1/ai', service: 'ai', methods: ['aiNlq', 'aiChat'] }\n * ]\n */\n routes: z.array(z.object({\n /** URL path prefix (e.g. \"/api/v1/ai\") */\n prefix: z.string().regex(/^\\//).describe('API path prefix'),\n /** Service name this plugin provides */\n service: z.string().describe('Service name this plugin provides'),\n /** Protocol method names implemented */\n methods: z.array(z.string()).optional()\n .describe('Protocol method names implemented (e.g. [\"aiNlq\", \"aiChat\"])'),\n })).optional().describe('API route contributions to HttpDispatcher'),\n }).optional().describe('Platform contributions'),\n\n /** \n * Initial data seeding configuration.\n * Defines default records to be inserted when the package is installed.\n * \n * Uses the standard DatasetSchema which supports idempotent upsert via\n * `externalId`, environment scoping via `env`, and multiple conflict\n * resolution modes.\n * \n * @deprecated Prefer using the top-level `data` field on the Stack Definition\n * (defineStack({ data: [...] })) for better visibility and metadata registration.\n * This field is retained for backward compatibility with manifest-only packages.\n */\n data: z.array(DatasetSchema).optional().describe('Initial seed data (prefer top-level data field)'),\n\n /**\n * Plugin Capability Manifest.\n * Declares protocols implemented, interfaces provided, dependencies, and extension points.\n * This enables plugin interoperability and automatic discovery.\n */\n capabilities: PluginCapabilityManifestSchema.optional()\n .describe('Plugin capability declarations for interoperability'),\n\n /** \n * Extension points contributed by this package.\n * Allows packages to extend UI components, add functionality, etc.\n */\n extensions: z.record(z.string(), z.unknown()).optional().describe('Extension points and contributions'),\n\n /**\n * Plugin Loading Configuration.\n * Configures how the plugin is loaded, initialized, and managed at runtime.\n * Includes strategies for lazy loading, code splitting, caching, and hot reload.\n */\n loading: PluginLoadingConfigSchema.optional()\n .describe('Plugin loading and runtime behavior configuration'),\n});\n\n/**\n * TypeScript type inferred from the ManifestSchema.\n * Use this type for type-safe manifest handling in TypeScript code.\n */\nexport type ObjectStackManifest = z.infer<typeof ManifestSchema>;\nexport type ObjectStackManifestInput = z.input<typeof ManifestSchema>;\n\n","// Copyright (c) 2025 ObjectStack. Licensed under the Apache-2.0 license.\n\nimport { z } from 'zod';\n\n/**\n * # Plugin Capability Protocol\n * \n * Defines the standard way plugins declare their capabilities, implementations,\n * and conformance levels to ensure interoperability across vendors.\n * \n * Based on the Protocol-Oriented Architecture pattern similar to:\n * - Kubernetes CRDs (Custom Resource Definitions)\n * - OSGi Service Registry\n * - Eclipse Extension Points\n */\n\n/**\n * Capability Conformance Level\n * Indicates how completely a plugin implements a given protocol.\n */\nexport const CapabilityConformanceLevelSchema = z.enum([\n 'full', // Complete implementation of all protocol features\n 'partial', // Subset implementation with specific features listed\n 'experimental', // Unstable/preview implementation\n 'deprecated', // Still supported but scheduled for removal\n]).describe('Level of protocol conformance');\n\n/**\n * Protocol Version Schema\n * Uses semantic versioning to track protocol evolution.\n */\nexport const ProtocolVersionSchema = z.object({\n major: z.number().int().min(0),\n minor: z.number().int().min(0),\n patch: z.number().int().min(0),\n}).describe('Semantic version of the protocol');\n\n/**\n * Protocol Reference\n * Uniquely identifies a protocol/interface that a plugin can implement.\n * \n * Examples:\n * - com.objectstack.protocol.storage.v1\n * - com.objectstack.protocol.auth.oauth2.v2\n * - com.acme.protocol.payment.stripe.v1\n */\nexport const ProtocolReferenceSchema = z.object({\n /**\n * Protocol identifier using reverse domain notation.\n * Format: {domain}.protocol.{category}.{name}[.{subcategory}].v{major}\n */\n id: z.string()\n .regex(/^([a-z][a-z0-9]*\\.)+protocol\\.[a-z][a-z0-9._]*\\.v\\d+$/)\n .describe('Unique protocol identifier (e.g., com.objectstack.protocol.storage.v1)'),\n \n /**\n * Human-readable protocol name\n */\n label: z.string(),\n \n /**\n * Protocol version\n */\n version: ProtocolVersionSchema,\n \n /**\n * Detailed protocol specification URL or file reference\n */\n specification: z.string().optional().describe('URL or path to protocol specification'),\n \n /**\n * Brief description of what this protocol defines\n */\n description: z.string().optional(),\n});\n\n/**\n * Protocol Feature\n * Represents a specific capability within a protocol.\n */\nexport const ProtocolFeatureSchema = z.object({\n name: z.string().describe('Feature identifier within the protocol'),\n enabled: z.boolean().default(true),\n description: z.string().optional(),\n sinceVersion: z.string().optional().describe('Version when this feature was added'),\n deprecatedSince: z.string().optional().describe('Version when deprecated'),\n});\n\n/**\n * Plugin Capability Declaration\n * Documents what protocols a plugin implements and to what extent.\n */\nexport const PluginCapabilitySchema = z.object({\n /**\n * The protocol being implemented\n */\n protocol: ProtocolReferenceSchema,\n \n /**\n * Conformance level\n */\n conformance: CapabilityConformanceLevelSchema.default('full'),\n \n /**\n * Specific features implemented (required if conformance is 'partial')\n */\n implementedFeatures: z.array(z.string()).optional().describe('List of implemented feature names'),\n \n /**\n * Optional feature flags indicating advanced capabilities\n */\n features: z.array(ProtocolFeatureSchema).optional(),\n \n /**\n * Custom metadata for vendor-specific information\n */\n metadata: z.record(z.string(), z.unknown()).optional(),\n \n /**\n * Testing/Certification status\n */\n certified: z.boolean().default(false).describe('Has passed official conformance tests'),\n certificationDate: z.string().datetime().optional(),\n});\n\n/**\n * Plugin Interface Declaration\n * Defines the contract for services this plugin provides to other plugins.\n */\nexport const PluginInterfaceSchema = z.object({\n /**\n * Unique interface identifier\n * Format: {plugin-id}.interface.{name}\n */\n id: z.string()\n .regex(/^([a-z][a-z0-9]*\\.)+interface\\.[a-z][a-z0-9._]+$/)\n .describe('Unique interface identifier'),\n \n /**\n * Interface name\n */\n name: z.string(),\n \n /**\n * Description of what this interface provides\n */\n description: z.string().optional(),\n \n /**\n * Interface version\n */\n version: ProtocolVersionSchema,\n \n /**\n * Methods exposed by this interface\n */\n methods: z.array(z.object({\n name: z.string().describe('Method name'),\n description: z.string().optional(),\n parameters: z.array(z.object({\n name: z.string(),\n type: z.string().describe('Type notation (e.g., string, number, User)'),\n required: z.boolean().default(true),\n description: z.string().optional(),\n })).optional(),\n returnType: z.string().optional().describe('Return value type'),\n async: z.boolean().default(false).describe('Whether method returns a Promise'),\n })),\n \n /**\n * Events emitted by this interface\n */\n events: z.array(z.object({\n name: z.string().describe('Event name'),\n description: z.string().optional(),\n payload: z.string().optional().describe('Event payload type'),\n })).optional(),\n \n /**\n * Stability level\n */\n stability: z.enum(['stable', 'beta', 'alpha', 'experimental']).default('stable'),\n});\n\n/**\n * Plugin Dependency Declaration\n * Specifies what other plugins or capabilities this plugin requires.\n */\nexport const PluginDependencySchema = z.object({\n /**\n * Plugin ID using reverse domain notation\n */\n pluginId: z.string()\n .regex(/^([a-z][a-z0-9]*\\.)+[a-z][a-z0-9-]+$/)\n .describe('Required plugin identifier'),\n \n /**\n * Version constraint (supports semver ranges)\n * Examples: \"1.0.0\", \"^1.2.3\", \">=2.0.0 <3.0.0\"\n */\n version: z.string().describe('Semantic version constraint'),\n \n /**\n * Whether this dependency is optional\n */\n optional: z.boolean().default(false),\n \n /**\n * Reason for the dependency\n */\n reason: z.string().optional(),\n \n /**\n * Minimum required capabilities from the dependency\n */\n requiredCapabilities: z.array(z.string()).optional().describe('Protocol IDs the dependency must support'),\n});\n\n/**\n * Extension Point Declaration\n * Defines hooks where other plugins can extend this plugin's functionality.\n */\nexport const ExtensionPointSchema = z.object({\n /**\n * Extension point identifier\n */\n id: z.string()\n .regex(/^([a-z][a-z0-9]*\\.)+extension\\.[a-z][a-z0-9._]+$/)\n .describe('Unique extension point identifier'),\n \n /**\n * Extension point name\n */\n name: z.string(),\n \n /**\n * Description\n */\n description: z.string().optional(),\n \n /**\n * Type of extension point\n */\n type: z.enum([\n 'action', // Plugins can register executable actions\n 'hook', // Plugins can listen to lifecycle events\n 'widget', // Plugins can contribute UI widgets\n 'provider', // Plugins can provide data/services\n 'transformer', // Plugins can transform data\n 'validator', // Plugins can validate data\n 'decorator', // Plugins can enhance/wrap functionality\n ]),\n \n /**\n * Expected interface contract for extensions\n */\n contract: z.object({\n input: z.string().optional().describe('Input type/schema'),\n output: z.string().optional().describe('Output type/schema'),\n signature: z.string().optional().describe('Function signature if applicable'),\n }).optional(),\n \n /**\n * Cardinality\n */\n cardinality: z.enum(['single', 'multiple']).default('multiple')\n .describe('Whether multiple extensions can register to this point'),\n});\n\n/**\n * Complete Plugin Capability Manifest\n * This is included in the main plugin manifest to declare all capabilities.\n */\nexport const PluginCapabilityManifestSchema = z.object({\n /**\n * Protocols this plugin implements\n */\n implements: z.array(PluginCapabilitySchema).optional()\n .describe('List of protocols this plugin conforms to'),\n \n /**\n * Interfaces this plugin exposes to other plugins\n */\n provides: z.array(PluginInterfaceSchema).optional()\n .describe('Services/APIs this plugin offers to others'),\n \n /**\n * Dependencies on other plugins\n */\n requires: z.array(PluginDependencySchema).optional()\n .describe('Required plugins and their capabilities'),\n \n /**\n * Extension points this plugin defines\n */\n extensionPoints: z.array(ExtensionPointSchema).optional()\n .describe('Points where other plugins can extend this plugin'),\n \n /**\n * Extensions this plugin contributes to other plugins\n */\n extensions: z.array(z.object({\n targetPluginId: z.string().describe('Plugin ID being extended'),\n extensionPointId: z.string().describe('Extension point identifier'),\n implementation: z.string().describe('Path to implementation module'),\n priority: z.number().int().default(100).describe('Registration priority (lower = higher priority)'),\n })).optional().describe('Extensions contributed to other plugins'),\n});\n\n// Export types\nexport type CapabilityConformanceLevel = z.infer<typeof CapabilityConformanceLevelSchema>;\nexport type ProtocolVersion = z.infer<typeof ProtocolVersionSchema>;\nexport type ProtocolReference = z.infer<typeof ProtocolReferenceSchema>;\nexport type ProtocolFeature = z.infer<typeof ProtocolFeatureSchema>;\nexport type PluginCapability = z.infer<typeof PluginCapabilitySchema>;\nexport type PluginInterface = z.infer<typeof PluginInterfaceSchema>;\nexport type PluginDependency = z.infer<typeof PluginDependencySchema>;\nexport type ExtensionPoint = z.infer<typeof ExtensionPointSchema>;\nexport type PluginCapabilityManifest = z.infer<typeof PluginCapabilityManifestSchema>;\n","// Copyright (c) 2025 ObjectStack. Licensed under the Apache-2.0 license.\n\nimport { z } from 'zod';\n\n/**\n * # Plugin Loading Protocol\n * \n * Defines the enhanced plugin loading mechanism for the microkernel architecture.\n * Inspired by industry best practices from:\n * - Kubernetes CRDs and Operators\n * - OSGi Dynamic Module System\n * - Eclipse Plugin Framework\n * - Webpack Module Federation\n * \n * This protocol enables:\n * - Lazy loading and code splitting\n * - Dynamic imports and parallel initialization\n * - Capability-based discovery\n * - Hot reload in development\n * - Advanced caching strategies\n */\n\n/**\n * Plugin Loading Strategy\n * Determines how and when a plugin is loaded into memory\n */\nexport const PluginLoadingStrategySchema = z.enum([\n 'eager', // Load immediately during bootstrap (critical plugins)\n 'lazy', // Load on first use (feature plugins)\n 'parallel', // Load in parallel with other plugins\n 'deferred', // Load after initial bootstrap complete\n 'on-demand', // Load only when explicitly requested\n]).describe('Plugin loading strategy');\n\n/**\n * Plugin Preloading Configuration\n * Configures preloading behavior for faster activation\n */\nexport const PluginPreloadConfigSchema = z.object({\n /**\n * Enable preloading for this plugin\n */\n enabled: z.boolean().default(false),\n \n /**\n * Preload priority (lower = higher priority)\n */\n priority: z.number().int().min(0).default(100),\n \n /**\n * Resources to preload\n */\n resources: z.array(z.enum([\n 'metadata', // Plugin manifest and metadata\n 'dependencies', // Plugin dependencies\n 'assets', // Static assets (icons, translations)\n 'code', // JavaScript code chunks\n 'services', // Service definitions\n ])).optional(),\n \n /**\n * Conditions for preloading\n */\n conditions: z.object({\n /**\n * Preload only on specific routes\n */\n routes: z.array(z.string()).optional(),\n \n /**\n * Preload only for specific user roles\n */\n roles: z.array(z.string()).optional(),\n \n /**\n * Preload based on device type\n */\n deviceType: z.array(z.enum(['desktop', 'mobile', 'tablet'])).optional(),\n \n /**\n * Network connection quality threshold\n */\n minNetworkSpeed: z.enum(['slow-2g', '2g', '3g', '4g']).optional(),\n }).optional(),\n}).describe('Plugin preloading configuration');\n\n/**\n * Plugin Code Splitting Configuration\n * Configures how plugin code is split for optimal loading\n */\nexport const PluginCodeSplittingSchema = z.object({\n /**\n * Enable code splitting for this plugin\n */\n enabled: z.boolean().default(true),\n \n /**\n * Split strategy\n */\n strategy: z.enum([\n 'route', // Split by UI routes\n 'feature', // Split by feature modules\n 'size', // Split by bundle size threshold\n 'custom', // Custom split points defined by plugin\n ]).default('feature'),\n \n /**\n * Chunk naming strategy\n */\n chunkNaming: z.enum(['hashed', 'named', 'sequential']).default('hashed'),\n \n /**\n * Maximum chunk size in KB\n */\n maxChunkSize: z.number().int().min(10).optional().describe('Max chunk size in KB'),\n \n /**\n * Shared dependencies optimization\n */\n sharedDependencies: z.object({\n enabled: z.boolean().default(true),\n /**\n * Minimum times a module must be shared before extraction\n */\n minChunks: z.number().int().min(1).default(2),\n }).optional(),\n}).describe('Plugin code splitting configuration');\n\n/**\n * Plugin Dynamic Import Configuration\n * Configures dynamic import behavior for runtime module loading\n */\nexport const PluginDynamicImportSchema = z.object({\n /**\n * Enable dynamic imports\n */\n enabled: z.boolean().default(true),\n \n /**\n * Import mode\n */\n mode: z.enum([\n 'async', // Asynchronous import (recommended)\n 'sync', // Synchronous import (blocking)\n 'eager', // Eager evaluation\n 'lazy', // Lazy evaluation\n ]).default('async'),\n \n /**\n * Prefetch strategy\n */\n prefetch: z.boolean().default(false).describe('Prefetch module in idle time'),\n \n /**\n * Preload strategy\n */\n preload: z.boolean().default(false).describe('Preload module in parallel with parent'),\n \n /**\n * Webpack magic comments support\n */\n webpackChunkName: z.string().optional().describe('Custom chunk name for webpack'),\n \n /**\n * Import timeout in milliseconds\n */\n timeout: z.number().int().min(100).default(30000).describe('Dynamic import timeout (ms)'),\n \n /**\n * Retry configuration on import failure\n */\n retry: z.object({\n enabled: z.boolean().default(true),\n maxAttempts: z.number().int().min(1).max(10).default(3),\n backoffMs: z.number().int().min(0).default(1000).describe('Exponential backoff base delay'),\n }).optional(),\n}).describe('Plugin dynamic import configuration');\n\n/**\n * Plugin Initialization Configuration\n * Configures how plugin initialization is executed\n */\nexport const PluginInitializationSchema = z.object({\n /**\n * Initialization mode\n */\n mode: z.enum([\n 'sync', // Synchronous initialization\n 'async', // Asynchronous initialization\n 'parallel', // Parallel with other plugins\n 'sequential', // Must complete before next plugin\n ]).default('async'),\n \n /**\n * Initialization timeout in milliseconds\n */\n timeout: z.number().int().min(100).default(30000),\n \n /**\n * Startup priority (lower = higher priority, earlier initialization)\n */\n priority: z.number().int().min(0).default(100),\n \n /**\n * Whether to continue bootstrap if this plugin fails\n */\n critical: z.boolean().default(false).describe('If true, kernel bootstrap fails if plugin fails'),\n \n /**\n * Retry configuration on initialization failure\n */\n retry: z.object({\n enabled: z.boolean().default(false),\n maxAttempts: z.number().int().min(1).max(5).default(3),\n backoffMs: z.number().int().min(0).default(1000),\n }).optional(),\n \n /**\n * Health check interval for monitoring\n */\n healthCheckInterval: z.number().int().min(0).optional().describe('Health check interval in ms (0 = disabled)'),\n}).describe('Plugin initialization configuration');\n\n/**\n * Plugin Dependency Resolution Configuration\n * Advanced dependency resolution using semantic versioning\n */\nexport const PluginDependencyResolutionSchema = z.object({\n /**\n * Dependency resolution strategy\n */\n strategy: z.enum([\n 'strict', // Exact version match required\n 'compatible', // Semver compatible versions (^)\n 'latest', // Always use latest compatible\n 'pinned', // Lock to specific version\n ]).default('compatible'),\n \n /**\n * Peer dependency handling\n */\n peerDependencies: z.object({\n /**\n * Whether to resolve peer dependencies\n */\n resolve: z.boolean().default(true),\n \n /**\n * Action on missing peer dependency\n */\n onMissing: z.enum(['error', 'warn', 'ignore']).default('warn'),\n \n /**\n * Action on peer version mismatch\n */\n onMismatch: z.enum(['error', 'warn', 'ignore']).default('warn'),\n }).optional(),\n \n /**\n * Optional dependency handling\n */\n optionalDependencies: z.object({\n /**\n * Whether to attempt loading optional dependencies\n */\n load: z.boolean().default(true),\n \n /**\n * Action on optional dependency load failure\n */\n onFailure: z.enum(['warn', 'ignore']).default('warn'),\n }).optional(),\n \n /**\n * Conflict resolution\n */\n conflictResolution: z.enum([\n 'fail', // Fail on any version conflict\n 'latest', // Use latest version\n 'oldest', // Use oldest version\n 'manual', // Require manual resolution\n ]).default('latest'),\n \n /**\n * Circular dependency handling\n */\n circularDependencies: z.enum([\n 'error', // Throw error on circular dependency\n 'warn', // Warn but continue\n 'allow', // Allow circular dependencies\n ]).default('warn'),\n}).describe('Plugin dependency resolution configuration');\n\n/**\n * Plugin Hot Reload Configuration\n * Enables hot module replacement for development and production environments.\n * \n * Production mode adds safety features: health validation, rollback on failure,\n * connection draining, and concurrency control for zero-downtime reloads.\n */\nexport const PluginHotReloadSchema = z.object({\n /**\n * Enable hot reload\n */\n enabled: z.boolean().default(false),\n \n /**\n * Target environment for hot reload behavior\n */\n environment: z.enum([\n 'development', // Fast reload with relaxed safety (file watchers, no health validation)\n 'staging', // Production-like reload with validation but relaxed rollback\n 'production', // Full safety: health validation, rollback, connection draining\n ]).default('development').describe('Target environment controlling safety level'),\n \n /**\n * Hot reload strategy\n */\n strategy: z.enum([\n 'full', // Full plugin reload (destroy and reinitialize)\n 'partial', // Partial reload (update changed modules only)\n 'state-preserve', // Preserve plugin state during reload\n ]).default('full'),\n \n /**\n * Files to watch for changes\n */\n watchPatterns: z.array(z.string()).optional().describe('Glob patterns for files to watch'),\n \n /**\n * Files to ignore\n */\n ignorePatterns: z.array(z.string()).optional().describe('Glob patterns for files to ignore'),\n \n /**\n * Debounce delay in milliseconds\n */\n debounceMs: z.number().int().min(0).default(300),\n \n /**\n * Whether to preserve state during reload\n */\n preserveState: z.boolean().default(false),\n \n /**\n * State serialization\n */\n stateSerialization: z.object({\n enabled: z.boolean().default(false),\n /**\n * Path to state serialization handler\n */\n handler: z.string().optional(),\n }).optional(),\n \n /**\n * Hooks for hot reload lifecycle\n */\n hooks: z.object({\n beforeReload: z.string().optional().describe('Function to call before reload'),\n afterReload: z.string().optional().describe('Function to call after reload'),\n onError: z.string().optional().describe('Function to call on reload error'),\n }).optional(),\n \n /**\n * Production safety configuration\n * Applied when environment is 'staging' or 'production'\n */\n productionSafety: z.object({\n /**\n * Validate plugin health before completing reload\n */\n healthValidation: z.boolean().default(true)\n .describe('Run health checks after reload before accepting traffic'),\n \n /**\n * Automatically rollback to previous version on reload failure\n */\n rollbackOnFailure: z.boolean().default(true)\n .describe('Auto-rollback if reloaded plugin fails health check'),\n \n /**\n * Maximum time to wait for health validation after reload (ms)\n */\n healthTimeout: z.number().int().min(1000).default(30000)\n .describe('Health check timeout after reload in ms'),\n \n /**\n * Drain active connections before reload\n */\n drainConnections: z.boolean().default(true)\n .describe('Gracefully drain active requests before reloading'),\n \n /**\n * Maximum time to wait for connection draining (ms)\n */\n drainTimeout: z.number().int().min(0).default(15000)\n .describe('Max wait time for connection draining in ms'),\n \n /**\n * Maximum number of concurrent plugin reloads\n */\n maxConcurrentReloads: z.number().int().min(1).default(1)\n .describe('Limit concurrent reloads to prevent system instability'),\n \n /**\n * Minimum interval between reloads of the same plugin (ms)\n */\n minReloadInterval: z.number().int().min(1000).default(5000)\n .describe('Cooldown period between reloads of the same plugin'),\n }).optional(),\n}).describe('Plugin hot reload configuration');\n\n/**\n * Plugin Caching Configuration\n * Configures caching strategy for faster subsequent loads\n */\nexport const PluginCachingSchema = z.object({\n /**\n * Enable caching\n */\n enabled: z.boolean().default(true),\n \n /**\n * Cache storage type\n */\n storage: z.enum([\n 'memory', // In-memory cache (fastest, not persistent)\n 'disk', // Disk cache (persistent)\n 'indexeddb', // Browser IndexedDB (persistent, browser only)\n 'hybrid', // Memory + Disk hybrid\n ]).default('memory'),\n \n /**\n * Cache key strategy\n */\n keyStrategy: z.enum([\n 'version', // Cache by plugin version\n 'hash', // Cache by content hash\n 'timestamp', // Cache by last modified timestamp\n ]).default('version'),\n \n /**\n * Cache TTL in seconds\n */\n ttl: z.number().int().min(0).optional().describe('Time to live in seconds (0 = infinite)'),\n \n /**\n * Maximum cache size in MB\n */\n maxSize: z.number().int().min(1).optional().describe('Max cache size in MB'),\n \n /**\n * Cache invalidation triggers\n */\n invalidateOn: z.array(z.enum([\n 'version-change',\n 'dependency-change',\n 'manual',\n 'error',\n ])).optional(),\n \n /**\n * Compression\n */\n compression: z.object({\n enabled: z.boolean().default(false),\n algorithm: z.enum(['gzip', 'brotli', 'deflate']).default('gzip'),\n }).optional(),\n}).describe('Plugin caching configuration');\n\n/**\n * Plugin Sandboxing Configuration\n * Security isolation for plugins with configurable scope.\n * \n * Supports isolation beyond automation scripts: any plugin can be sandboxed\n * with process-level isolation and inter-plugin communication (IPC).\n */\nexport const PluginSandboxingSchema = z.object({\n /**\n * Enable sandboxing\n */\n enabled: z.boolean().default(false),\n \n /**\n * Isolation scope - which plugins are subject to sandboxing\n */\n scope: z.enum([\n 'automation-only', // Sandbox automation/scripting plugins only (current behavior)\n 'untrusted-only', // Sandbox plugins below a trust threshold\n 'all-plugins', // Sandbox all plugins (maximum isolation)\n ]).default('automation-only').describe('Which plugins are subject to isolation'),\n \n /**\n * Sandbox isolation level\n */\n isolationLevel: z.enum([\n 'none', // No isolation\n 'process', // Separate process (Node.js worker threads)\n 'vm', // VM context isolation\n 'iframe', // iframe isolation (browser)\n 'web-worker', // Web Worker (browser)\n ]).default('none'),\n \n /**\n * Allowed capabilities\n */\n allowedCapabilities: z.array(z.string()).optional().describe('List of allowed capability IDs'),\n \n /**\n * Resource quotas\n */\n resourceQuotas: z.object({\n /**\n * Maximum memory usage in MB\n */\n maxMemoryMB: z.number().int().min(1).optional(),\n \n /**\n * Maximum CPU time in milliseconds\n */\n maxCpuTimeMs: z.number().int().min(100).optional(),\n \n /**\n * Maximum number of file descriptors\n */\n maxFileDescriptors: z.number().int().min(1).optional(),\n \n /**\n * Maximum network bandwidth in KB/s\n */\n maxNetworkKBps: z.number().int().min(1).optional(),\n }).optional(),\n \n /**\n * Permissions\n */\n permissions: z.object({\n /**\n * Allowed API access\n */\n allowedAPIs: z.array(z.string()).optional(),\n \n /**\n * Allowed file system paths\n */\n allowedPaths: z.array(z.string()).optional(),\n \n /**\n * Allowed network endpoints\n */\n allowedEndpoints: z.array(z.string()).optional(),\n \n /**\n * Allowed environment variables\n */\n allowedEnvVars: z.array(z.string()).optional(),\n }).optional(),\n \n /**\n * Inter-Plugin Communication (IPC) configuration\n * Enables isolated plugins to communicate with the kernel and other plugins\n */\n ipc: z.object({\n /**\n * Enable IPC for sandboxed plugins\n */\n enabled: z.boolean().default(true)\n .describe('Allow sandboxed plugins to communicate via IPC'),\n \n /**\n * IPC transport mechanism\n */\n transport: z.enum([\n 'message-port', // MessagePort (worker threads / Web Workers)\n 'unix-socket', // Unix domain sockets (process isolation)\n 'tcp', // TCP sockets (container isolation)\n 'memory', // Shared memory channel (in-process VM)\n ]).default('message-port')\n .describe('IPC transport for cross-boundary communication'),\n \n /**\n * Maximum message size in bytes\n */\n maxMessageSize: z.number().int().min(1024).default(1048576)\n .describe('Maximum IPC message size in bytes (default 1MB)'),\n \n /**\n * Message timeout in milliseconds\n */\n timeout: z.number().int().min(100).default(30000)\n .describe('IPC message response timeout in ms'),\n \n /**\n * Allowed service calls through IPC\n */\n allowedServices: z.array(z.string()).optional()\n .describe('Service names the sandboxed plugin may invoke via IPC'),\n }).optional(),\n}).describe('Plugin sandboxing configuration');\n\n/**\n * Plugin Performance Monitoring Configuration\n * Telemetry and performance tracking\n */\nexport const PluginPerformanceMonitoringSchema = z.object({\n /**\n * Enable performance monitoring\n */\n enabled: z.boolean().default(false),\n \n /**\n * Metrics to collect\n */\n metrics: z.array(z.enum([\n 'load-time',\n 'init-time',\n 'memory-usage',\n 'cpu-usage',\n 'api-calls',\n 'error-rate',\n 'cache-hit-rate',\n ])).optional(),\n \n /**\n * Sampling rate (0-1, where 1 = 100%)\n */\n samplingRate: z.number().min(0).max(1).default(1),\n \n /**\n * Reporting interval in seconds\n */\n reportingInterval: z.number().int().min(1).default(60),\n \n /**\n * Performance budget thresholds\n */\n budgets: z.object({\n /**\n * Maximum load time in milliseconds\n */\n maxLoadTimeMs: z.number().int().min(0).optional(),\n \n /**\n * Maximum init time in milliseconds\n */\n maxInitTimeMs: z.number().int().min(0).optional(),\n \n /**\n * Maximum memory usage in MB\n */\n maxMemoryMB: z.number().int().min(0).optional(),\n }).optional(),\n \n /**\n * Action on budget violation\n */\n onBudgetViolation: z.enum(['warn', 'error', 'ignore']).default('warn'),\n}).describe('Plugin performance monitoring configuration');\n\n/**\n * Complete Plugin Loading Configuration\n * Combines all loading-related configurations\n */\nexport const PluginLoadingConfigSchema = z.object({\n /**\n * Loading strategy\n */\n strategy: PluginLoadingStrategySchema.default('lazy'),\n \n /**\n * Preloading configuration\n */\n preload: PluginPreloadConfigSchema.optional(),\n \n /**\n * Code splitting configuration\n */\n codeSplitting: PluginCodeSplittingSchema.optional(),\n \n /**\n * Dynamic import configuration\n */\n dynamicImport: PluginDynamicImportSchema.optional(),\n \n /**\n * Initialization configuration\n */\n initialization: PluginInitializationSchema.optional(),\n \n /**\n * Dependency resolution configuration\n */\n dependencyResolution: PluginDependencyResolutionSchema.optional(),\n \n /**\n * Hot reload configuration (development and production)\n */\n hotReload: PluginHotReloadSchema.optional(),\n \n /**\n * Caching configuration\n */\n caching: PluginCachingSchema.optional(),\n \n /**\n * Sandboxing configuration\n */\n sandboxing: PluginSandboxingSchema.optional(),\n \n /**\n * Performance monitoring\n */\n monitoring: PluginPerformanceMonitoringSchema.optional(),\n}).describe('Complete plugin loading configuration');\n\n/**\n * Plugin Loading Event\n * Emitted during plugin loading lifecycle\n */\nexport const PluginLoadingEventSchema = z.object({\n /**\n * Event type\n */\n type: z.enum([\n 'load-started',\n 'load-completed',\n 'load-failed',\n 'init-started',\n 'init-completed',\n 'init-failed',\n 'preload-started',\n 'preload-completed',\n 'cache-hit',\n 'cache-miss',\n 'hot-reload',\n 'dynamic-load', // Plugin loaded at runtime\n 'dynamic-unload', // Plugin unloaded at runtime\n 'dynamic-discover', // Plugin discovered via registry\n ]),\n \n /**\n * Plugin identifier\n */\n pluginId: z.string(),\n \n /**\n * Timestamp\n */\n timestamp: z.number().int().min(0),\n \n /**\n * Duration in milliseconds\n */\n durationMs: z.number().int().min(0).optional(),\n \n /**\n * Additional metadata\n */\n metadata: z.record(z.string(), z.unknown()).optional(),\n \n /**\n * Error if event represents a failure\n */\n error: z.object({\n message: z.string(),\n code: z.string().optional(),\n stack: z.string().optional(),\n }).optional(),\n}).describe('Plugin loading lifecycle event');\n\n/**\n * Plugin Loading State\n * Tracks the current loading state of a plugin\n */\nexport const PluginLoadingStateSchema = z.object({\n /**\n * Plugin identifier\n */\n pluginId: z.string(),\n \n /**\n * Current state\n */\n state: z.enum([\n 'pending', // Not yet loaded\n 'loading', // Currently loading\n 'loaded', // Code loaded, not initialized\n 'initializing', // Currently initializing\n 'ready', // Fully initialized and ready\n 'failed', // Failed to load or initialize\n 'reloading', // Hot reloading in progress\n 'unloading', // Being unloaded at runtime\n 'unloaded', // Successfully unloaded (dynamic loading)\n ]),\n \n /**\n * Load progress (0-100)\n */\n progress: z.number().min(0).max(100).default(0),\n \n /**\n * Loading start time\n */\n startedAt: z.number().int().min(0).optional(),\n \n /**\n * Loading completion time\n */\n completedAt: z.number().int().min(0).optional(),\n \n /**\n * Last error\n */\n lastError: z.string().optional(),\n \n /**\n * Retry count\n */\n retryCount: z.number().int().min(0).default(0),\n}).describe('Plugin loading state');\n\n// Export types\nexport type PluginLoadingStrategy = z.infer<typeof PluginLoadingStrategySchema>;\nexport type PluginPreloadConfig = z.infer<typeof PluginPreloadConfigSchema>;\nexport type PluginCodeSplitting = z.infer<typeof PluginCodeSplittingSchema>;\nexport type PluginDynamicImport = z.infer<typeof PluginDynamicImportSchema>;\nexport type PluginInitialization = z.infer<typeof PluginInitializationSchema>;\nexport type PluginDependencyResolution = z.infer<typeof PluginDependencyResolutionSchema>;\nexport type PluginHotReload = z.infer<typeof PluginHotReloadSchema>;\nexport type PluginCaching = z.infer<typeof PluginCachingSchema>;\nexport type PluginSandboxing = z.infer<typeof PluginSandboxingSchema>;\nexport type PluginPerformanceMonitoring = z.infer<typeof PluginPerformanceMonitoringSchema>;\nexport type PluginLoadingConfig = z.infer<typeof PluginLoadingConfigSchema>;\nexport type PluginLoadingEvent = z.infer<typeof PluginLoadingEventSchema>;\nexport type PluginLoadingState = z.infer<typeof PluginLoadingStateSchema>;\n","// Copyright (c) 2025 ObjectStack. Licensed under the Apache-2.0 license.\n\nimport { z } from 'zod';\n\n// Service method interfaces use z.function() instead of z.any() for type safety.\n// Generic data fields use z.unknown() for type safety.\nexport const PluginContextSchema = z.object({\n ql: z.object({\n object: z.function().describe('Get object handle for method chaining'),\n query: z.function().describe('Execute a query'),\n }).passthrough().describe('ObjectQL Engine Interface'),\n\n os: z.object({\n getCurrentUser: z.function().describe('Get the current authenticated user'),\n getConfig: z.function().describe('Get platform configuration'),\n }).passthrough().describe('ObjectStack Kernel Interface'),\n\n logger: z.object({\n debug: z.function().describe('Log debug message'),\n info: z.function().describe('Log info message'),\n warn: z.function().describe('Log warning message'),\n error: z.function().describe('Log error message'),\n }).passthrough().describe('Logger Interface'),\n\n storage: z.object({\n get: z.function().describe('Get a value from storage'),\n set: z.function().describe('Set a value in storage'),\n delete: z.function().describe('Delete a value from storage'),\n }).passthrough().describe('Storage Interface'),\n\n i18n: z.object({\n t: z.function().describe('Translate a key'),\n getLocale: z.function().describe('Get current locale'),\n }).passthrough().describe('Internationalization Interface'),\n\n metadata: z.record(z.string(), z.unknown()),\n events: z.record(z.string(), z.unknown()),\n \n app: z.object({\n router: z.object({\n get: z.function().describe('Register GET route handler'),\n post: z.function().describe('Register POST route handler'),\n use: z.function().describe('Register middleware'),\n }).passthrough()\n }).passthrough().describe('App Framework Interface'),\n\n drivers: z.object({\n register: z.function().describe('Register a driver'),\n }).passthrough().describe('Driver Registry'),\n});\n\nexport type PluginContextData = z.infer<typeof PluginContextSchema>;\nexport type PluginContext = PluginContextData;\n\nexport const PluginLifecycleSchema = z.object({\n onInstall: z.function().optional().describe('Called when plugin is installed'),\n \n onEnable: z.function().optional().describe('Called when plugin is enabled'),\n \n onDisable: z.function().optional().describe('Called when plugin is disabled'),\n \n onUninstall: z.function().optional().describe('Called when plugin is uninstalled'),\n \n onUpgrade: z.function().optional().describe('Called when plugin is upgraded'),\n});\n\nexport type PluginLifecycleHooks = z.infer<typeof PluginLifecycleSchema>;\n\n/**\n * Shared Plugin Types\n * These are the specialized plugin types common between Manifest (Package) and Plugin (Runtime).\n */\nexport const CORE_PLUGIN_TYPES = [\n 'ui', // Frontend: Serves static assets/SPA (e.g. Console, Studio)\n 'driver', // Connectivity: Database or Storage adapters (e.g. SQL, S3)\n 'server', // Protocol: HTTP/RPC Servers (e.g. Hono, GraphQL)\n 'app', // Business: Vertical Solution Bundle (Metadata + Logic)\n 'theme', // Appearance: UI Overrides & CSS Variables\n 'agent', // AI: Autonomous Agent & Tool Definitions\n 'objectql' // Core: ObjectQL Engine Data Provider\n] as const;\n\nexport const PluginSchema = PluginLifecycleSchema.extend({\n id: z.string().min(1).optional().describe('Unique Plugin ID (e.g. com.example.crm)'),\n type: z.enum([\n 'standard', // Default: General purpose backend logic (Service, Hook, etc.)\n ...CORE_PLUGIN_TYPES\n ]).default('standard').optional().describe('Plugin Type categorization for runtime behavior'),\n \n staticPath: z.string().optional().describe('Absolute path to static assets (Required for type=\"ui-plugin\")'),\n slug: z.string().regex(/^[a-z0-9-_]+$/).optional().describe('URL path segment (Required for type=\"ui-plugin\")'),\n default: z.boolean().optional().describe('Serve at root path (Only one \"ui-plugin\" can be default)'),\n \n version: z.string().regex(/^\\d+\\.\\d+\\.\\d+$/).optional().describe('Semantic Version'),\n description: z.string().optional(),\n author: z.string().optional(),\n homepage: z.string().url().optional(),\n});\n\nexport type PluginDefinition = z.infer<typeof PluginSchema>;\n\n/**\n * Define an ObjectStack Plugin\n * Helper function for creating type-safe plugin definitions\n * @deprecated Move to @objectstack/core. Will be removed from spec in v2.0.0\n */\nexport function definePlugin(config: PluginDefinition): PluginDefinition {\n return config;\n}\n","// Copyright (c) 2025 ObjectStack. Licensed under the Apache-2.0 license.\n\nimport { z } from 'zod';\n\n/**\n * Data Import Strategy\n * Defines how the engine handles existing records.\n */\nexport const DatasetMode = z.enum([\n 'insert', // Try to insert, fail on duplicate\n 'update', // Only update found records, ignore new\n 'upsert', // Create new or Update existing (Standard)\n 'replace', // Delete ALL records in object then insert (Dangerous - use for cache tables)\n 'ignore' // Try to insert, silently skip duplicates\n]);\n\n/**\n * Dataset Schema (Seed Data / Fixtures)\n * \n * Standardized format for transporting data.\n * Used for:\n * 1. System Bootstrapping (Admin accounts, Standard Roles)\n * 2. Reference Data (Countries, Currencies)\n * 3. Demo/Test Data\n */\nexport const DatasetSchema = z.object({\n /** \n * Target Object \n * The machine name of the object to populate.\n */\n object: z.string().regex(/^[a-z_][a-z0-9_]*$/).describe('Target Object Name'),\n\n /** \n * Idempotency Key (The \"Upsert\" Key)\n * The field used to check if a record already exists.\n * Best Practice: Use a natural key like 'code', 'slug', 'username' or 'external_id'.\n * Standard: '_id' (internal ID) is rarely used for portable seed data.\n */\n externalId: z.string().default('name').describe('Field match for uniqueness check'),\n\n /** \n * Import Strategy\n */\n mode: DatasetMode.default('upsert').describe('Conflict resolution strategy'),\n\n /**\n * Environment Scope\n * - 'all': Always load\n * - 'dev': Only for development/demo\n * - 'test': Only for CI/CD tests\n */\n env: z.array(z.enum(['prod', 'dev', 'test'])).default(['prod', 'dev', 'test']).describe('Applicable environments'),\n\n /** \n * The Payload\n * Array of raw JSON objects matching the Object Schema.\n */\n records: z.array(z.record(z.string(), z.unknown())).describe('Data records'),\n});\n\n/** Parsed/output type — all defaults are applied (env, mode, externalId always present) */\nexport type Dataset = z.infer<typeof DatasetSchema>;\n\n/** Input type — fields with defaults (env, mode, externalId) are optional */\nexport type DatasetInput = z.input<typeof DatasetSchema>;\n\nexport type DatasetImportMode = z.infer<typeof DatasetMode>;\n","// Copyright (c) 2025 ObjectStack. Licensed under the Apache-2.0 license.\n\nimport { z } from 'zod';\nimport { HttpMethod } from '../shared/http.zod';\n\n/**\n * REST API Server Protocol\n * \n * Defines the REST API server configuration for automatically generating\n * RESTful CRUD endpoints, metadata endpoints, and batch operations.\n * \n * Features:\n * - Automatic CRUD endpoint generation from Object definitions\n * - Standard REST conventions (GET, POST, PUT, PATCH, DELETE)\n * - Metadata API endpoints\n * - Batch operation endpoints\n * - OpenAPI/Swagger documentation generation\n * \n * Architecture alignment:\n * - Salesforce: REST API with Object CRUD\n * - Microsoft Dynamics: Web API with entity operations\n * - Strapi: Auto-generated REST endpoints\n */\n\n// ==========================================\n// REST API Configuration\n// ==========================================\n\n/**\n * REST API Configuration Schema\n * Core configuration for REST API server\n * \n * @example\n * {\n * \"version\": \"v1\",\n * \"basePath\": \"/api\",\n * \"enableCrud\": true,\n * \"enableMetadata\": true,\n * \"enableBatch\": true,\n * \"documentation\": {\n * \"enabled\": true,\n * \"title\": \"ObjectStack API\"\n * }\n * }\n */\nexport const RestApiConfigSchema = z.object({\n /**\n * API version identifier\n */\n version: z.string().regex(/^[a-zA-Z0-9_\\-\\.]+$/).default('v1').describe('API version (e.g., v1, v2, 2024-01)'),\n \n /**\n * Base path for all API routes\n */\n basePath: z.string().default('/api').describe('Base URL path for API'),\n \n /**\n * Full API path (combines basePath and version)\n */\n apiPath: z.string().optional().describe('Full API path (defaults to {basePath}/{version})'),\n \n /**\n * Enable automatic CRUD endpoints\n */\n enableCrud: z.boolean().default(true).describe('Enable automatic CRUD endpoint generation'),\n \n /**\n * Enable metadata endpoints\n */\n enableMetadata: z.boolean().default(true).describe('Enable metadata API endpoints'),\n \n /**\n * Enable UI API endpoints\n */\n enableUi: z.boolean().default(true).describe('Enable UI API endpoints (Views, Menus, Layouts)'),\n \n /**\n * Enable batch operation endpoints\n */\n enableBatch: z.boolean().default(true).describe('Enable batch operation endpoints'),\n \n /**\n * Enable discovery endpoint\n */\n enableDiscovery: z.boolean().default(true).describe('Enable API discovery endpoint'),\n \n /**\n * API documentation configuration\n */\n documentation: z.object({\n enabled: z.boolean().default(true).describe('Enable API documentation'),\n title: z.string().default('ObjectStack API').describe('API documentation title'),\n description: z.string().optional().describe('API description'),\n version: z.string().optional().describe('Documentation version'),\n termsOfService: z.string().optional().describe('Terms of service URL'),\n contact: z.object({\n name: z.string().optional(),\n url: z.string().optional(),\n email: z.string().optional(),\n }).optional(),\n license: z.object({\n name: z.string(),\n url: z.string().optional(),\n }).optional(),\n }).optional().describe('OpenAPI/Swagger documentation config'),\n \n /**\n * Response format configuration\n */\n responseFormat: z.object({\n envelope: z.boolean().default(true).describe('Wrap responses in standard envelope'),\n includeMetadata: z.boolean().default(true).describe('Include response metadata (timestamp, requestId)'),\n includePagination: z.boolean().default(true).describe('Include pagination info in list responses'),\n }).optional().describe('Response format options'),\n});\n\nexport type RestApiConfig = z.infer<typeof RestApiConfigSchema>;\nexport type RestApiConfigInput = z.input<typeof RestApiConfigSchema>;\n\n// ==========================================\n// CRUD Endpoint Configuration\n// ==========================================\n\n/**\n * CRUD Operation Type Enum\n */\nexport const CrudOperation = z.enum([\n 'create', // POST /api/v1/data/{object}\n 'read', // GET /api/v1/data/{object}/:id\n 'update', // PATCH /api/v1/data/{object}/:id\n 'delete', // DELETE /api/v1/data/{object}/:id\n 'list', // GET /api/v1/data/{object}\n]);\n\nexport type CrudOperation = z.infer<typeof CrudOperation>;\n\n/**\n * CRUD Endpoint Pattern Schema\n * Defines the URL pattern for CRUD operations\n * \n * @example\n * {\n * \"create\": { \"method\": \"POST\", \"path\": \"/data/{object}\" },\n * \"read\": { \"method\": \"GET\", \"path\": \"/data/{object}/:id\" },\n * \"update\": { \"method\": \"PATCH\", \"path\": \"/data/{object}/:id\" },\n * \"delete\": { \"method\": \"DELETE\", \"path\": \"/data/{object}/:id\" },\n * \"list\": { \"method\": \"GET\", \"path\": \"/data/{object}\" }\n * }\n */\nexport const CrudEndpointPatternSchema = z.object({\n /**\n * HTTP method\n */\n method: HttpMethod.describe('HTTP method'),\n \n /**\n * URL path pattern (relative to API base)\n */\n path: z.string().describe('URL path pattern'),\n \n /**\n * Operation summary for documentation\n */\n summary: z.string().optional().describe('Operation summary'),\n \n /**\n * Operation description\n */\n description: z.string().optional().describe('Operation description'),\n});\n\nexport type CrudEndpointPattern = z.infer<typeof CrudEndpointPatternSchema>;\n\n/**\n * CRUD Endpoints Configuration Schema\n * Configuration for automatic CRUD endpoint generation\n */\nexport const CrudEndpointsConfigSchema = z.object({\n /**\n * Enable/disable specific CRUD operations\n */\n operations: z.object({\n create: z.boolean().default(true).describe('Enable create operation'),\n read: z.boolean().default(true).describe('Enable read operation'),\n update: z.boolean().default(true).describe('Enable update operation'),\n delete: z.boolean().default(true).describe('Enable delete operation'),\n list: z.boolean().default(true).describe('Enable list operation'),\n }).optional().describe('Enable/disable operations'),\n \n /**\n * Custom endpoint patterns (override defaults)\n */\n patterns: z.record(CrudOperation, CrudEndpointPatternSchema.optional()).optional()\n .describe('Custom URL patterns for operations'),\n \n /**\n * Path prefix for data operations\n */\n dataPrefix: z.string().default('/data').describe('URL prefix for data endpoints'),\n \n /**\n * Object name parameter style\n */\n objectParamStyle: z.enum(['path', 'query']).default('path')\n .describe('How object name is passed (path param or query param)'),\n});\n\nexport type CrudEndpointsConfig = z.infer<typeof CrudEndpointsConfigSchema>;\nexport type CrudEndpointsConfigInput = z.input<typeof CrudEndpointsConfigSchema>;\n\n// ==========================================\n// Metadata Endpoint Configuration\n// ==========================================\n\n/**\n * Metadata Endpoint Configuration Schema\n * Configuration for metadata API endpoints\n * \n * @example\n * {\n * \"prefix\": \"/meta\",\n * \"enableCache\": true,\n * \"endpoints\": {\n * \"types\": true,\n * \"objects\": true,\n * \"fields\": true\n * }\n * }\n */\nexport const MetadataEndpointsConfigSchema = z.object({\n /**\n * Path prefix for metadata operations\n */\n prefix: z.string().default('/meta').describe('URL prefix for metadata endpoints'),\n \n /**\n * Enable HTTP caching for metadata\n */\n enableCache: z.boolean().default(true).describe('Enable HTTP cache headers (ETag, Last-Modified)'),\n \n /**\n * Cache TTL in seconds\n */\n cacheTtl: z.number().int().default(3600).describe('Cache TTL in seconds'),\n \n /**\n * Enable specific metadata endpoints\n */\n endpoints: z.object({\n types: z.boolean().default(true).describe('GET /meta - List all metadata types'),\n items: z.boolean().default(true).describe('GET /meta/:type - List items of type'),\n item: z.boolean().default(true).describe('GET /meta/:type/:name - Get specific item'),\n schema: z.boolean().default(true).describe('GET /meta/:type/:name/schema - Get JSON schema'),\n }).optional().describe('Enable/disable specific endpoints'),\n});\n\nexport type MetadataEndpointsConfig = z.infer<typeof MetadataEndpointsConfigSchema>;\nexport type MetadataEndpointsConfigInput = z.input<typeof MetadataEndpointsConfigSchema>;\n\n// ==========================================\n// Batch Operation Endpoint Configuration\n// ==========================================\n\n/**\n * Batch Operation Endpoint Configuration Schema\n * Configuration for batch/bulk operation endpoints\n * \n * @example\n * {\n * \"maxBatchSize\": 200,\n * \"enableBatchEndpoint\": true,\n * \"enableCreateMany\": true,\n * \"enableUpdateMany\": true,\n * \"enableDeleteMany\": true\n * }\n */\nexport const BatchEndpointsConfigSchema = z.object({\n /**\n * Maximum batch size\n */\n maxBatchSize: z.number().int().min(1).max(1000).default(200)\n .describe('Maximum records per batch operation'),\n \n /**\n * Enable generic batch endpoint\n */\n enableBatchEndpoint: z.boolean().default(true)\n .describe('Enable POST /data/:object/batch endpoint'),\n \n /**\n * Enable specific batch operations\n */\n operations: z.object({\n createMany: z.boolean().default(true).describe('Enable POST /data/:object/createMany'),\n updateMany: z.boolean().default(true).describe('Enable POST /data/:object/updateMany'),\n deleteMany: z.boolean().default(true).describe('Enable POST /data/:object/deleteMany'),\n upsertMany: z.boolean().default(true).describe('Enable POST /data/:object/upsertMany'),\n }).optional().describe('Enable/disable specific batch operations'),\n \n /**\n * Transaction mode default\n */\n defaultAtomic: z.boolean().default(true)\n .describe('Default atomic/transaction mode for batch operations'),\n});\n\nexport type BatchEndpointsConfig = z.infer<typeof BatchEndpointsConfigSchema>;\nexport type BatchEndpointsConfigInput = z.input<typeof BatchEndpointsConfigSchema>;\n\n// ==========================================\n// Route Generation Configuration\n// ==========================================\n\n/**\n * Route Generation Configuration Schema\n * Controls automatic route generation for objects\n */\nexport const RouteGenerationConfigSchema = z.object({\n /**\n * Objects to include (if empty, include all)\n */\n includeObjects: z.array(z.string()).optional()\n .describe('Specific objects to generate routes for (empty = all)'),\n \n /**\n * Objects to exclude\n */\n excludeObjects: z.array(z.string()).optional()\n .describe('Objects to exclude from route generation'),\n \n /**\n * Object name transformations\n */\n nameTransform: z.enum(['none', 'plural', 'kebab-case', 'camelCase']).default('none')\n .describe('Transform object names in URLs'),\n \n /**\n * Custom route overrides per object\n */\n overrides: z.record(z.string(), z.object({\n enabled: z.boolean().optional().describe('Enable/disable routes for this object'),\n basePath: z.string().optional().describe('Custom base path'),\n operations: z.record(CrudOperation, z.boolean()).optional()\n .describe('Enable/disable specific operations'),\n })).optional().describe('Per-object route customization'),\n});\n\nexport type RouteGenerationConfig = z.infer<typeof RouteGenerationConfigSchema>;\nexport type RouteGenerationConfigInput = z.input<typeof RouteGenerationConfigSchema>;\n\n// ==========================================\n// Complete REST Server Configuration\n// ==========================================\n\n/**\n * REST Server Configuration Schema\n * Complete configuration for REST API server with auto-generated endpoints\n * \n * @example\n * {\n * \"api\": {\n * \"version\": \"v1\",\n * \"basePath\": \"/api\",\n * \"enableCrud\": true,\n * \"enableMetadata\": true,\n * \"enableBatch\": true\n * },\n * \"crud\": {\n * \"dataPrefix\": \"/data\"\n * },\n * \"metadata\": {\n * \"prefix\": \"/meta\",\n * \"enableCache\": true\n * },\n * \"batch\": {\n * \"maxBatchSize\": 200\n * },\n * \"routes\": {\n * \"excludeObjects\": [\"system_log\"]\n * }\n * }\n */\nexport const RestServerConfigSchema = z.object({\n /**\n * API configuration\n */\n api: RestApiConfigSchema.optional().describe('REST API configuration'),\n \n /**\n * CRUD endpoints configuration\n */\n crud: CrudEndpointsConfigSchema.optional().describe('CRUD endpoints configuration'),\n \n /**\n * Metadata endpoints configuration\n */\n metadata: MetadataEndpointsConfigSchema.optional().describe('Metadata endpoints configuration'),\n \n /**\n * Batch endpoints configuration\n */\n batch: BatchEndpointsConfigSchema.optional().describe('Batch endpoints configuration'),\n \n /**\n * Route generation configuration\n */\n routes: RouteGenerationConfigSchema.optional().describe('Route generation configuration'),\n});\n\nexport type RestServerConfig = z.infer<typeof RestServerConfigSchema>;\nexport type RestServerConfigInput = z.input<typeof RestServerConfigSchema>;\n\n// ==========================================\n// Endpoint Registry\n// ==========================================\n\n/**\n * Generated Endpoint Schema\n * Represents a generated REST endpoint\n */\nexport const GeneratedEndpointSchema = z.object({\n /**\n * Endpoint identifier\n */\n id: z.string().describe('Unique endpoint identifier'),\n \n /**\n * HTTP method\n */\n method: HttpMethod.describe('HTTP method'),\n \n /**\n * Full URL path\n */\n path: z.string().describe('Full URL path'),\n \n /**\n * Object this endpoint operates on\n */\n object: z.string().describe('Object name (snake_case)'),\n \n /**\n * Operation type\n */\n operation: z.union([CrudOperation, z.string()]).describe('Operation type'),\n \n /**\n * Handler reference\n */\n handler: z.string().describe('Handler function identifier'),\n \n /**\n * Endpoint metadata\n */\n metadata: z.object({\n summary: z.string().optional(),\n description: z.string().optional(),\n tags: z.array(z.string()).optional(),\n deprecated: z.boolean().optional(),\n }).optional(),\n});\n\nexport type GeneratedEndpoint = z.infer<typeof GeneratedEndpointSchema>;\n\n/**\n * Endpoint Registry Schema\n * Registry of all generated endpoints\n */\nexport const EndpointRegistrySchema = z.object({\n /**\n * Generated endpoints\n */\n endpoints: z.array(GeneratedEndpointSchema).describe('All generated endpoints'),\n \n /**\n * Total endpoint count\n */\n total: z.number().int().describe('Total number of endpoints'),\n \n /**\n * Endpoints by object\n */\n byObject: z.record(z.string(), z.array(GeneratedEndpointSchema)).optional()\n .describe('Endpoints grouped by object'),\n \n /**\n * Endpoints by operation\n */\n byOperation: z.record(z.string(), z.array(GeneratedEndpointSchema)).optional()\n .describe('Endpoints grouped by operation'),\n});\n\nexport type EndpointRegistry = z.infer<typeof EndpointRegistrySchema>;\n\n// ==========================================\n// Helper Functions\n// ==========================================\n\n/**\n * Helper to create REST API configuration\n */\nexport const RestApiConfig = Object.assign(RestApiConfigSchema, {\n create: <T extends z.input<typeof RestApiConfigSchema>>(config: T) => config,\n});\n\n/**\n * Helper to create REST server configuration\n */\nexport const RestServerConfig = Object.assign(RestServerConfigSchema, {\n create: <T extends z.input<typeof RestServerConfigSchema>>(config: T) => config,\n});\n","// Copyright (c) 2025 ObjectStack. Licensed under the Apache-2.0 license.\n\nimport { z } from 'zod';\nimport { HttpMethod, RateLimitConfigSchema } from '../shared/http.zod';\nimport { SnakeCaseIdentifierSchema } from '../shared/identifiers.zod';\n\n/**\n * Unified API Registry Protocol\n * \n * Provides a centralized registry for managing all API endpoints across different\n * API types (REST, GraphQL, OData, WebSocket, Auth, File, Plugin-registered).\n * \n * This enables:\n * - Unified API discovery and documentation (similar to Swagger/OpenAPI)\n * - API testing interfaces\n * - API governance and monitoring\n * - Plugin API registration\n * - Multi-protocol support\n * \n * Architecture Alignment:\n * - Kubernetes: Service Discovery & API Server\n * - AWS API Gateway: Unified API Management\n * - Kong Gateway: Plugin-based API Management\n * \n * @example API Registry Entry\n * ```typescript\n * const apiEntry: ApiRegistryEntry = {\n * id: 'customer_crud',\n * name: 'Customer CRUD API',\n * type: 'rest',\n * version: 'v1',\n * basePath: '/api/v1/data/customer',\n * endpoints: [...],\n * metadata: {\n * owner: 'sales_team',\n * tags: ['customer', 'crm']\n * }\n * }\n * ```\n */\n\n// ==========================================\n// API Type Enumeration\n// ==========================================\n\n/**\n * API Protocol Type\n * \n * Defines the different types of APIs supported by ObjectStack.\n */\nexport const ApiProtocolType = z.enum([\n 'rest', // RESTful API (CRUD operations)\n 'graphql', // GraphQL API (flexible queries)\n 'odata', // OData v4 API (enterprise integration)\n 'websocket', // WebSocket API (real-time)\n 'file', // File/Storage API (uploads/downloads)\n 'auth', // Authentication/Authorization API\n 'metadata', // Metadata/Schema API\n 'plugin', // Plugin-registered custom API\n 'webhook', // Webhook endpoints\n 'rpc', // JSON-RPC or similar\n]);\n\nexport type ApiProtocolType = z.infer<typeof ApiProtocolType>;\n\n// ==========================================\n// API Endpoint Registration\n// ==========================================\n\n/**\n * HTTP Status Code\n */\nexport const HttpStatusCode = z.union([\n z.number().int().min(100).max(599),\n z.enum(['2xx', '3xx', '4xx', '5xx']), // Pattern matching\n]);\n\nexport type HttpStatusCode = z.infer<typeof HttpStatusCode>;\n\n// ==========================================\n// Schema Reference Types\n// ==========================================\n\n/**\n * ObjectQL Reference Schema\n * \n * Allows referencing ObjectStack data objects instead of static JSON schemas.\n * When an API parameter or response references an ObjectQL object, the schema\n * is dynamically derived from the object definition, enabling automatic updates\n * when the object schema changes.\n * \n * **IMPORTANT - Schema Resolution Responsibility:**\n * The API Registry STORES these references as metadata but does NOT resolve them.\n * Schema resolution (expanding references into actual JSON Schema) is performed by:\n * - **API Gateway**: For runtime request/response validation\n * - **OpenAPI Generator**: For Swagger/OpenAPI documentation\n * - **GraphQL Schema Builder**: For GraphQL type generation\n * - **Documentation Tools**: For developer documentation\n * \n * This separation allows the Registry to remain lightweight and focused on\n * registration/discovery, while specialized tools handle schema transformation.\n * \n * **Benefits:**\n * - Auto-updating API documentation when object schemas change\n * - Consistent type definitions across API and database\n * - Reduced duplication and maintenance\n * - Registry remains protocol-agnostic and lightweight\n * \n * @example Reference Customer object\n * ```json\n * {\n * \"objectId\": \"customer\",\n * \"includeFields\": [\"id\", \"name\", \"email\"],\n * \"excludeFields\": [\"internal_notes\"]\n * }\n * ```\n */\nexport const ObjectQLReferenceSchema = z.object({\n /** Referenced object name (snake_case) */\n objectId: SnakeCaseIdentifierSchema.describe('Object name to reference'),\n \n /** Include only specific fields (optional) */\n includeFields: z.array(z.string()).optional()\n .describe('Include only these fields in the schema'),\n \n /** Exclude specific fields (optional) */\n excludeFields: z.array(z.string()).optional()\n .describe('Exclude these fields from the schema'),\n \n /** Include related objects via lookup fields */\n includeRelated: z.array(z.string()).optional()\n .describe('Include related objects via lookup fields'),\n});\n\nexport type ObjectQLReference = z.infer<typeof ObjectQLReferenceSchema>;\n\n/**\n * Schema Definition\n * \n * Unified schema definition that supports both:\n * 1. Static JSON Schema (traditional approach)\n * 2. Dynamic ObjectQL reference (linked to object definitions)\n * \n * When using ObjectQL references, the API documentation and validation\n * automatically update when object schemas change, eliminating the need\n * to manually sync API schemas with data models.\n */\nexport const SchemaDefinition = z.union([\n z.unknown().describe('Static JSON Schema definition'),\n z.object({\n $ref: ObjectQLReferenceSchema.describe('Dynamic reference to ObjectQL object'),\n }).describe('Dynamic ObjectQL reference'),\n]);\n\nexport type SchemaDefinition = z.infer<typeof SchemaDefinition>;\n\n// ==========================================\n// API Parameter & Response Schemas\n// ==========================================\n\n/**\n * API Parameter Schema\n * \n * Defines a single API parameter (path, query, header, or body).\n * \n * **Enhancement: Dynamic Schema Linking**\n * - Supports both static JSON Schema and dynamic ObjectQL references\n * - When using ObjectQL references, parameter validation automatically updates\n * when the referenced object schema changes\n * \n * @example Static schema\n * ```json\n * {\n * \"name\": \"customer_id\",\n * \"in\": \"path\",\n * \"schema\": {\n * \"type\": \"string\",\n * \"format\": \"uuid\"\n * }\n * }\n * ```\n * \n * @example Dynamic ObjectQL reference\n * ```json\n * {\n * \"name\": \"customer\",\n * \"in\": \"body\",\n * \"schema\": {\n * \"$ref\": {\n * \"objectId\": \"customer\",\n * \"excludeFields\": [\"internal_notes\"]\n * }\n * }\n * }\n * ```\n */\nexport const ApiParameterSchema = z.object({\n /** Parameter name */\n name: z.string().describe('Parameter name'),\n \n /** Parameter location */\n in: z.enum(['path', 'query', 'header', 'body', 'cookie']).describe('Parameter location'),\n \n /** Parameter description */\n description: z.string().optional().describe('Parameter description'),\n \n /** Required flag */\n required: z.boolean().default(false).describe('Whether parameter is required'),\n \n /** Parameter type/schema - supports static or dynamic (ObjectQL) schemas */\n schema: z.union([\n z.object({\n type: z.enum(['string', 'number', 'integer', 'boolean', 'array', 'object']).describe('Parameter type'),\n format: z.string().optional().describe('Format (e.g., date-time, email, uuid)'),\n enum: z.array(z.unknown()).optional().describe('Allowed values'),\n default: z.unknown().optional().describe('Default value'),\n items: z.unknown().optional().describe('Array item schema'),\n properties: z.record(z.string(), z.unknown()).optional().describe('Object properties'),\n }).describe('Static JSON Schema'),\n z.object({\n $ref: ObjectQLReferenceSchema,\n }).describe('Dynamic ObjectQL reference'),\n ]).describe('Parameter schema definition'),\n \n /** Example value */\n example: z.unknown().optional().describe('Example value'),\n});\n\nexport type ApiParameter = z.infer<typeof ApiParameterSchema>;\n\n/**\n * API Response Schema\n * \n * Defines an API response for a specific status code.\n * \n * **Enhancement: Dynamic Schema Linking**\n * - Response schema can reference ObjectQL objects\n * - When object definitions change, response documentation auto-updates\n * \n * @example Response with ObjectQL reference\n * ```json\n * {\n * \"statusCode\": 200,\n * \"description\": \"Customer retrieved successfully\",\n * \"schema\": {\n * \"$ref\": {\n * \"objectId\": \"customer\",\n * \"excludeFields\": [\"password_hash\"]\n * }\n * }\n * }\n * ```\n */\nexport const ApiResponseSchema = z.object({\n /** HTTP status code */\n statusCode: HttpStatusCode.describe('HTTP status code'),\n \n /** Response description */\n description: z.string().describe('Response description'),\n \n /** Response content type */\n contentType: z.string().default('application/json').describe('Response content type'),\n \n /** Response schema - supports static or dynamic (ObjectQL) schemas */\n schema: z.union([\n z.unknown().describe('Static JSON Schema'),\n z.object({\n $ref: ObjectQLReferenceSchema,\n }).describe('Dynamic ObjectQL reference'),\n ]).optional().describe('Response body schema'),\n \n /** Response headers */\n headers: z.record(z.string(), z.object({\n description: z.string().optional(),\n schema: z.unknown(),\n })).optional().describe('Response headers'),\n \n /** Example response */\n example: z.unknown().optional().describe('Example response'),\n});\n\nexport type ApiResponse = z.infer<typeof ApiResponseSchema>;\nexport type ApiResponseInput = z.input<typeof ApiResponseSchema>;\n\n/**\n * API Endpoint Registration Schema\n * \n * Represents a single API endpoint registration with complete metadata.\n * \n * **Enhancements:**\n * 1. **RBAC Integration**: `requiredPermissions` field for automatic permission checking\n * 2. **Dynamic Schema Linking**: Parameters and responses can reference ObjectQL objects\n * 3. **Route Priority**: `priority` field for conflict resolution\n * 4. **Protocol Config**: `protocolConfig` for protocol-specific extensions\n * \n * @example REST Endpoint with RBAC\n * ```json\n * {\n * \"id\": \"get_customer_by_id\",\n * \"method\": \"GET\",\n * \"path\": \"/api/v1/data/customer/:id\",\n * \"summary\": \"Get customer by ID\",\n * \"requiredPermissions\": [\"customer.read\"],\n * \"parameters\": [\n * {\n * \"name\": \"id\",\n * \"in\": \"path\",\n * \"required\": true,\n * \"schema\": { \"type\": \"string\" }\n * }\n * ],\n * \"responses\": [\n * {\n * \"statusCode\": 200,\n * \"description\": \"Customer found\",\n * \"schema\": {\n * \"$ref\": {\n * \"objectId\": \"customer\"\n * }\n * }\n * }\n * ],\n * \"priority\": 100\n * }\n * ```\n * \n * @example Plugin Endpoint with Protocol Config\n * ```json\n * {\n * \"id\": \"grpc_service_method\",\n * \"path\": \"/grpc/ServiceName/MethodName\",\n * \"summary\": \"gRPC service method\",\n * \"protocolConfig\": {\n * \"subProtocol\": \"grpc\",\n * \"serviceName\": \"CustomerService\",\n * \"methodName\": \"GetCustomer\"\n * },\n * \"priority\": 50\n * }\n * ```\n */\nexport const ApiEndpointRegistrationSchema = z.object({\n /** Unique endpoint identifier */\n id: z.string().describe('Unique endpoint identifier'),\n \n /** HTTP method (for HTTP-based APIs) */\n method: HttpMethod.optional().describe('HTTP method'),\n \n /** URL path pattern */\n path: z.string().describe('URL path pattern'),\n \n /** Short summary */\n summary: z.string().optional().describe('Short endpoint summary'),\n \n /** Detailed description */\n description: z.string().optional().describe('Detailed endpoint description'),\n \n /** Operation ID (OpenAPI) */\n operationId: z.string().optional().describe('Unique operation identifier'),\n \n /** Tags for grouping */\n tags: z.array(z.string()).optional().default([]).describe('Tags for categorization'),\n \n /** Parameters */\n parameters: z.array(ApiParameterSchema).optional().default([]).describe('Endpoint parameters'),\n \n /** Request body schema */\n requestBody: z.object({\n description: z.string().optional(),\n required: z.boolean().default(false),\n contentType: z.string().default('application/json'),\n schema: z.unknown().optional(),\n example: z.unknown().optional(),\n }).optional().describe('Request body specification'),\n \n /** Response definitions */\n responses: z.array(ApiResponseSchema).optional().default([]).describe('Possible responses'),\n \n /** Rate Limiting */\n rateLimit: RateLimitConfigSchema.optional().describe('Endpoint specific rate limiting'),\n\n /** Security Requirements */\n security: z.array(z.record(z.string(), z.array(z.string()))).optional().describe('Security requirements (e.g. [{\"bearerAuth\": []}])'),\n \n /**\n * Required Permissions (RBAC Integration)\n * \n * Array of permission names required to access this endpoint.\n * The gateway layer automatically validates these permissions before\n * allowing the request to proceed, eliminating the need for permission\n * checks in individual API handlers.\n * \n * **Format:** `<object>.<operation>` or system permission name\n * \n * **Object Permissions:**\n * - `customer.read` - Read customer records\n * - `customer.create` - Create customer records\n * - `customer.edit` - Update customer records\n * - `customer.delete` - Delete customer records\n * - `customer.viewAll` - View all customer records (bypass sharing)\n * - `customer.modifyAll` - Modify all customer records (bypass sharing)\n * \n * **System Permissions:**\n * - `manage_users` - User management\n * - `view_setup` - Access to system setup\n * - `customize_application` - Modify metadata\n * - `api_enabled` - API access\n * \n * @example Object-level permissions\n * ```json\n * {\n * \"requiredPermissions\": [\"customer.read\"]\n * }\n * ```\n * \n * @example Multiple permissions (ALL required)\n * ```json\n * {\n * \"requiredPermissions\": [\"customer.read\", \"account.read\"]\n * }\n * ```\n * \n * @example System permission\n * ```json\n * {\n * \"requiredPermissions\": [\"manage_users\"]\n * }\n * ```\n * \n * @see {@link file://../../permission/permission.zod.ts} for permission definitions\n */\n requiredPermissions: z.array(z.string()).optional().default([])\n .describe('Required RBAC permissions (e.g., \"customer.read\", \"manage_users\")'),\n \n /**\n * Route Priority\n * \n * Priority level for route conflict resolution. Higher priority routes\n * are registered first and take precedence when multiple routes match\n * the same path pattern.\n * \n * **Default:** 100 (medium priority)\n * **Range:** 0-1000 (higher = more important)\n * \n * **Use Cases:**\n * - Core system APIs: 900-1000\n * - Plugin APIs: 100-500\n * - Custom/override APIs: 500-900\n * - Fallback routes: 0-100\n * \n * @example High priority core endpoint\n * ```json\n * {\n * \"path\": \"/api/v1/data/:object/:id\",\n * \"priority\": 950\n * }\n * ```\n * \n * @example Medium priority plugin endpoint\n * ```json\n * {\n * \"path\": \"/api/v1/custom/action\",\n * \"priority\": 300\n * }\n * ```\n */\n priority: z.number().int().min(0).max(1000).optional().default(100)\n .describe('Route priority for conflict resolution (0-1000, higher = more important)'),\n \n /**\n * Protocol-Specific Configuration\n * \n * Allows plugins and custom APIs to define protocol-specific metadata\n * that can be used for specialized handling or documentation generation.\n * \n * **Examples:**\n * - gRPC: Service and method names\n * - tRPC: Procedure type (query/mutation)\n * - WebSocket: Event names and handlers\n * - Custom protocols: Any metadata needed\n * \n * @example gRPC configuration\n * ```json\n * {\n * \"protocolConfig\": {\n * \"subProtocol\": \"grpc\",\n * \"serviceName\": \"CustomerService\",\n * \"methodName\": \"GetCustomer\",\n * \"streaming\": false\n * }\n * }\n * ```\n * \n * @example tRPC configuration\n * ```json\n * {\n * \"protocolConfig\": {\n * \"subProtocol\": \"trpc\",\n * \"procedureType\": \"query\",\n * \"router\": \"customer\"\n * }\n * }\n * ```\n * \n * @example WebSocket configuration\n * ```json\n * {\n * \"protocolConfig\": {\n * \"subProtocol\": \"websocket\",\n * \"eventName\": \"customer.updated\",\n * \"direction\": \"server-to-client\"\n * }\n * }\n * ```\n */\n protocolConfig: z.record(z.string(), z.unknown()).optional()\n .describe('Protocol-specific configuration for custom protocols (gRPC, tRPC, etc.)'),\n \n /** Deprecation flag */\n deprecated: z.boolean().default(false).describe('Whether endpoint is deprecated'),\n \n /** External documentation */\n externalDocs: z.object({\n description: z.string().optional(),\n url: z.string().url(),\n }).optional().describe('External documentation link'),\n});\n\nexport type ApiEndpointRegistration = z.infer<typeof ApiEndpointRegistrationSchema>;\nexport type ApiEndpointRegistrationInput = z.input<typeof ApiEndpointRegistrationSchema>;\n\n// ==========================================\n// API Registry Entry\n// ==========================================\n\n/**\n * API Metadata Schema\n * \n * Additional metadata for an API registration.\n */\nexport const ApiMetadataSchema = z.object({\n /** API owner/team */\n owner: z.string().optional().describe('Owner team or person'),\n \n /** API status */\n status: z.enum(['active', 'deprecated', 'experimental', 'beta']).default('active')\n .describe('API lifecycle status'),\n \n /** Categorization tags */\n tags: z.array(z.string()).optional().default([]).describe('Classification tags'),\n \n /** Plugin source (if plugin-registered) */\n pluginSource: z.string().optional().describe('Source plugin name'),\n \n /** Custom metadata */\n custom: z.record(z.string(), z.unknown()).optional().describe('Custom metadata fields'),\n});\n\nexport type ApiMetadata = z.infer<typeof ApiMetadataSchema>;\nexport type ApiMetadataInput = z.input<typeof ApiMetadataSchema>;\n\n/**\n * API Registry Entry Schema\n * \n * Complete registration entry for an API in the unified registry.\n * \n * @example REST API Entry\n * ```json\n * {\n * \"id\": \"customer_api\",\n * \"name\": \"Customer Management API\",\n * \"type\": \"rest\",\n * \"version\": \"v1\",\n * \"basePath\": \"/api/v1/data/customer\",\n * \"description\": \"CRUD operations for customer records\",\n * \"endpoints\": [...],\n * \"metadata\": {\n * \"owner\": \"sales_team\",\n * \"status\": \"active\",\n * \"tags\": [\"customer\", \"crm\"]\n * }\n * }\n * ```\n * \n * @example Plugin API Entry\n * ```json\n * {\n * \"id\": \"payment_webhook\",\n * \"name\": \"Payment Webhook API\",\n * \"type\": \"plugin\",\n * \"version\": \"1.0.0\",\n * \"basePath\": \"/plugins/payment/webhook\",\n * \"endpoints\": [...],\n * \"metadata\": {\n * \"pluginSource\": \"payment_gateway_plugin\",\n * \"status\": \"active\"\n * }\n * }\n * ```\n */\nexport const ApiRegistryEntrySchema = z.object({\n /** Unique API identifier */\n id: z.string().regex(/^[a-z_][a-z0-9_]*$/).describe('Unique API identifier (snake_case)'),\n \n /** Human-readable name */\n name: z.string().describe('API display name'),\n \n /** API protocol type */\n type: ApiProtocolType.describe('API protocol type'),\n \n /** API version */\n version: z.string().describe('API version (e.g., v1, 2024-01)'),\n \n /** Base URL path */\n basePath: z.string().describe('Base URL path for this API'),\n \n /** API description */\n description: z.string().optional().describe('API description'),\n \n /** Endpoints in this API */\n endpoints: z.array(ApiEndpointRegistrationSchema).describe('Registered endpoints'),\n \n /** OpenAPI/GraphQL/OData specific configuration */\n config: z.record(z.string(), z.unknown()).optional().describe('Protocol-specific configuration'),\n \n /** API metadata */\n metadata: ApiMetadataSchema.optional().describe('Additional metadata'),\n \n /** Terms of service URL */\n termsOfService: z.string().url().optional().describe('Terms of service URL'),\n \n /** Contact information */\n contact: z.object({\n name: z.string().optional(),\n url: z.string().url().optional(),\n email: z.string().email().optional(),\n }).optional().describe('Contact information'),\n \n /** License information */\n license: z.object({\n name: z.string(),\n url: z.string().url().optional(),\n }).optional().describe('License information'),\n});\n\nexport type ApiRegistryEntry = z.infer<typeof ApiRegistryEntrySchema>;\nexport type ApiRegistryEntryInput = z.input<typeof ApiRegistryEntrySchema>;\n\n// ==========================================\n// API Registry\n// ==========================================\n\n/**\n * Route Conflict Resolution Strategy\n * \n * Defines how to handle conflicts when multiple endpoints register\n * the same or overlapping URL patterns.\n */\nexport const ConflictResolutionStrategy = z.enum([\n 'error', // Throw error on conflict (safest, default)\n 'priority', // Use priority field to resolve (highest priority wins)\n 'first-wins', // First registered endpoint wins\n 'last-wins', // Last registered endpoint wins (override mode)\n]);\n\nexport type ConflictResolutionStrategy = z.infer<typeof ConflictResolutionStrategy>;\n\n/**\n * API Registry Schema\n * \n * Central registry containing all registered APIs.\n * \n * **Enhancement: Route Conflict Detection**\n * - `conflictResolution`: Strategy for handling route conflicts\n * - Prevents silent overwrites and unexpected routing behavior\n * \n * @example\n * ```json\n * {\n * \"version\": \"1.0.0\",\n * \"conflictResolution\": \"priority\",\n * \"apis\": [\n * { \"id\": \"customer_api\", \"type\": \"rest\", ... },\n * { \"id\": \"graphql_api\", \"type\": \"graphql\", ... },\n * { \"id\": \"file_upload_api\", \"type\": \"file\", ... }\n * ],\n * \"totalApis\": 3,\n * \"totalEndpoints\": 47\n * }\n * ```\n * \n * @example Priority-based conflict resolution\n * ```json\n * {\n * \"conflictResolution\": \"priority\",\n * \"apis\": [\n * {\n * \"id\": \"core_api\",\n * \"endpoints\": [\n * {\n * \"path\": \"/api/v1/data/:object\",\n * \"priority\": 950\n * }\n * ]\n * },\n * {\n * \"id\": \"plugin_api\",\n * \"endpoints\": [\n * {\n * \"path\": \"/api/v1/data/custom\",\n * \"priority\": 300\n * }\n * ]\n * }\n * ]\n * }\n * ```\n */\nexport const ApiRegistrySchema = z.object({\n /** Registry version */\n version: z.string().describe('Registry version'),\n \n /**\n * Conflict Resolution Strategy\n * \n * Defines how to handle route conflicts when multiple endpoints\n * register the same or overlapping URL patterns.\n * \n * **Strategies:**\n * - `error`: Throw error on conflict (safest, prevents silent overwrites)\n * - `priority`: Use endpoint priority field (highest priority wins)\n * - `first-wins`: First registered endpoint wins (stable, predictable)\n * - `last-wins`: Last registered endpoint wins (allows overrides)\n * \n * **Default:** `error`\n * \n * **Best Practices:**\n * - Use `error` in production to catch configuration issues\n * - Use `priority` when mixing core and plugin APIs\n * - Use `last-wins` for development/testing overrides\n * \n * @example Prevent accidental conflicts\n * ```json\n * {\n * \"conflictResolution\": \"error\"\n * }\n * ```\n * \n * @example Allow plugin overrides with priority\n * ```json\n * {\n * \"conflictResolution\": \"priority\"\n * }\n * ```\n */\n conflictResolution: ConflictResolutionStrategy.optional().default('error')\n .describe('Strategy for handling route conflicts'),\n \n /** Registered APIs */\n apis: z.array(ApiRegistryEntrySchema).describe('All registered APIs'),\n \n /** Total API count */\n totalApis: z.number().int().describe('Total number of registered APIs'),\n \n /** Total endpoint count across all APIs */\n totalEndpoints: z.number().int().describe('Total number of endpoints'),\n \n /** APIs grouped by type */\n byType: z.record(ApiProtocolType, z.array(ApiRegistryEntrySchema)).optional()\n .describe('APIs grouped by protocol type'),\n \n /** APIs grouped by status */\n byStatus: z.record(z.string(), z.array(ApiRegistryEntrySchema)).optional()\n .describe('APIs grouped by status'),\n \n /** Last updated timestamp */\n updatedAt: z.string().datetime().optional().describe('Last registry update time'),\n});\n\nexport type ApiRegistry = z.infer<typeof ApiRegistrySchema>;\n\n// ==========================================\n// API Discovery & Query\n// ==========================================\n\n/**\n * API Discovery Query Schema\n * \n * Query parameters for discovering/filtering APIs in the registry.\n * \n * @example\n * ```json\n * {\n * \"type\": \"rest\",\n * \"tags\": [\"customer\"],\n * \"status\": \"active\"\n * }\n * ```\n */\nexport const ApiDiscoveryQuerySchema = z.object({\n /** Filter by API type */\n type: ApiProtocolType.optional().describe('Filter by API protocol type'),\n \n /** Filter by tags */\n tags: z.array(z.string()).optional().describe('Filter by tags (ANY match)'),\n \n /** Filter by status */\n status: z.enum(['active', 'deprecated', 'experimental', 'beta']).optional()\n .describe('Filter by lifecycle status'),\n \n /** Filter by plugin source */\n pluginSource: z.string().optional().describe('Filter by plugin name'),\n \n /** Search in name/description */\n search: z.string().optional().describe('Full-text search in name/description'),\n \n /** Filter by version */\n version: z.string().optional().describe('Filter by specific version'),\n});\n\nexport type ApiDiscoveryQuery = z.infer<typeof ApiDiscoveryQuerySchema>;\n\n/**\n * API Discovery Response Schema\n * \n * Response for API discovery queries.\n */\nexport const ApiDiscoveryResponseSchema = z.object({\n /** Matching APIs */\n apis: z.array(ApiRegistryEntrySchema).describe('Matching API entries'),\n \n /** Total matches */\n total: z.number().int().describe('Total matching APIs'),\n \n /** Applied filters */\n filters: ApiDiscoveryQuerySchema.optional().describe('Applied query filters'),\n});\n\nexport type ApiDiscoveryResponse = z.infer<typeof ApiDiscoveryResponseSchema>;\n\n// ==========================================\n// Helper Functions\n// ==========================================\n\n/**\n * Helper to create API endpoint registration\n */\nexport const ApiEndpointRegistration = Object.assign(ApiEndpointRegistrationSchema, {\n create: <T extends z.input<typeof ApiEndpointRegistrationSchema>>(config: T) => config,\n});\n\n/**\n * Helper to create API registry entry\n */\nexport const ApiRegistryEntry = Object.assign(ApiRegistryEntrySchema, {\n create: <T extends z.input<typeof ApiRegistryEntrySchema>>(config: T) => config,\n});\n\n/**\n * Helper to create API registry\n */\nexport const ApiRegistry = Object.assign(ApiRegistrySchema, {\n create: <T extends z.input<typeof ApiRegistrySchema>>(config: T) => config,\n});\n","// Copyright (c) 2025 ObjectStack. Licensed under the Apache-2.0 license.\n\nimport { z } from 'zod';\n\n/**\n * API Documentation & Testing Interface Protocol\n * \n * Provides schemas for generating interactive API documentation and testing\n * interfaces similar to Swagger UI, GraphQL Playground, Postman, etc.\n * \n * Features:\n * - OpenAPI/Swagger specification generation\n * - Interactive API testing playground\n * - API versioning and changelog\n * - Code generation templates\n * - Mock server configuration\n * \n * Architecture Alignment:\n * - Swagger UI: Interactive API documentation\n * - Postman: API testing collections\n * - GraphQL Playground: GraphQL-specific testing\n * - Redoc: Documentation rendering\n * \n * @example Documentation Config\n * ```typescript\n * const docConfig: ApiDocumentationConfig = {\n * enabled: true,\n * title: 'ObjectStack API',\n * version: '1.0.0',\n * servers: [{ url: 'https://api.example.com', description: 'Production' }],\n * ui: {\n * type: 'swagger-ui',\n * theme: 'light',\n * enableTryItOut: true\n * }\n * }\n * ```\n */\n\n// ==========================================\n// OpenAPI Specification\n// ==========================================\n\n/**\n * OpenAPI Server Schema\n * \n * Server configuration for OpenAPI specification.\n */\nexport const OpenApiServerSchema = z.object({\n /** Server URL */\n url: z.string().url().describe('Server base URL'),\n \n /** Server description */\n description: z.string().optional().describe('Server description'),\n \n /** Server variables */\n variables: z.record(z.string(), z.object({\n default: z.string(),\n description: z.string().optional(),\n enum: z.array(z.string()).optional(),\n })).optional().describe('URL template variables'),\n});\n\nexport type OpenApiServer = z.infer<typeof OpenApiServerSchema>;\n\n/**\n * OpenAPI Security Scheme Schema\n * \n * Security scheme definition for OpenAPI.\n */\nexport const OpenApiSecuritySchemeSchema = z.object({\n /** Security scheme type */\n type: z.enum(['apiKey', 'http', 'oauth2', 'openIdConnect']).describe('Security type'),\n \n /** Scheme name */\n scheme: z.string().optional().describe('HTTP auth scheme (bearer, basic, etc.)'),\n \n /** Bearer format */\n bearerFormat: z.string().optional().describe('Bearer token format (e.g., JWT)'),\n \n /** API key name */\n name: z.string().optional().describe('API key parameter name'),\n \n /** API key location */\n in: z.enum(['header', 'query', 'cookie']).optional().describe('API key location'),\n \n /** OAuth flows */\n flows: z.object({\n implicit: z.unknown().optional(),\n password: z.unknown().optional(),\n clientCredentials: z.unknown().optional(),\n authorizationCode: z.unknown().optional(),\n }).optional().describe('OAuth2 flows'),\n \n /** OpenID Connect URL */\n openIdConnectUrl: z.string().url().optional().describe('OpenID Connect discovery URL'),\n \n /** Description */\n description: z.string().optional().describe('Security scheme description'),\n});\n\nexport type OpenApiSecurityScheme = z.infer<typeof OpenApiSecuritySchemeSchema>;\n\n/**\n * OpenAPI Specification Schema\n * \n * Complete OpenAPI 3.0 specification structure.\n * \n * @see https://swagger.io/specification/\n * \n * @example\n * ```json\n * {\n * \"openapi\": \"3.0.0\",\n * \"info\": {\n * \"title\": \"ObjectStack API\",\n * \"version\": \"1.0.0\",\n * \"description\": \"ObjectStack unified API\"\n * },\n * \"servers\": [\n * { \"url\": \"https://api.example.com\" }\n * ],\n * \"paths\": { ... },\n * \"components\": { ... }\n * }\n * ```\n */\nexport const OpenApiSpecSchema = z.object({\n /** OpenAPI version */\n openapi: z.string().default('3.0.0').describe('OpenAPI specification version'),\n \n /** API information */\n info: z.object({\n title: z.string().describe('API title'),\n version: z.string().describe('API version'),\n description: z.string().optional().describe('API description'),\n termsOfService: z.string().url().optional().describe('Terms of service URL'),\n contact: z.object({\n name: z.string().optional(),\n url: z.string().url().optional(),\n email: z.string().email().optional(),\n }).optional(),\n license: z.object({\n name: z.string(),\n url: z.string().url().optional(),\n }).optional(),\n }).describe('API metadata'),\n \n /** Servers */\n servers: z.array(OpenApiServerSchema).optional().default([]).describe('API servers'),\n \n /** API paths */\n paths: z.record(z.string(), z.unknown()).describe('API paths and operations'),\n \n /** Reusable components */\n components: z.object({\n schemas: z.record(z.string(), z.unknown()).optional(),\n responses: z.record(z.string(), z.unknown()).optional(),\n parameters: z.record(z.string(), z.unknown()).optional(),\n examples: z.record(z.string(), z.unknown()).optional(),\n requestBodies: z.record(z.string(), z.unknown()).optional(),\n headers: z.record(z.string(), z.unknown()).optional(),\n securitySchemes: z.record(z.string(), OpenApiSecuritySchemeSchema).optional(),\n links: z.record(z.string(), z.unknown()).optional(),\n callbacks: z.record(z.string(), z.unknown()).optional(),\n }).optional().describe('Reusable components'),\n \n /** Security requirements */\n security: z.array(z.record(z.string(), z.array(z.string()))).optional()\n .describe('Global security requirements'),\n \n /** Tags */\n tags: z.array(z.object({\n name: z.string(),\n description: z.string().optional(),\n externalDocs: z.object({\n description: z.string().optional(),\n url: z.string().url(),\n }).optional(),\n })).optional().describe('Tag definitions'),\n \n /** External documentation */\n externalDocs: z.object({\n description: z.string().optional(),\n url: z.string().url(),\n }).optional().describe('External documentation'),\n});\n\nexport type OpenApiSpec = z.infer<typeof OpenApiSpecSchema>;\n\n// ==========================================\n// API Testing Playground\n// ==========================================\n\n/**\n * API Testing UI Type\n */\nexport const ApiTestingUiType = z.enum([\n 'swagger-ui', // Swagger UI\n 'redoc', // Redoc\n 'rapidoc', // RapiDoc\n 'stoplight', // Stoplight Elements\n 'scalar', // Scalar API Reference\n 'graphql-playground', // GraphQL Playground\n 'graphiql', // GraphiQL\n 'postman', // Postman-like interface\n 'custom', // Custom implementation\n]);\n\nexport type ApiTestingUiType = z.infer<typeof ApiTestingUiType>;\n\n/**\n * API Testing UI Configuration Schema\n * \n * Configuration for interactive API testing interface.\n * \n * @example Swagger UI Config\n * ```json\n * {\n * \"type\": \"swagger-ui\",\n * \"path\": \"/api-docs\",\n * \"theme\": \"light\",\n * \"enableTryItOut\": true,\n * \"enableFilter\": true,\n * \"enableCors\": true,\n * \"defaultModelsExpandDepth\": 1\n * }\n * ```\n */\nexport const ApiTestingUiConfigSchema = z.object({\n /** UI type */\n type: ApiTestingUiType.describe('Testing UI implementation'),\n \n /** UI path */\n path: z.string().default('/api-docs').describe('URL path for documentation UI'),\n \n /** UI theme */\n theme: z.enum(['light', 'dark', 'auto']).default('light').describe('UI color theme'),\n \n /** Enable try-it-out feature */\n enableTryItOut: z.boolean().default(true).describe('Enable interactive API testing'),\n \n /** Enable filtering */\n enableFilter: z.boolean().default(true).describe('Enable endpoint filtering'),\n \n /** Enable CORS for testing */\n enableCors: z.boolean().default(true).describe('Enable CORS for browser testing'),\n \n /** Default expand depth for models */\n defaultModelsExpandDepth: z.number().int().min(-1).default(1)\n .describe('Default expand depth for schemas (-1 = fully expand)'),\n \n /** Display request duration */\n displayRequestDuration: z.boolean().default(true).describe('Show request duration'),\n \n /** Syntax highlighting */\n syntaxHighlighting: z.boolean().default(true).describe('Enable syntax highlighting'),\n \n /** Custom CSS URL */\n customCssUrl: z.string().url().optional().describe('Custom CSS stylesheet URL'),\n \n /** Custom JavaScript URL */\n customJsUrl: z.string().url().optional().describe('Custom JavaScript URL'),\n \n /** Layout options */\n layout: z.object({\n showExtensions: z.boolean().default(false).describe('Show vendor extensions'),\n showCommonExtensions: z.boolean().default(false).describe('Show common extensions'),\n deepLinking: z.boolean().default(true).describe('Enable deep linking'),\n displayOperationId: z.boolean().default(false).describe('Display operation IDs'),\n defaultModelRendering: z.enum(['example', 'model']).default('example')\n .describe('Default model rendering mode'),\n defaultModelsExpandDepth: z.number().int().default(1).describe('Models expand depth'),\n defaultModelExpandDepth: z.number().int().default(1).describe('Single model expand depth'),\n docExpansion: z.enum(['list', 'full', 'none']).default('list')\n .describe('Documentation expansion mode'),\n }).optional().describe('Layout configuration'),\n});\n\nexport type ApiTestingUiConfig = z.infer<typeof ApiTestingUiConfigSchema>;\n\n/**\n * API Test Request Schema\n * \n * Represents a saved/example API test request.\n * \n * @example\n * ```json\n * {\n * \"name\": \"Get Customer by ID\",\n * \"description\": \"Retrieves a customer record\",\n * \"method\": \"GET\",\n * \"url\": \"/api/v1/data/customer/123\",\n * \"headers\": {\n * \"Authorization\": \"Bearer {{token}}\"\n * },\n * \"variables\": {\n * \"token\": \"sample_token\"\n * }\n * }\n * ```\n */\nexport const ApiTestRequestSchema = z.object({\n /** Request name */\n name: z.string().describe('Test request name'),\n \n /** Request description */\n description: z.string().optional().describe('Request description'),\n \n /** HTTP method */\n method: z.enum(['GET', 'POST', 'PUT', 'PATCH', 'DELETE', 'HEAD', 'OPTIONS'])\n .describe('HTTP method'),\n \n /** Request URL */\n url: z.string().describe('Request URL (can include variables)'),\n \n /** Request headers */\n headers: z.record(z.string(), z.string()).optional().default({})\n .describe('Request headers'),\n \n /** Query parameters */\n queryParams: z.record(z.string(), z.union([z.string(), z.number(), z.boolean()]))\n .optional().default({}).describe('Query parameters'),\n \n /** Request body */\n body: z.unknown().optional().describe('Request body'),\n \n /** Environment variables */\n variables: z.record(z.string(), z.unknown()).optional().default({})\n .describe('Template variables'),\n \n /** Expected response */\n expectedResponse: z.object({\n statusCode: z.number().int(),\n body: z.unknown().optional(),\n }).optional().describe('Expected response for validation'),\n});\n\nexport type ApiTestRequest = z.infer<typeof ApiTestRequestSchema>;\n\n/**\n * API Test Collection Schema\n * \n * Collection of test requests (similar to Postman collections).\n * \n * @example\n * ```json\n * {\n * \"name\": \"Customer API Tests\",\n * \"description\": \"Test collection for customer endpoints\",\n * \"variables\": {\n * \"baseUrl\": \"https://api.example.com\",\n * \"apiKey\": \"test_key\"\n * },\n * \"requests\": [...]\n * }\n * ```\n */\nexport const ApiTestCollectionSchema = z.object({\n /** Collection name */\n name: z.string().describe('Collection name'),\n \n /** Collection description */\n description: z.string().optional().describe('Collection description'),\n \n /** Collection variables */\n variables: z.record(z.string(), z.unknown()).optional().default({})\n .describe('Shared variables'),\n \n /** Test requests */\n requests: z.array(ApiTestRequestSchema).describe('Test requests in this collection'),\n \n /** Folders/grouping */\n folders: z.array(z.object({\n name: z.string(),\n description: z.string().optional(),\n requests: z.array(ApiTestRequestSchema),\n })).optional().describe('Request folders for organization'),\n});\n\nexport type ApiTestCollection = z.infer<typeof ApiTestCollectionSchema>;\n\n// ==========================================\n// API Documentation Configuration\n// ==========================================\n\n/**\n * API Changelog Entry Schema\n * \n * Documents changes in API versions.\n */\nexport const ApiChangelogEntrySchema = z.object({\n /** Version */\n version: z.string().describe('API version'),\n \n /** Release date */\n date: z.string().date().describe('Release date'),\n \n /** Changes */\n changes: z.object({\n added: z.array(z.string()).optional().default([]).describe('New features'),\n changed: z.array(z.string()).optional().default([]).describe('Changes'),\n deprecated: z.array(z.string()).optional().default([]).describe('Deprecations'),\n removed: z.array(z.string()).optional().default([]).describe('Removed features'),\n fixed: z.array(z.string()).optional().default([]).describe('Bug fixes'),\n security: z.array(z.string()).optional().default([]).describe('Security fixes'),\n }).describe('Version changes'),\n \n /** Migration guide */\n migrationGuide: z.string().optional().describe('Migration guide URL or text'),\n});\n\nexport type ApiChangelogEntry = z.infer<typeof ApiChangelogEntrySchema>;\n\n/**\n * Code Generation Template Schema\n * \n * Templates for generating client code.\n */\nexport const CodeGenerationTemplateSchema = z.object({\n /** Language/framework */\n language: z.string().describe('Target language/framework (e.g., typescript, python, curl)'),\n \n /** Template name */\n name: z.string().describe('Template name'),\n \n /** Template content */\n template: z.string().describe('Code template with placeholders'),\n \n /** Template variables */\n variables: z.array(z.string()).optional().describe('Required template variables'),\n});\n\nexport type CodeGenerationTemplate = z.infer<typeof CodeGenerationTemplateSchema>;\n\n/**\n * API Documentation Configuration Schema\n * \n * Complete configuration for API documentation and testing interface.\n * \n * @example\n * ```json\n * {\n * \"enabled\": true,\n * \"title\": \"ObjectStack API Documentation\",\n * \"version\": \"1.0.0\",\n * \"description\": \"Unified API for ObjectStack platform\",\n * \"servers\": [\n * { \"url\": \"https://api.example.com\", \"description\": \"Production\" }\n * ],\n * \"ui\": {\n * \"type\": \"swagger-ui\",\n * \"theme\": \"light\",\n * \"enableTryItOut\": true\n * },\n * \"generateOpenApi\": true,\n * \"generateTestCollections\": true\n * }\n * ```\n */\nexport const ApiDocumentationConfigSchema = z.object({\n /** Enable documentation */\n enabled: z.boolean().default(true).describe('Enable API documentation'),\n \n /** Documentation title */\n title: z.string().default('API Documentation').describe('Documentation title'),\n \n /** API version */\n version: z.string().describe('API version'),\n \n /** API description */\n description: z.string().optional().describe('API description'),\n \n /** Server configurations */\n servers: z.array(OpenApiServerSchema).optional().default([])\n .describe('API server URLs'),\n \n /** UI configuration */\n ui: ApiTestingUiConfigSchema.optional().describe('Testing UI configuration'),\n \n /** Generate OpenAPI spec */\n generateOpenApi: z.boolean().default(true).describe('Generate OpenAPI 3.0 specification'),\n \n /** Generate test collections */\n generateTestCollections: z.boolean().default(true)\n .describe('Generate API test collections'),\n \n /** Test collections */\n testCollections: z.array(ApiTestCollectionSchema).optional().default([])\n .describe('Predefined test collections'),\n \n /** API changelog */\n changelog: z.array(ApiChangelogEntrySchema).optional().default([])\n .describe('API version changelog'),\n \n /** Code generation templates */\n codeTemplates: z.array(CodeGenerationTemplateSchema).optional().default([])\n .describe('Code generation templates'),\n \n /** Terms of service */\n termsOfService: z.string().url().optional().describe('Terms of service URL'),\n \n /** Contact information */\n contact: z.object({\n name: z.string().optional(),\n url: z.string().url().optional(),\n email: z.string().email().optional(),\n }).optional().describe('Contact information'),\n \n /** License */\n license: z.object({\n name: z.string(),\n url: z.string().url().optional(),\n }).optional().describe('API license'),\n \n /** External documentation */\n externalDocs: z.object({\n description: z.string().optional(),\n url: z.string().url(),\n }).optional().describe('External documentation link'),\n \n /** Security schemes */\n securitySchemes: z.record(z.string(), OpenApiSecuritySchemeSchema).optional()\n .describe('Security scheme definitions'),\n \n /** Global tags */\n tags: z.array(z.object({\n name: z.string(),\n description: z.string().optional(),\n externalDocs: z.object({\n description: z.string().optional(),\n url: z.string().url(),\n }).optional(),\n })).optional().describe('Global tag definitions'),\n});\n\nexport type ApiDocumentationConfig = z.infer<typeof ApiDocumentationConfigSchema>;\n\n// ==========================================\n// API Documentation Generation\n// ==========================================\n\n/**\n * Generated API Documentation Schema\n * \n * Output of documentation generation process.\n */\nexport const GeneratedApiDocumentationSchema = z.object({\n /** OpenAPI specification */\n openApiSpec: OpenApiSpecSchema.optional().describe('Generated OpenAPI specification'),\n \n /** Test collections */\n testCollections: z.array(ApiTestCollectionSchema).optional()\n .describe('Generated test collections'),\n \n /** Markdown documentation */\n markdown: z.string().optional().describe('Generated markdown documentation'),\n \n /** HTML documentation */\n html: z.string().optional().describe('Generated HTML documentation'),\n \n /** Generation timestamp */\n generatedAt: z.string().datetime().describe('Generation timestamp'),\n \n /** Source APIs */\n sourceApis: z.array(z.string()).describe('Source API IDs used for generation'),\n});\n\nexport type GeneratedApiDocumentation = z.infer<typeof GeneratedApiDocumentationSchema>;\n\n// ==========================================\n// Helper Functions\n// ==========================================\n\n/**\n * Helper to create API documentation config\n */\nexport const ApiDocumentationConfig = Object.assign(ApiDocumentationConfigSchema, {\n create: <T extends z.input<typeof ApiDocumentationConfigSchema>>(config: T) => config,\n});\n\n/**\n * Helper to create API test collection\n */\nexport const ApiTestCollection = Object.assign(ApiTestCollectionSchema, {\n create: <T extends z.input<typeof ApiTestCollectionSchema>>(config: T) => config,\n});\n\n/**\n * Helper to create OpenAPI specification\n */\nexport const OpenApiSpec = Object.assign(OpenApiSpecSchema, {\n create: <T extends z.input<typeof OpenApiSpecSchema>>(config: T) => config,\n});\n","// Copyright (c) 2025 ObjectStack. Licensed under the Apache-2.0 license.\n\nimport { z } from 'zod';\nimport { AnalyticsQuerySchema, CubeSchema } from '../data/analytics.zod';\nimport { BaseResponseSchema } from './contract.zod';\n\n/**\n * Analytics API Protocol\n * \n * Defines the HTTP interface for the Semantic Layer.\n * Provides endpoints for executing analytical queries and discovering metadata.\n */\n\n// ==========================================\n// 1. API Endpoints\n// ==========================================\n\nexport const AnalyticsEndpoint = z.enum([\n '/api/v1/analytics/query', // Execute analysis\n '/api/v1/analytics/meta', // Discover cubes/metrics\n '/api/v1/analytics/sql', // Dry-run SQL generation\n]);\n\n// ==========================================\n// 2. Query Execution\n// ==========================================\n\n/**\n * Query Request Body\n */\nexport const AnalyticsQueryRequestSchema = z.object({\n query: AnalyticsQuerySchema.describe(' The analytic query definition'),\n cube: z.string().describe('Target cube name'),\n format: z.enum(['json', 'csv', 'xlsx']).default('json').describe('Response format'),\n});\n\n/**\n * Query Response (JSON)\n */\nexport const AnalyticsResultResponseSchema = BaseResponseSchema.extend({\n data: z.object({\n rows: z.array(z.record(z.string(), z.unknown())).describe('Result rows'),\n fields: z.array(z.object({\n name: z.string(),\n type: z.string(),\n })).describe('Column metadata'),\n sql: z.string().optional().describe('Executed SQL (if debug enabled)'),\n }),\n});\n\n// ==========================================\n// 3. Metadata Discovery\n// ==========================================\n\n/**\n * Meta Request\n */\nexport const GetAnalyticsMetaRequestSchema = z.object({\n cube: z.string().optional().describe('Optional cube name to filter'),\n});\n\n/**\n * Meta Response\n * Returns available cubes, metrics, and dimensions.\n */\nexport const AnalyticsMetadataResponseSchema = BaseResponseSchema.extend({\n data: z.object({\n cubes: z.array(CubeSchema).describe('Available cubes'),\n }),\n});\n\n// ==========================================\n// 4. SQL Dry-Run\n// ==========================================\n\nexport const AnalyticsSqlResponseSchema = BaseResponseSchema.extend({\n data: z.object({\n sql: z.string(),\n params: z.array(z.unknown()),\n }),\n});\n\nexport type AnalyticsEndpoint = z.infer<typeof AnalyticsEndpoint>;\nexport type AnalyticsMetadataResponse = z.infer<typeof AnalyticsMetadataResponseSchema>;\nexport type AnalyticsSqlResponse = z.infer<typeof AnalyticsSqlResponseSchema>;\n","// Copyright (c) 2025 ObjectStack. Licensed under the Apache-2.0 license.\n\nimport { z } from 'zod';\n\n/**\n * Analytics/Semantic Layer Protocol\n * \n * Defines the \"Business Logic\" for data analysis.\n * Inspired by Cube.dev, LookML, and dbt MetricFlow.\n * \n * This layer decouples the \"Physical Data\" (Tables/Columns) from the \n * \"Business Data\" (Metrics/Dimensions).\n */\n\n/**\n * Aggregation Metric Type\n * The mathematical operation to perform on a metric.\n */\nexport const AggregationMetricType = z.enum([\n 'count', \n 'sum', \n 'avg', \n 'min', \n 'max', \n 'count_distinct', \n 'number', // Custom SQL expression returning a number\n 'string', // Custom SQL expression returning a string\n 'boolean' // Custom SQL expression returning a boolean\n]);\n\n/**\n * Dimension Type\n * The nature of the grouping field.\n */\nexport const DimensionType = z.enum([\n 'string', \n 'number', \n 'boolean', \n 'time', \n 'geo'\n]);\n\n/**\n * Time Interval for Time Dimensions\n */\nexport const TimeUpdateInterval = z.enum([\n 'second', 'minute', 'hour', 'day', 'week', 'month', 'quarter', 'year'\n]);\n\n/**\n * Metric Schema\n * A quantitative measurement (e.g., \"Total Revenue\", \"Average Order Value\").\n */\nexport const MetricSchema = z.object({\n name: z.string().regex(/^[a-z_][a-z0-9_]*$/).describe('Unique metric ID'),\n label: z.string().describe('Human readable label'),\n description: z.string().optional(),\n \n type: AggregationMetricType,\n \n /** Source Calculation */\n sql: z.string().describe('SQL expression or field reference'),\n \n /** Filtering for this specific metric (e.g. \"Revenue from Premium Users\") */\n filters: z.array(z.object({\n sql: z.string()\n })).optional(),\n \n /** Format for display (e.g. \"currency\", \"percent\") */\n format: z.string().optional(),\n});\n\n/**\n * Dimension Schema\n * A categorical attribute to group by (e.g., \"Product Category\", \"Order Date\").\n */\nexport const DimensionSchema = z.object({\n name: z.string().regex(/^[a-z_][a-z0-9_]*$/).describe('Unique dimension ID'),\n label: z.string().describe('Human readable label'),\n description: z.string().optional(),\n \n type: DimensionType,\n \n /** Source Column */\n sql: z.string().describe('SQL expression or column reference'),\n \n /** For Time Dimensions: Supported Granularities */\n granularities: z.array(TimeUpdateInterval).optional(),\n});\n\n/**\n * Join Schema\n * Defines how this cube relates to others.\n */\nexport const CubeJoinSchema = z.object({\n name: z.string().describe('Target cube name'),\n relationship: z.enum(['one_to_one', 'one_to_many', 'many_to_one']).default('many_to_one'),\n sql: z.string().describe('Join condition (ON clause)'),\n});\n\n/**\n * Cube Schema\n * A logical data model representing a business entity or process for analysis.\n * Maps physical tables to business metrics and dimensions.\n */\nexport const CubeSchema = z.object({\n name: z.string().regex(/^[a-z_][a-z0-9_]*$/).describe('Cube name (snake_case)'),\n title: z.string().optional(),\n description: z.string().optional(),\n \n /** Physical Data Source */\n sql: z.string().describe('Base SQL statement or Table Name'),\n \n /** Semantic Definitions */\n measures: z.record(z.string(), MetricSchema).describe('Quantitative metrics'),\n dimensions: z.record(z.string(), DimensionSchema).describe('Qualitative attributes'),\n \n /** Relationships */\n joins: z.record(z.string(), CubeJoinSchema).optional(),\n \n /** Pre-aggregations / Caching */\n refreshKey: z.object({\n every: z.string().optional(), // e.g. \"1 hour\"\n sql: z.string().optional(), // SQL to check for data changes\n }).optional(),\n \n /** Access Control */\n public: z.boolean().default(false),\n});\n\n/**\n * Analytics Query Schema\n * The request format for the Analytics API.\n */\nexport const AnalyticsQuerySchema = z.object({\n measures: z.array(z.string()).describe('List of metrics to calculate'),\n dimensions: z.array(z.string()).optional().describe('List of dimensions to group by'),\n \n filters: z.array(z.object({\n member: z.string().describe('Dimension or Measure'),\n operator: z.enum(['equals', 'notEquals', 'contains', 'notContains', 'gt', 'gte', 'lt', 'lte', 'set', 'notSet', 'inDateRange']),\n values: z.array(z.string()).optional(),\n })).optional(),\n \n timeDimensions: z.array(z.object({\n dimension: z.string(),\n granularity: TimeUpdateInterval.optional(),\n dateRange: z.union([\n z.string(), // \"Last 7 days\"\n z.array(z.string()) // [\"2023-01-01\", \"2023-01-31\"]\n ]).optional(),\n })).optional(),\n \n order: z.record(z.string(), z.enum(['asc', 'desc'])).optional(),\n \n limit: z.number().optional(),\n offset: z.number().optional(),\n \n timezone: z.string().default('UTC'),\n});\n\nexport type Metric = z.infer<typeof MetricSchema>;\nexport type Dimension = z.infer<typeof DimensionSchema>;\nexport type CubeJoin = z.infer<typeof CubeJoinSchema>;\nexport type Cube = z.infer<typeof CubeSchema>;\nexport type AnalyticsQuery = z.infer<typeof AnalyticsQuerySchema>;\n","// Copyright (c) 2025 ObjectStack. Licensed under the Apache-2.0 license.\n\nimport { z } from 'zod';\n\n/**\n * # API Versioning Protocol\n * \n * Defines how API versions are negotiated between client and server.\n * Supports multiple versioning strategies and deprecation lifecycle management.\n * \n * Architecture Alignment:\n * - Salesforce: URL path versioning (v57.0, v58.0)\n * - Stripe: Date-based versioning (2024-01-01)\n * - Kubernetes: API group versioning (v1, v1beta1)\n * - GitHub: Accept header versioning (application/vnd.github.v3+json)\n * - Microsoft Graph: URL path versioning (v1.0, beta)\n */\n\n// ==========================================\n// Versioning Strategy\n// ==========================================\n\n/**\n * API Versioning Strategy\n * Determines how the API version is specified by clients.\n * \n * - `urlPath`: Version in URL path (e.g., /api/v1/data) — Most common, easy to understand\n * - `header`: Version in Accept header (e.g., Accept: application/vnd.objectstack.v1+json)\n * - `queryParam`: Version in query parameter (e.g., /api/data?version=v1)\n * - `dateBased`: Date-based version in header (e.g., ObjectStack-Version: 2025-01-01) — Stripe-style\n */\nexport const VersioningStrategy = z.enum([\n 'urlPath',\n 'header',\n 'queryParam',\n 'dateBased',\n]);\n\nexport type VersioningStrategy = z.infer<typeof VersioningStrategy>;\n\n// ==========================================\n// Version Lifecycle\n// ==========================================\n\n/**\n * API Version Status\n * Lifecycle state of an API version.\n * \n * - `preview`: Available for testing, may change without notice (e.g., v2beta1)\n * - `current`: The recommended stable version\n * - `supported`: Older but still maintained (receives security fixes)\n * - `deprecated`: Scheduled for removal, clients should migrate\n * - `retired`: No longer available, requests return 410 Gone\n */\nexport const VersionStatus = z.enum([\n 'preview',\n 'current',\n 'supported',\n 'deprecated',\n 'retired',\n]);\n\nexport type VersionStatus = z.infer<typeof VersionStatus>;\n\n// ==========================================\n// Version Definition\n// ==========================================\n\n/**\n * API Version Definition Schema\n * Describes a single API version and its lifecycle metadata.\n * \n * @example\n * {\n * \"version\": \"v1\",\n * \"status\": \"current\",\n * \"releasedAt\": \"2025-01-15\",\n * \"description\": \"Initial stable release\"\n * }\n * \n * @example Deprecated version\n * {\n * \"version\": \"v0\",\n * \"status\": \"deprecated\",\n * \"releasedAt\": \"2024-06-01\",\n * \"deprecatedAt\": \"2025-01-15\",\n * \"sunsetAt\": \"2025-07-15\",\n * \"migrationGuide\": \"https://docs.objectstack.dev/migrate/v0-to-v1\",\n * \"description\": \"Legacy API version\"\n * }\n */\nexport const VersionDefinitionSchema = z.object({\n /** Version identifier (e.g., \"v1\", \"v2beta1\", \"2025-01-01\") */\n version: z.string().describe('Version identifier (e.g., \"v1\", \"v2beta1\", \"2025-01-01\")'),\n\n /** Current lifecycle status */\n status: VersionStatus.describe('Lifecycle status of this version'),\n\n /** Date this version was released (ISO 8601 date) */\n releasedAt: z.string().describe('Release date (ISO 8601, e.g., \"2025-01-15\")'),\n\n /** Date this version was deprecated (ISO 8601 date) */\n deprecatedAt: z.string().optional()\n .describe('Deprecation date (ISO 8601). Only set for deprecated/retired versions'),\n\n /** Date this version will be retired (ISO 8601 date) */\n sunsetAt: z.string().optional()\n .describe('Sunset date (ISO 8601). After this date, the version returns 410 Gone'),\n\n /** URL to migration guide for moving to a newer version */\n migrationGuide: z.string().url().optional()\n .describe('URL to migration guide for upgrading from this version'),\n\n /** Human-readable description of this version */\n description: z.string().optional()\n .describe('Human-readable description or release notes summary'),\n\n /** Breaking changes introduced in or since this version */\n breakingChanges: z.array(z.string()).optional()\n .describe('List of breaking changes (for preview/new versions)'),\n});\n\nexport type VersionDefinition = z.infer<typeof VersionDefinitionSchema>;\n\n// ==========================================\n// Versioning Configuration\n// ==========================================\n\n/**\n * API Versioning Configuration Schema\n * Complete configuration for API version management.\n * \n * @example\n * {\n * \"strategy\": \"urlPath\",\n * \"current\": \"v1\",\n * \"default\": \"v1\",\n * \"versions\": [\n * { \"version\": \"v1\", \"status\": \"current\", \"releasedAt\": \"2025-01-15\" },\n * { \"version\": \"v2beta1\", \"status\": \"preview\", \"releasedAt\": \"2025-06-01\" }\n * ],\n * \"deprecation\": {\n * \"warnHeader\": true,\n * \"sunsetHeader\": true\n * }\n * }\n */\nexport const VersioningConfigSchema = z.object({\n /** Versioning strategy */\n strategy: VersioningStrategy.default('urlPath')\n .describe('How the API version is specified by clients'),\n\n /** Current (recommended) API version */\n current: z.string().describe('The current/recommended API version identifier'),\n\n /** Default version when none specified by client */\n default: z.string().describe('Fallback version when client does not specify one'),\n\n /** All available API versions */\n versions: z.array(VersionDefinitionSchema)\n .min(1)\n .describe('All available API versions with lifecycle metadata'),\n\n /** Header name for header-based versioning */\n headerName: z.string().default('ObjectStack-Version')\n .describe('HTTP header name for version negotiation (header/dateBased strategies)'),\n\n /** Query parameter name for queryParam strategy */\n queryParamName: z.string().default('version')\n .describe('Query parameter name for version specification (queryParam strategy)'),\n\n /** URL prefix pattern for urlPath strategy */\n urlPrefix: z.string().default('/api')\n .describe('URL prefix before version segment (urlPath strategy)'),\n\n /** Deprecation behavior */\n deprecation: z.object({\n /** Include Deprecation header in responses for deprecated versions */\n warnHeader: z.boolean().default(true)\n .describe('Include Deprecation header (RFC 8594) in responses'),\n\n /** Include Sunset header with retirement date */\n sunsetHeader: z.boolean().default(true)\n .describe('Include Sunset header (RFC 8594) with retirement date'),\n\n /** Include Link header pointing to migration guide */\n linkHeader: z.boolean().default(true)\n .describe('Include Link header pointing to migration guide URL'),\n\n /** Whether to reject requests to retired versions */\n rejectRetired: z.boolean().default(true)\n .describe('Return 410 Gone for retired API versions'),\n\n /** Custom deprecation warning message */\n warningMessage: z.string().optional()\n .describe('Custom warning message for deprecated version responses'),\n }).optional().describe('Deprecation lifecycle behavior'),\n\n /** Whether to include version info in discovery response */\n includeInDiscovery: z.boolean().default(true)\n .describe('Include version information in the API discovery endpoint'),\n});\n\nexport type VersioningConfig = z.infer<typeof VersioningConfigSchema>;\nexport type VersioningConfigInput = z.input<typeof VersioningConfigSchema>;\n\n// ==========================================\n// Version Negotiation Response\n// ==========================================\n\n/**\n * Version Negotiation Response Schema\n * Returned when a client requests version information or\n * included in the discovery endpoint response.\n * \n * @example\n * {\n * \"current\": \"v1\",\n * \"requested\": \"v1\",\n * \"resolved\": \"v1\",\n * \"supported\": [\"v1\", \"v2beta1\"],\n * \"deprecated\": [\"v0\"],\n * \"versions\": [...]\n * }\n */\nexport const VersionNegotiationResponseSchema = z.object({\n /** The current/recommended version */\n current: z.string().describe('Current recommended API version'),\n\n /** The version the client requested (if any) */\n requested: z.string().optional().describe('Version requested by the client'),\n\n /** The version actually being used for this request */\n resolved: z.string().describe('Resolved API version for this request'),\n\n /** All supported (non-retired) version identifiers */\n supported: z.array(z.string()).describe('All supported version identifiers'),\n\n /** Deprecated version identifiers (still functional but will be removed) */\n deprecated: z.array(z.string()).optional()\n .describe('Deprecated version identifiers'),\n\n /** Full version definitions (optional, for detailed clients) */\n versions: z.array(VersionDefinitionSchema).optional()\n .describe('Full version definitions with lifecycle metadata'),\n});\n\nexport type VersionNegotiationResponse = z.infer<typeof VersionNegotiationResponseSchema>;\n\n// ==========================================\n// Default Versioning Configuration\n// ==========================================\n\n/**\n * Default versioning configuration for ObjectStack.\n * Uses URL path strategy with v1 as the current/default version.\n */\nexport const DEFAULT_VERSIONING_CONFIG: VersioningConfigInput = {\n strategy: 'urlPath',\n current: 'v1',\n default: 'v1',\n versions: [\n {\n version: 'v1',\n status: 'current',\n releasedAt: '2025-01-15',\n description: 'ObjectStack API v1 — Initial stable release',\n },\n ],\n deprecation: {\n warnHeader: true,\n sunsetHeader: true,\n linkHeader: true,\n rejectRetired: true,\n },\n includeInDiscovery: true,\n};\n","// Copyright (c) 2025 ObjectStack. Licensed under the Apache-2.0 license.\n\nimport { z } from 'zod';\nimport { BaseResponseSchema } from './contract.zod';\n\n/**\n * Authentication Service Protocol\n * \n * Defines the standard API contracts for Identity, Session Management,\n * and Access Control.\n */\n\n// ==========================================\n// Authentication Types\n// ==========================================\n\nexport const AuthProvider = z.enum([\n 'local',\n 'google',\n 'github',\n 'microsoft',\n 'ldap',\n 'saml'\n]);\n\nexport const SessionUserSchema = z.object({\n id: z.string().describe('User ID'),\n email: z.string().email().describe('Email address'),\n emailVerified: z.boolean().default(false).describe('Is email verified?'),\n name: z.string().describe('Display name'),\n image: z.string().optional().describe('Avatar URL'),\n username: z.string().optional().describe('Username (optional)'),\n roles: z.array(z.string()).optional().default([]).describe('Assigned role IDs'),\n tenantId: z.string().optional().describe('Current tenant ID'),\n language: z.string().default('en').describe('Preferred language'),\n timezone: z.string().optional().describe('Preferred timezone'),\n createdAt: z.string().datetime().optional(),\n updatedAt: z.string().datetime().optional(),\n});\n\nexport const SessionSchema = z.object({\n id: z.string(),\n expiresAt: z.string().datetime(),\n token: z.string().optional(),\n ipAddress: z.string().optional(),\n userAgent: z.string().optional(),\n userId: z.string(),\n});\n\n// ==========================================\n// Requests\n// ==========================================\n\nexport const LoginType = z.enum(['email', 'username', 'phone', 'magic-link', 'social']);\n\nexport const LoginRequestSchema = z.object({\n type: LoginType.default('email').describe('Login method'),\n email: z.string().email().optional().describe('Required for email/magic-link'),\n username: z.string().optional().describe('Required for username login'),\n password: z.string().optional().describe('Required for password login'),\n provider: z.string().optional().describe('Required for social (google, github)'),\n redirectTo: z.string().optional().describe('Redirect URL after successful login'),\n});\n\nexport const RegisterRequestSchema = z.object({\n email: z.string().email(),\n password: z.string(),\n name: z.string(),\n image: z.string().optional(),\n});\n\nexport const RefreshTokenRequestSchema = z.object({\n refreshToken: z.string().describe('Refresh token'),\n});\n\n// ==========================================\n// Responses\n// ==========================================\n\nexport const SessionResponseSchema = BaseResponseSchema.extend({\n data: z.object({\n session: SessionSchema.describe('Active Session Info'),\n user: SessionUserSchema.describe('Current User Details'),\n token: z.string().optional().describe('Bearer token if not using cookies'),\n }),\n});\n\nexport const UserProfileResponseSchema = BaseResponseSchema.extend({\n data: SessionUserSchema,\n});\n\nexport type AuthProvider = z.infer<typeof AuthProvider>;\nexport type SessionUser = z.infer<typeof SessionUserSchema>;\nexport type SessionUserInput = z.input<typeof SessionUserSchema>;\nexport type Session = z.infer<typeof SessionSchema>;\nexport type LoginType = z.infer<typeof LoginType>;\nexport type LoginRequest = z.infer<typeof LoginRequestSchema>;\nexport type LoginRequestInput = z.input<typeof LoginRequestSchema>;\nexport type RegisterRequest = z.infer<typeof RegisterRequestSchema>;\nexport type RefreshTokenRequest = z.infer<typeof RefreshTokenRequestSchema>;\nexport type SessionResponse = z.infer<typeof SessionResponseSchema>;\nexport type UserProfileResponse = z.infer<typeof UserProfileResponseSchema>;\n","// Copyright (c) 2025 ObjectStack. Licensed under the Apache-2.0 license.\n\nimport { z } from 'zod';\n\n/**\n * Authentication Endpoint Specification\n * \n * Defines the canonical HTTP endpoints for the authentication service.\n * Based on better-auth v1.4.18 endpoint conventions.\n * \n * NOTE: ObjectStack's auth implementation uses better-auth library which has\n * established endpoint conventions. This spec documents those conventions as\n * the canonical API contract.\n */\n\n// ==========================================\n// Endpoint Path Definitions\n// ==========================================\n\n/**\n * Authentication Endpoint Paths\n * \n * These are the paths relative to the auth base route (e.g., /api/v1/auth).\n * Based on better-auth's endpoint structure.\n */\nexport const AuthEndpointPaths = {\n // Email/Password Authentication\n signInEmail: '/sign-in/email',\n signUpEmail: '/sign-up/email',\n signOut: '/sign-out',\n \n // Session Management\n getSession: '/get-session',\n \n // Password Management\n forgetPassword: '/forget-password',\n resetPassword: '/reset-password',\n \n // Email Verification\n sendVerificationEmail: '/send-verification-email',\n verifyEmail: '/verify-email',\n \n // OAuth (dynamic based on provider)\n // authorize: '/authorize/:provider'\n // callback: '/callback/:provider'\n \n // 2FA (when enabled)\n twoFactorEnable: '/two-factor/enable',\n twoFactorVerify: '/two-factor/verify',\n \n // Passkeys (when enabled)\n passkeyRegister: '/passkey/register',\n passkeyAuthenticate: '/passkey/authenticate',\n \n // Magic Links (when enabled)\n magicLinkSend: '/magic-link/send',\n magicLinkVerify: '/magic-link/verify',\n} as const;\n\n/**\n * HTTP Method + Path Specification\n * \n * Defines the complete HTTP contract for each endpoint.\n */\nexport const AuthEndpointSchema = z.object({\n /** Sign in with email and password */\n signInEmail: z.object({\n method: z.literal('POST'),\n path: z.literal(AuthEndpointPaths.signInEmail),\n description: z.literal('Sign in with email and password'),\n }),\n \n /** Register new user with email and password */\n signUpEmail: z.object({\n method: z.literal('POST'),\n path: z.literal(AuthEndpointPaths.signUpEmail),\n description: z.literal('Register new user with email and password'),\n }),\n \n /** Sign out current user */\n signOut: z.object({\n method: z.literal('POST'),\n path: z.literal(AuthEndpointPaths.signOut),\n description: z.literal('Sign out current user'),\n }),\n \n /** Get current user session */\n getSession: z.object({\n method: z.literal('GET'),\n path: z.literal(AuthEndpointPaths.getSession),\n description: z.literal('Get current user session'),\n }),\n \n /** Request password reset email */\n forgetPassword: z.object({\n method: z.literal('POST'),\n path: z.literal(AuthEndpointPaths.forgetPassword),\n description: z.literal('Request password reset email'),\n }),\n \n /** Reset password with token */\n resetPassword: z.object({\n method: z.literal('POST'),\n path: z.literal(AuthEndpointPaths.resetPassword),\n description: z.literal('Reset password with token'),\n }),\n \n /** Send email verification */\n sendVerificationEmail: z.object({\n method: z.literal('POST'),\n path: z.literal(AuthEndpointPaths.sendVerificationEmail),\n description: z.literal('Send email verification link'),\n }),\n \n /** Verify email with token */\n verifyEmail: z.object({\n method: z.literal('GET'),\n path: z.literal(AuthEndpointPaths.verifyEmail),\n description: z.literal('Verify email with token'),\n }),\n});\n\n/**\n * Endpoint Aliases\n * \n * Common aliases for better developer experience.\n * These map to the canonical better-auth endpoints.\n */\nexport const AuthEndpointAliases = {\n login: AuthEndpointPaths.signInEmail,\n register: AuthEndpointPaths.signUpEmail,\n logout: AuthEndpointPaths.signOut,\n me: AuthEndpointPaths.getSession,\n} as const;\n\n/**\n * Full Endpoint URLs\n * \n * Helper to construct full endpoint URLs given a base path.\n */\nexport function getAuthEndpointUrl(basePath: string, endpoint: keyof typeof AuthEndpointPaths): string {\n const cleanBase = basePath.replace(/\\/$/, '');\n return `${cleanBase}${AuthEndpointPaths[endpoint]}`;\n}\n\n/**\n * Endpoint Mapping\n * \n * Maps common/legacy endpoint names to canonical better-auth paths.\n * This allows clients to use simpler names while maintaining compatibility.\n */\nexport const EndpointMapping = {\n '/login': AuthEndpointPaths.signInEmail,\n '/register': AuthEndpointPaths.signUpEmail,\n '/logout': AuthEndpointPaths.signOut,\n '/me': AuthEndpointPaths.getSession,\n '/refresh': AuthEndpointPaths.getSession, // Session refresh handled by better-auth automatically\n} as const;\n\n// ==========================================\n// Type Exports\n// ==========================================\n\nexport type AuthEndpoint = z.infer<typeof AuthEndpointSchema>;\nexport type AuthEndpointPath = typeof AuthEndpointPaths[keyof typeof AuthEndpointPaths];\nexport type AuthEndpointAlias = keyof typeof AuthEndpointAliases;\nexport type EndpointMappingKey = keyof typeof EndpointMapping;\n","// Copyright (c) 2025 ObjectStack. Licensed under the Apache-2.0 license.\n\nimport { z } from 'zod';\nimport { BaseResponseSchema } from './contract.zod';\nimport { FileMetadataSchema } from '../system/object-storage.zod';\n\n/**\n * Storage Service Protocol\n * \n * Defines the API contract for client-side file operations.\n * Focuses on secure, direct-to-cloud uploads (Presigned URLs)\n * rather than proxying bytes through the API server.\n */\n\n// ==========================================\n// Requests\n// ==========================================\n\nexport const GetPresignedUrlRequestSchema = z.object({\n filename: z.string().describe('Original filename'),\n mimeType: z.string().describe('File MIME type'),\n size: z.number().describe('File size in bytes'),\n scope: z.string().default('user').describe('Target storage scope (e.g. user, private, public)'),\n bucket: z.string().optional().describe('Specific bucket override (admin only)'),\n});\n\nexport const CompleteUploadRequestSchema = z.object({\n fileId: z.string().describe('File ID returned from presigned request'),\n eTag: z.string().optional().describe('S3 ETag verification'),\n});\n\n// ==========================================\n// Responses\n// ==========================================\n\nexport const PresignedUrlResponseSchema = BaseResponseSchema.extend({\n data: z.object({\n uploadUrl: z.string().describe('PUT/POST URL for direct upload'),\n downloadUrl: z.string().optional().describe('Public/Private preview URL'),\n fileId: z.string().describe('Temporary File ID'),\n method: z.enum(['PUT', 'POST']).describe('HTTP Method to use'),\n headers: z.record(z.string(), z.string()).optional().describe('Required headers for upload'),\n expiresIn: z.number().describe('URL expiry in seconds'),\n }),\n});\n\nexport const FileUploadResponseSchema = BaseResponseSchema.extend({\n data: FileMetadataSchema.describe('Uploaded file metadata'),\n});\n\nexport type GetPresignedUrlRequest = z.infer<typeof GetPresignedUrlRequestSchema>;\nexport type CompleteUploadRequest = z.infer<typeof CompleteUploadRequestSchema>;\nexport type PresignedUrlResponse = z.infer<typeof PresignedUrlResponseSchema>;\nexport type FileUploadResponse = z.infer<typeof FileUploadResponseSchema>;\n","// Copyright (c) 2025 ObjectStack. Licensed under the Apache-2.0 license.\n\nimport { z } from 'zod';\nimport { SystemIdentifierSchema } from '../shared/identifiers.zod';\n\n/**\n * Object Storage Protocol\n * \n * Unified storage protocol that combines:\n * - Object storage systems (S3, Azure Blob, GCS, MinIO)\n * - Scoped storage configuration (temp, cache, data, logs, config, public)\n * - Multi-cloud storage providers\n * - Bucket/container configuration\n * - Access control and permissions\n * - Lifecycle policies for data retention\n * - Presigned URLs for secure direct access\n * - Multipart uploads for large files\n */\n\n// ============================================================================\n// Storage Scope Protocol (formerly from scoped-storage.zod.ts)\n// ============================================================================\n\n/**\n * Storage Scope Enum\n * Defines the lifecycle and persistence guarantee of the storage area.\n */\nexport const StorageScopeSchema = z.enum([\n 'global', // Global application-wide storage\n 'tenant', // Tenant-scoped storage (multi-tenant apps)\n 'user', // User-scoped storage\n 'session', // Session-scoped storage (ephemeral)\n 'temp', // Ephemeral, cleared on restart\n 'cache', // Ephemeral, survives restarts, cleared on LRU/Expiration\n 'data', // Persistent, backed up\n 'logs', // Append-only, rotated\n 'config', // Read-heavy, versioned\n 'public' // Publicly accessible static assets\n]).describe('Storage scope classification');\n\nexport type StorageScope = z.infer<typeof StorageScopeSchema>;\n\n/**\n * File Metadata Schema\n * Standardized file attribute structure\n */\nexport const FileMetadataSchema = z.object({\n path: z.string().describe('File path'),\n name: z.string().describe('File name'),\n size: z.number().int().describe('File size in bytes'),\n mimeType: z.string().describe('MIME type'),\n lastModified: z.string().datetime().describe('Last modified timestamp'),\n created: z.string().datetime().describe('Creation timestamp'),\n etag: z.string().optional().describe('Entity tag'),\n});\n\nexport type FileMetadata = z.infer<typeof FileMetadataSchema>;\n\n// ============================================================================\n// Enums\n// ============================================================================\n\n/**\n * Storage Provider Types\n * \n * Supported cloud and self-hosted object storage providers.\n */\nexport const StorageProviderSchema = z.enum([\n 's3', // Amazon S3\n 'azure_blob', // Azure Blob Storage\n 'gcs', // Google Cloud Storage\n 'minio', // MinIO (self-hosted S3-compatible)\n 'r2', // Cloudflare R2\n 'spaces', // DigitalOcean Spaces\n 'wasabi', // Wasabi Hot Cloud Storage\n 'backblaze', // Backblaze B2\n 'local', // Local filesystem (development only)\n]).describe('Storage provider type');\n\nexport type StorageProvider = z.infer<typeof StorageProviderSchema>;\n\n/**\n * Storage Access Control List (ACL)\n * \n * Predefined access control configurations for objects and buckets.\n */\nexport const StorageAclSchema = z.enum([\n 'private', // Owner has full control, no one else has access\n 'public_read', // Owner has full control, everyone can read\n 'public_read_write', // Owner has full control, everyone can read/write (not recommended)\n 'authenticated_read', // Owner has full control, authenticated users can read\n 'bucket_owner_read', // Object owner has full control, bucket owner can read\n 'bucket_owner_full_control', // Both object and bucket owner have full control\n]).describe('Storage access control level');\n\nexport type StorageAcl = z.infer<typeof StorageAclSchema>;\n\n/**\n * Storage Class / Tier\n * \n * Different storage tiers for cost optimization.\n * Maps to provider-specific storage classes.\n */\nexport const StorageClassSchema = z.enum([\n 'standard', // Standard/hot storage for frequently accessed data\n 'intelligent', // Intelligent tiering (auto-moves between hot/cool)\n 'infrequent_access', // Infrequent access/cool storage\n 'glacier', // Archive/cold storage (slower retrieval)\n 'deep_archive', // Deep archive (cheapest, slowest retrieval)\n]).describe('Storage class/tier for cost optimization');\n\nexport type StorageClass = z.infer<typeof StorageClassSchema>;\n\n/**\n * Lifecycle Transition Action\n */\nexport const LifecycleActionSchema = z.enum([\n 'transition', // Move to different storage class\n 'delete', // Delete the object\n 'abort', // Abort incomplete multipart uploads\n]).describe('Lifecycle policy action type');\n\nexport type LifecycleAction = z.infer<typeof LifecycleActionSchema>;\n\n// ============================================================================\n// Configuration Schemas\n// ============================================================================\n\n/**\n * Object Metadata Schema\n * \n * Standard and custom metadata attached to stored objects.\n * \n * @example\n * {\n * contentType: 'image/jpeg',\n * contentLength: 1024000,\n * etag: '\"abc123\"',\n * lastModified: new Date('2024-01-01'),\n * custom: {\n * uploadedBy: 'user123',\n * department: 'marketing'\n * }\n * }\n */\nexport const ObjectMetadataSchema = z.object({\n contentType: z.string().describe('MIME type (e.g., image/jpeg, application/pdf)'),\n contentLength: z.number().min(0).describe('File size in bytes'),\n contentEncoding: z.string().optional().describe('Content encoding (e.g., gzip)'),\n contentDisposition: z.string().optional().describe('Content disposition header'),\n contentLanguage: z.string().optional().describe('Content language'),\n cacheControl: z.string().optional().describe('Cache control directives'),\n etag: z.string().optional().describe('Entity tag for versioning/caching'),\n lastModified: z.string().datetime().optional().describe('Last modification timestamp'),\n versionId: z.string().optional().describe('Object version identifier'),\n storageClass: StorageClassSchema.optional().describe('Storage class/tier'),\n encryption: z.object({\n algorithm: z.string().describe('Encryption algorithm (e.g., AES256, aws:kms)'),\n keyId: z.string().optional().describe('KMS key ID if using managed encryption'),\n }).optional().describe('Server-side encryption configuration'),\n custom: z.record(z.string(), z.string()).optional().describe('Custom user-defined metadata'),\n});\n\nexport type ObjectMetadata = z.infer<typeof ObjectMetadataSchema>;\n\n/**\n * Presigned URL Configuration\n * \n * Configuration for generating temporary URLs for direct access to objects.\n * Useful for secure file uploads/downloads without exposing credentials.\n * \n * @example\n * // Generate download URL valid for 1 hour\n * {\n * operation: 'get',\n * expiresIn: 3600,\n * contentType: 'image/jpeg'\n * }\n * \n * @example\n * // Generate upload URL valid for 15 minutes with size limit\n * {\n * operation: 'put',\n * expiresIn: 900,\n * contentType: 'application/pdf',\n * maxSize: 10485760\n * }\n */\nexport const PresignedUrlConfigSchema = z.object({\n operation: z.enum(['get', 'put', 'delete', 'head']).describe('Allowed operation'),\n expiresIn: z.number().min(1).max(604800).describe('Expiration time in seconds (max 7 days)'),\n contentType: z.string().optional().describe('Required content type for PUT operations'),\n maxSize: z.number().min(0).optional().describe('Maximum file size in bytes for PUT operations'),\n responseContentType: z.string().optional().describe('Override content-type for GET operations'),\n responseContentDisposition: z.string().optional().describe('Override content-disposition for GET operations'),\n});\n\nexport type PresignedUrlConfig = z.infer<typeof PresignedUrlConfigSchema>;\n\n/**\n * Multipart Upload Configuration\n * \n * Configuration for chunked uploads of large files.\n * Enables resumable uploads and parallel transfer.\n * \n * @example\n * // Enable multipart for files > 100MB with 10MB chunks\n * {\n * enabled: true,\n * partSize: 10485760,\n * maxParts: 10000,\n * threshold: 104857600,\n * maxConcurrent: 4\n * }\n */\nexport const MultipartUploadConfigSchema = z.object({\n enabled: z.boolean().default(true).describe('Enable multipart uploads'),\n partSize: z.number().min(5 * 1024 * 1024).max(5 * 1024 * 1024 * 1024).default(10 * 1024 * 1024).describe('Part size in bytes (min 5MB, max 5GB)'),\n maxParts: z.number().min(1).max(10000).default(10000).describe('Maximum number of parts (max 10,000)'),\n threshold: z.number().min(0).default(100 * 1024 * 1024).describe('File size threshold to trigger multipart upload (bytes)'),\n maxConcurrent: z.number().min(1).max(100).default(4).describe('Maximum concurrent part uploads'),\n abortIncompleteAfterDays: z.number().min(1).optional().describe('Auto-abort incomplete uploads after N days'),\n});\n\nexport type MultipartUploadConfig = z.infer<typeof MultipartUploadConfigSchema>;\n\n/**\n * Access Control Configuration\n * \n * Fine-grained access control for buckets and objects.\n * \n * @example\n * {\n * acl: 'private',\n * allowedOrigins: ['https://app.example.com'],\n * allowedMethods: ['GET', 'PUT'],\n * corsEnabled: true,\n * publicAccess: {\n * allowPublicRead: false,\n * allowPublicWrite: false\n * }\n * }\n */\nexport const AccessControlConfigSchema = z.object({\n acl: StorageAclSchema.default('private').describe('Default access control level'),\n allowedOrigins: z.array(z.string()).optional().describe('CORS allowed origins'),\n allowedMethods: z.array(z.enum(['GET', 'PUT', 'POST', 'DELETE', 'HEAD'])).optional().describe('CORS allowed HTTP methods'),\n allowedHeaders: z.array(z.string()).optional().describe('CORS allowed headers'),\n exposeHeaders: z.array(z.string()).optional().describe('CORS exposed headers'),\n maxAge: z.number().min(0).optional().describe('CORS preflight cache duration in seconds'),\n corsEnabled: z.boolean().default(false).describe('Enable CORS configuration'),\n publicAccess: z.object({\n allowPublicRead: z.boolean().default(false).describe('Allow public read access'),\n allowPublicWrite: z.boolean().default(false).describe('Allow public write access'),\n allowPublicList: z.boolean().default(false).describe('Allow public bucket listing'),\n }).optional().describe('Public access control'),\n allowedIps: z.array(z.string()).optional().describe('Allowed IP addresses/CIDR blocks'),\n blockedIps: z.array(z.string()).optional().describe('Blocked IP addresses/CIDR blocks'),\n});\n\nexport type AccessControlConfig = z.infer<typeof AccessControlConfigSchema>;\n\n/**\n * Lifecycle Policy Rule\n * \n * Individual rule for automatic object lifecycle management.\n * \n * @example\n * // Transition to infrequent access after 30 days\n * {\n * id: 'move_to_ia',\n * enabled: true,\n * action: 'transition',\n * daysAfterCreation: 30,\n * targetStorageClass: 'infrequent_access'\n * }\n * \n * @example\n * // Delete objects after 365 days\n * {\n * id: 'delete_old',\n * enabled: true,\n * action: 'delete',\n * daysAfterCreation: 365\n * }\n */\nexport const LifecyclePolicyRuleSchema = z.object({\n id: SystemIdentifierSchema.describe('Rule identifier'),\n enabled: z.boolean().default(true).describe('Enable this rule'),\n action: LifecycleActionSchema.describe('Action to perform'),\n prefix: z.string().optional().describe('Object key prefix filter (e.g., \"uploads/\")'),\n tags: z.record(z.string(), z.string()).optional().describe('Object tag filters'),\n daysAfterCreation: z.number().min(0).optional().describe('Days after object creation'),\n daysAfterModification: z.number().min(0).optional().describe('Days after last modification'),\n targetStorageClass: StorageClassSchema.optional().describe('Target storage class for transition action'),\n}).refine((data) => {\n // Validate that transition action has targetStorageClass\n if (data.action === 'transition' && !data.targetStorageClass) {\n return false;\n }\n return true;\n}, {\n message: 'targetStorageClass is required when action is \"transition\"',\n});\n\nexport type LifecyclePolicyRule = z.infer<typeof LifecyclePolicyRuleSchema>;\n\n/**\n * Lifecycle Policy Configuration\n * \n * Collection of lifecycle rules for automatic data management.\n * \n * @example\n * {\n * enabled: true,\n * rules: [\n * {\n * id: 'archive_old_files',\n * enabled: true,\n * action: 'transition',\n * daysAfterCreation: 90,\n * targetStorageClass: 'glacier'\n * },\n * {\n * id: 'delete_temp_files',\n * enabled: true,\n * action: 'delete',\n * prefix: 'temp/',\n * daysAfterCreation: 7\n * }\n * ]\n * }\n */\nexport const LifecyclePolicyConfigSchema = z.object({\n enabled: z.boolean().default(false).describe('Enable lifecycle policies'),\n rules: z.array(LifecyclePolicyRuleSchema).default([]).describe('Lifecycle rules'),\n});\n\nexport type LifecyclePolicyConfig = z.infer<typeof LifecyclePolicyConfigSchema>;\n\n/**\n * Bucket Configuration Schema\n * \n * Comprehensive configuration for a storage bucket/container.\n * \n * @example\n * {\n * name: 'user_uploads',\n * label: 'User Uploads',\n * bucketName: 'my-app-uploads',\n * region: 'us-east-1',\n * provider: 's3',\n * versioning: true,\n * accessControl: {\n * acl: 'private',\n * corsEnabled: true,\n * allowedOrigins: ['https://app.example.com']\n * },\n * multipartConfig: {\n * enabled: true,\n * threshold: 104857600\n * }\n * }\n */\nexport const BucketConfigSchema = z.object({\n name: SystemIdentifierSchema.describe('Bucket identifier in ObjectStack (snake_case)'),\n label: z.string().describe('Display label'),\n bucketName: z.string().describe('Actual bucket/container name in storage provider'),\n region: z.string().optional().describe('Storage region (e.g., us-east-1, westus)'),\n provider: StorageProviderSchema.describe('Storage provider'),\n endpoint: z.string().optional().describe('Custom endpoint URL (for S3-compatible providers)'),\n pathStyle: z.boolean().default(false).describe('Use path-style URLs (for S3-compatible providers)'),\n \n versioning: z.boolean().default(false).describe('Enable object versioning'),\n encryption: z.object({\n enabled: z.boolean().default(false).describe('Enable server-side encryption'),\n algorithm: z.enum(['AES256', 'aws:kms', 'azure:kms', 'gcp:kms']).default('AES256').describe('Encryption algorithm'),\n kmsKeyId: z.string().optional().describe('KMS key ID for managed encryption'),\n }).optional().describe('Server-side encryption configuration'),\n \n accessControl: AccessControlConfigSchema.optional().describe('Access control configuration'),\n lifecyclePolicy: LifecyclePolicyConfigSchema.optional().describe('Lifecycle policy configuration'),\n multipartConfig: MultipartUploadConfigSchema.optional().describe('Multipart upload configuration'),\n \n tags: z.record(z.string(), z.string()).optional().describe('Bucket tags for organization'),\n description: z.string().optional().describe('Bucket description'),\n enabled: z.boolean().default(true).describe('Enable this bucket'),\n});\n\nexport type BucketConfig = z.infer<typeof BucketConfigSchema>;\n\n/**\n * Storage Connection Configuration\n * \n * Provider-specific connection credentials and settings.\n * \n * @example S3\n * {\n * accessKeyId: '${AWS_ACCESS_KEY_ID}',\n * secretAccessKey: '${AWS_SECRET_ACCESS_KEY}',\n * sessionToken: '${AWS_SESSION_TOKEN}',\n * region: 'us-east-1'\n * }\n * \n * @example Azure\n * {\n * accountName: 'mystorageaccount',\n * accountKey: '${AZURE_STORAGE_KEY}',\n * endpoint: 'https://mystorageaccount.blob.core.windows.net'\n * }\n */\nexport const StorageConnectionSchema = z.object({\n // AWS S3 / MinIO\n accessKeyId: z.string().optional().describe('AWS access key ID or MinIO access key'),\n secretAccessKey: z.string().optional().describe('AWS secret access key or MinIO secret key'),\n sessionToken: z.string().optional().describe('AWS session token for temporary credentials'),\n \n // Azure Blob Storage\n accountName: z.string().optional().describe('Azure storage account name'),\n accountKey: z.string().optional().describe('Azure storage account key'),\n sasToken: z.string().optional().describe('Azure SAS token'),\n \n // Google Cloud Storage\n projectId: z.string().optional().describe('GCP project ID'),\n credentials: z.string().optional().describe('GCP service account credentials JSON'),\n \n // Common\n endpoint: z.string().optional().describe('Custom endpoint URL'),\n region: z.string().optional().describe('Default region'),\n useSSL: z.boolean().default(true).describe('Use SSL/TLS for connections'),\n timeout: z.number().min(0).optional().describe('Connection timeout in milliseconds'),\n});\n\nexport type StorageConnection = z.infer<typeof StorageConnectionSchema>;\n\n/**\n * Object Storage Configuration\n * \n * Complete object storage system configuration.\n * \n * @example\n * {\n * name: 'production_storage',\n * label: 'Production File Storage',\n * provider: 's3',\n * scope: 'global',\n * connection: {\n * accessKeyId: '${AWS_ACCESS_KEY_ID}',\n * secretAccessKey: '${AWS_SECRET_ACCESS_KEY}',\n * region: 'us-east-1'\n * },\n * buckets: [\n * {\n * name: 'user_uploads',\n * label: 'User Uploads',\n * bucketName: 'prod-uploads',\n * provider: 's3',\n * region: 'us-east-1'\n * }\n * ],\n * defaultBucket: 'user_uploads'\n * }\n */\nexport const ObjectStorageConfigSchema = z.object({\n name: SystemIdentifierSchema.describe('Storage configuration identifier'),\n label: z.string().describe('Display label'),\n provider: StorageProviderSchema.describe('Primary storage provider'),\n \n /**\n * Storage scope\n * Defines the lifecycle and access pattern for this storage\n */\n scope: StorageScopeSchema.optional().default('global').describe('Storage scope'),\n \n connection: StorageConnectionSchema.describe('Connection credentials'),\n buckets: z.array(BucketConfigSchema).default([]).describe('Configured buckets'),\n defaultBucket: z.string().optional().describe('Default bucket name for operations'),\n \n /**\n * Base path or location\n * For local/scoped storage configurations\n */\n location: z.string().optional().describe('Root path (local) or base location'),\n \n /**\n * Storage quota in bytes\n */\n quota: z.number().int().positive().optional().describe('Max size in bytes'),\n \n /**\n * Provider-specific options\n */\n options: z.record(z.string(), z.unknown()).optional().describe('Provider-specific configuration options'),\n \n enabled: z.boolean().default(true).describe('Enable this storage configuration'),\n description: z.string().optional().describe('Configuration description'),\n});\n\nexport type ObjectStorageConfig = z.infer<typeof ObjectStorageConfigSchema>;\n\n// ============================================================================\n// Helper Examples\n// ============================================================================\n\n/**\n * Example: AWS S3 Configuration\n */\nexport const s3StorageExample = ObjectStorageConfigSchema.parse({\n name: 'aws_s3_storage',\n label: 'AWS S3 Production Storage',\n provider: 's3',\n connection: {\n accessKeyId: '${AWS_ACCESS_KEY_ID}',\n secretAccessKey: '${AWS_SECRET_ACCESS_KEY}',\n region: 'us-east-1',\n },\n buckets: [\n {\n name: 'user_uploads',\n label: 'User Uploads',\n bucketName: 'my-app-user-uploads',\n region: 'us-east-1',\n provider: 's3',\n versioning: true,\n encryption: {\n enabled: true,\n algorithm: 'aws:kms',\n kmsKeyId: '${AWS_KMS_KEY_ID}',\n },\n accessControl: {\n acl: 'private',\n corsEnabled: true,\n allowedOrigins: ['https://app.example.com'],\n allowedMethods: ['GET', 'PUT', 'POST'],\n },\n lifecyclePolicy: {\n enabled: true,\n rules: [\n {\n id: 'archive_old_uploads',\n enabled: true,\n action: 'transition',\n daysAfterCreation: 90,\n targetStorageClass: 'glacier',\n },\n ],\n },\n multipartConfig: {\n enabled: true,\n partSize: 10 * 1024 * 1024,\n threshold: 100 * 1024 * 1024,\n maxConcurrent: 4,\n },\n },\n ],\n defaultBucket: 'user_uploads',\n enabled: true,\n});\n\n/**\n * Example: MinIO Configuration\n */\nexport const minioStorageExample = ObjectStorageConfigSchema.parse({\n name: 'minio_local',\n label: 'MinIO Local Storage',\n provider: 'minio',\n connection: {\n accessKeyId: 'minioadmin',\n secretAccessKey: 'minioadmin',\n endpoint: 'http://localhost:9000',\n useSSL: false,\n },\n buckets: [\n {\n name: 'development_files',\n label: 'Development Files',\n bucketName: 'dev-files',\n provider: 'minio',\n endpoint: 'http://localhost:9000',\n pathStyle: true,\n accessControl: {\n acl: 'private',\n },\n },\n ],\n defaultBucket: 'development_files',\n enabled: true,\n});\n\n/**\n * Example: Azure Blob Storage Configuration\n */\nexport const azureBlobStorageExample = ObjectStorageConfigSchema.parse({\n name: 'azure_blob_storage',\n label: 'Azure Blob Storage',\n provider: 'azure_blob',\n connection: {\n accountName: 'mystorageaccount',\n accountKey: '${AZURE_STORAGE_KEY}',\n endpoint: 'https://mystorageaccount.blob.core.windows.net',\n },\n buckets: [\n {\n name: 'media_files',\n label: 'Media Files',\n bucketName: 'media',\n provider: 'azure_blob',\n region: 'eastus',\n accessControl: {\n acl: 'public_read',\n publicAccess: {\n allowPublicRead: true,\n allowPublicWrite: false,\n allowPublicList: false,\n },\n },\n },\n ],\n defaultBucket: 'media_files',\n enabled: true,\n});\n\n/**\n * Example: Google Cloud Storage Configuration\n */\nexport const gcsStorageExample = ObjectStorageConfigSchema.parse({\n name: 'gcs_storage',\n label: 'Google Cloud Storage',\n provider: 'gcs',\n connection: {\n projectId: 'my-gcp-project',\n credentials: '${GCP_SERVICE_ACCOUNT_JSON}',\n },\n buckets: [\n {\n name: 'backup_storage',\n label: 'Backup Storage',\n bucketName: 'my-app-backups',\n region: 'us-central1',\n provider: 'gcs',\n lifecyclePolicy: {\n enabled: true,\n rules: [\n {\n id: 'delete_old_backups',\n enabled: true,\n action: 'delete',\n daysAfterCreation: 30,\n },\n ],\n },\n },\n ],\n defaultBucket: 'backup_storage',\n enabled: true,\n});\n","// Copyright (c) 2025 ObjectStack. Licensed under the Apache-2.0 license.\n\nimport { z } from 'zod';\nimport { BaseResponseSchema } from './contract.zod';\nimport { ObjectSchema } from '../data/object.zod';\nimport { AppSchema } from '../ui/app.zod';\n\n/**\n * Metadata Service Protocol\n * \n * Defines the standard API contracts for fetching system metadata.\n * Frontend, IDEs, and Mobile apps use this to build dynamic UIs.\n */\n\n// ==========================================\n// Responses\n// ==========================================\n\n/**\n * Single Object Definition Response\n * Returns the full JSON schema for an Entity (Fields, Actions, Config).\n */\nexport const ObjectDefinitionResponseSchema = BaseResponseSchema.extend({\n data: ObjectSchema.describe('Full Object Schema'),\n});\n\n/**\n * App Definition Response\n * Returns the navigation, branding, and layout for an App.\n */\nexport const AppDefinitionResponseSchema = BaseResponseSchema.extend({\n data: AppSchema.describe('Full App Configuration'),\n});\n\n/**\n * All Concepts Response\n * Bulk load lightweight definitions for autocomplete/pickers.\n */\nexport const ConceptListResponseSchema = BaseResponseSchema.extend({\n data: z.array(z.object({\n name: z.string(),\n label: z.string(),\n icon: z.string().optional(),\n description: z.string().optional(),\n })).describe('List of available concepts (Objects, Apps, Flows)'),\n});\n\nexport type ObjectDefinitionResponse = z.infer<typeof ObjectDefinitionResponseSchema>;\nexport type AppDefinitionResponse = z.infer<typeof AppDefinitionResponseSchema>;\nexport type ConceptListResponse = z.infer<typeof ConceptListResponseSchema>;\n","// Copyright (c) 2025 ObjectStack. Licensed under the Apache-2.0 license.\n\nimport { z } from 'zod';\nimport { FieldSchema } from './field.zod';\nimport { ValidationRuleSchema } from './validation.zod';\nimport { StateMachineSchema } from '../automation/state-machine.zod';\n\n/**\n * API Operations Enum\n */\nexport const ApiMethod = z.enum([\n 'get', 'list', // Read\n 'create', 'update', 'delete', // Write\n 'upsert', // Idempotent Write\n 'bulk', // Batch operations\n 'aggregate', // Analytics (count, sum)\n 'history', // Audit access\n 'search', // Search access\n 'restore', 'purge', // Trash management\n 'import', 'export', // Data portability\n]);\nexport type ApiMethod = z.infer<typeof ApiMethod>;\n\n/**\n * Capability Flags\n * Defines what system features are enabled for this object.\n * \n * Optimized based on industry standards (Salesforce, ServiceNow):\n * - Added `activities` (Tasks/Events)\n * - Added `mru` (Recent Items)\n * - Added `feeds` (Social/Chatter)\n * - Grouped API permissions\n * \n * @example\n * {\n * trackHistory: true,\n * searchable: true,\n * apiEnabled: true,\n * files: true\n * }\n */\nexport const ObjectCapabilities = z.object({\n /** Enable history tracking (Audit Trail) */\n trackHistory: z.boolean().default(false).describe('Enable field history tracking for audit compliance'),\n \n /** Enable global search indexing */\n searchable: z.boolean().default(true).describe('Index records for global search'),\n \n /** Enable REST/GraphQL API access */\n apiEnabled: z.boolean().default(true).describe('Expose object via automatic APIs'),\n\n /** \n * API Supported Operations\n * Granular control over API exposure.\n */\n apiMethods: z.array(ApiMethod).optional().describe('Whitelist of allowed API operations'),\n \n /** Enable standard attachments/files engine */\n files: z.boolean().default(false).describe('Enable file attachments and document management'),\n \n /** Enable social collaboration (Comments, Mentions, Feeds) */\n feeds: z.boolean().default(false).describe('Enable social feed, comments, and mentions (Chatter-like)'),\n \n /** Enable standard Activity suite (Tasks, Calendars, Events) */\n activities: z.boolean().default(false).describe('Enable standard tasks and events tracking'),\n \n /** Enable Recycle Bin / Soft Delete */\n trash: z.boolean().default(true).describe('Enable soft-delete with restore capability'),\n\n /** Enable \"Recently Viewed\" tracking */\n mru: z.boolean().default(true).describe('Track Most Recently Used (MRU) list for users'),\n \n /** Allow cloning records */\n clone: z.boolean().default(true).describe('Allow record deep cloning'),\n});\n\n/**\n * Schema for database indexes.\n * Enhanced with additional index types and configuration options\n * \n * @example\n * {\n * name: \"idx_account_name\",\n * fields: [\"name\"],\n * type: \"btree\",\n * unique: true\n * }\n */\nexport const IndexSchema = z.object({\n name: z.string().optional().describe('Index name (auto-generated if not provided)'),\n fields: z.array(z.string()).describe('Fields included in the index'),\n type: z.enum(['btree', 'hash', 'gin', 'gist', 'fulltext']).optional().default('btree').describe('Index algorithm type'),\n unique: z.boolean().optional().default(false).describe('Whether the index enforces uniqueness'),\n partial: z.string().optional().describe('Partial index condition (SQL WHERE clause for conditional indexes)'),\n});\n\n/**\n * Search Configuration\n * Defines how this object behaves in search results.\n * \n * @example\n * {\n * fields: [\"name\", \"email\", \"phone\"],\n * displayFields: [\"name\", \"title\"],\n * filters: [\"status = 'active'\"]\n * }\n */\nexport const SearchConfigSchema = z.object({\n fields: z.array(z.string()).describe('Fields to index for full-text search weighting'),\n displayFields: z.array(z.string()).optional().describe('Fields to display in search result cards'),\n filters: z.array(z.string()).optional().describe('Default filters for search results'),\n});\n\n/**\n * Multi-Tenancy Configuration Schema\n * Configures tenant isolation strategy for SaaS applications\n * \n * @example Shared database with tenant_id isolation\n * {\n * enabled: true,\n * strategy: 'shared',\n * tenantField: 'tenant_id',\n * crossTenantAccess: false\n * }\n */\nexport const TenancyConfigSchema = z.object({\n enabled: z.boolean().describe('Enable multi-tenancy for this object'),\n strategy: z.enum(['shared', 'isolated', 'hybrid']).describe('Tenant isolation strategy: shared (single DB, row-level), isolated (separate DB per tenant), hybrid (mix)'),\n tenantField: z.string().default('tenant_id').describe('Field name for tenant identifier'),\n crossTenantAccess: z.boolean().default(false).describe('Allow cross-tenant data access (with explicit permission)'),\n});\n\n/**\n * Soft Delete Configuration Schema\n * Implements recycle bin / trash functionality\n * \n * @example Standard soft delete with cascade\n * {\n * enabled: true,\n * field: 'deleted_at',\n * cascadeDelete: true\n * }\n */\nexport const SoftDeleteConfigSchema = z.object({\n enabled: z.boolean().describe('Enable soft delete (trash/recycle bin)'),\n field: z.string().default('deleted_at').describe('Field name for soft delete timestamp'),\n cascadeDelete: z.boolean().default(false).describe('Cascade soft delete to related records'),\n});\n\n/**\n * Versioning Configuration Schema\n * Implements record versioning and history tracking\n * \n * @example Snapshot versioning with 90-day retention\n * {\n * enabled: true,\n * strategy: 'snapshot',\n * retentionDays: 90,\n * versionField: 'version'\n * }\n */\nexport const VersioningConfigSchema = z.object({\n enabled: z.boolean().describe('Enable record versioning'),\n strategy: z.enum(['snapshot', 'delta', 'event-sourcing']).describe('Versioning strategy: snapshot (full copy), delta (changes only), event-sourcing (event log)'),\n retentionDays: z.number().min(1).optional().describe('Number of days to retain old versions (undefined = infinite)'),\n versionField: z.string().default('version').describe('Field name for version number/timestamp'),\n});\n\n/**\n * Partitioning Strategy Schema\n * Configures table partitioning for performance at scale\n * \n * @example Range partitioning by date (monthly)\n * {\n * enabled: true,\n * strategy: 'range',\n * key: 'created_at',\n * interval: '1 month'\n * }\n */\nexport const PartitioningConfigSchema = z.object({\n enabled: z.boolean().describe('Enable table partitioning'),\n strategy: z.enum(['range', 'hash', 'list']).describe('Partitioning strategy: range (date ranges), hash (consistent hashing), list (predefined values)'),\n key: z.string().describe('Field name to partition by'),\n interval: z.string().optional().describe('Partition interval for range strategy (e.g., \"1 month\", \"1 year\")'),\n}).refine((data) => {\n // If strategy is 'range', interval must be provided\n if (data.strategy === 'range' && !data.interval) {\n return false;\n }\n return true;\n}, {\n message: 'interval is required when strategy is \"range\"',\n});\n\n/**\n * Change Data Capture (CDC) Configuration Schema\n * Enables real-time data streaming to external systems\n * \n * @example Stream all changes to Kafka\n * {\n * enabled: true,\n * events: ['insert', 'update', 'delete'],\n * destination: 'kafka://events.objectstack'\n * }\n */\nexport const CDCConfigSchema = z.object({\n enabled: z.boolean().describe('Enable Change Data Capture'),\n events: z.array(z.enum(['insert', 'update', 'delete'])).describe('Event types to capture'),\n destination: z.string().describe('Destination endpoint (e.g., \"kafka://topic\", \"webhook://url\")'),\n});\n\n/**\n * Base Object Schema Definition\n * \n * The Blueprint of a Business Object.\n * Represents a table, a collection, or a virtual entity.\n * \n * @example\n * ```yaml\n * name: project_task\n * label: Project Task\n * icon: task\n * fields:\n * project:\n * type: lookup\n * reference: project\n * status:\n * type: select\n * options: [todo, in_progress, done]\n * enable:\n * trackHistory: true\n * files: true\n * ```\n */\nconst ObjectSchemaBase = z.object({\n /** \n * Identity & Metadata \n */\n name: z.string().regex(/^[a-z_][a-z0-9_]*$/).describe('Machine unique key (snake_case). Immutable.'),\n label: z.string().optional().describe('Human readable singular label (e.g. \"Account\")'),\n pluralLabel: z.string().optional().describe('Human readable plural label (e.g. \"Accounts\")'),\n description: z.string().optional().describe('Developer documentation / description'),\n icon: z.string().optional().describe('Icon name (Lucide/Material) for UI representation'),\n \n /**\n * Taxonomy & Organization\n */\n tags: z.array(z.string()).optional().describe('Categorization tags (e.g. \"sales\", \"system\", \"reference\")'),\n active: z.boolean().optional().default(true).describe('Is the object active and usable'),\n isSystem: z.boolean().optional().default(false).describe('Is system object (protected from deletion)'),\n abstract: z.boolean().optional().default(false).describe('Is abstract base object (cannot be instantiated)'),\n\n /** \n * Storage & Virtualization \n */\n datasource: z.string().optional().default('default').describe('Target Datasource ID. \"default\" is the primary DB.'),\n tableName: z.string().optional().describe('Physical table/collection name in the target datasource'),\n \n /** \n * Data Model \n */\n fields: z.record(z.string().regex(/^[a-z_][a-z0-9_]*$/, {\n message: 'Field names must be lowercase snake_case (e.g., \"first_name\", \"company\", \"annual_revenue\")',\n }), FieldSchema).describe('Field definitions map. Keys must be snake_case identifiers.'),\n indexes: z.array(IndexSchema).optional().describe('Database performance indexes'),\n \n /**\n * Advanced Data Management\n */\n \n // Multi-tenancy configuration\n tenancy: TenancyConfigSchema.optional().describe('Multi-tenancy configuration for SaaS applications'),\n \n // Soft delete configuration\n softDelete: SoftDeleteConfigSchema.optional().describe('Soft delete (trash/recycle bin) configuration'),\n \n // Versioning configuration\n versioning: VersioningConfigSchema.optional().describe('Record versioning and history tracking configuration'),\n \n // Partitioning strategy\n partitioning: PartitioningConfigSchema.optional().describe('Table partitioning configuration for performance'),\n \n // Change Data Capture\n cdc: CDCConfigSchema.optional().describe('Change Data Capture (CDC) configuration for real-time data streaming'),\n \n /**\n * Logic & Validation (Co-located)\n * Best Practice: Define rules close to data.\n */\n validations: z.array(ValidationRuleSchema).optional().describe('Object-level validation rules'),\n \n /**\n * State Machine(s)\n * Named record of state machines, where each key is a unique machine identifier.\n * Multiple machines allow parallel lifecycles (e.g., status + payment_status + approval_status).\n * \n * @example stateMachines: { lifecycle: {...}, payment: {...}, approval: {...} }\n */\n stateMachines: z.record(z.string(), StateMachineSchema).optional().describe('Named state machines for parallel lifecycles (e.g., status, payment, approval)'),\n\n /** \n * Display & UI Hints (Data-Layer)\n */\n titleFormat: z.string().optional().describe('Title expression (e.g. \"{name} - {code}\"). Overrides nameField.'),\n compactLayout: z.array(z.string()).optional().describe('Primary fields for hover/cards/lookups'),\n \n /** \n * Search Engine Config \n */\n search: SearchConfigSchema.optional().describe('Search engine configuration'),\n \n /** \n * System Capabilities \n */\n enable: ObjectCapabilities.optional().describe('Enabled system features modules'),\n\n /** Record Types */\n recordTypes: z.array(z.string()).optional().describe('Record type names for this object'),\n\n /** Sharing Model */\n sharingModel: z.enum(['private', 'read', 'read_write', 'full']).optional().describe('Default sharing model'),\n\n /** Key Prefix */\n keyPrefix: z.string().max(5).optional().describe('Short prefix for record IDs (e.g., \"001\" for Account)'),\n});\n\n/**\n * Enhanced ObjectSchema with Factory\n */\nexport const ObjectSchema = Object.assign(ObjectSchemaBase, {\n create: <T extends z.input<typeof ObjectSchemaBase>>(config: T) => config,\n});\n\nexport type ServiceObject = z.infer<typeof ObjectSchemaBase>;\nexport type ServiceObjectInput = z.input<typeof ObjectSchemaBase>;\nexport type ObjectCapabilities = z.infer<typeof ObjectCapabilities>;\nexport type ObjectIndex = z.infer<typeof IndexSchema>;\nexport type TenancyConfig = z.infer<typeof TenancyConfigSchema>;\nexport type SoftDeleteConfig = z.infer<typeof SoftDeleteConfigSchema>;\nexport type VersioningConfig = z.infer<typeof VersioningConfigSchema>;\nexport type PartitioningConfig = z.infer<typeof PartitioningConfigSchema>;\nexport type CDCConfig = z.infer<typeof CDCConfigSchema>;\n\n// =================================================================\n// Object Ownership Model\n// =================================================================\n\n/**\n * How a package relates to an object it references.\n * \n * - `own`: This package is the original author/owner of the object.\n * Only one package may own a given object name. The owner defines\n * the base schema (table name, primary key, core fields).\n * \n * - `extend`: This package adds fields, views, or actions to an\n * existing object owned by another package. Multiple packages\n * may extend the same object. Extensions are merged at boot time.\n * \n * Follows Salesforce/ServiceNow patterns:\n * object name = database table name, globally unique, no namespace prefix.\n */\nexport const ObjectOwnershipEnum = z.enum(['own', 'extend']);\nexport type ObjectOwnership = z.infer<typeof ObjectOwnershipEnum>;\n\n/**\n * Object Extension Entry — used in `objectExtensions` array.\n * Declares fields/config to merge into an existing object owned by another package.\n * \n * @example\n * ```ts\n * objectExtensions: [{\n * extend: 'contact', // target object FQN\n * fields: { sales_stage: Field.select([...]) },\n * }]\n * ```\n */\nexport const ObjectExtensionSchema = z.object({\n /** The target object name (FQN) to extend */\n extend: z.string().describe('Target object name (FQN) to extend'),\n \n /** Fields to merge into the target object (additive) */\n fields: z.record(z.string(), FieldSchema).optional().describe('Fields to add/override'),\n \n /** Override label */\n label: z.string().optional(),\n \n /** Override plural label */\n pluralLabel: z.string().optional(),\n \n /** Override description */\n description: z.string().optional(),\n \n /** Additional validation rules to add */\n validations: z.array(ValidationRuleSchema).optional(),\n \n /** Additional indexes to add */\n indexes: z.array(IndexSchema).optional(),\n \n /** Merge priority. Higher number applied later (wins on conflict). Default: 200 */\n priority: z.number().int().min(0).max(999).default(200).describe('Merge priority (higher = applied later)'),\n});\n\nexport type ObjectExtension = z.infer<typeof ObjectExtensionSchema>;\n","// Copyright (c) 2025 ObjectStack. Licensed under the Apache-2.0 license.\n\nimport { z } from 'zod';\nimport { SystemIdentifierSchema } from '../shared/identifiers.zod';\nimport { EncryptionConfigSchema } from '../system/encryption.zod';\nimport { MaskingRuleSchema } from '../system/masking.zod';\n\n/**\n * Field Type Enum\n */\nexport const FieldType = z.enum([\n // Core Text\n 'text', 'textarea', 'email', 'url', 'phone', 'password',\n // Rich Content\n 'markdown', 'html', 'richtext',\n // Numbers\n 'number', 'currency', 'percent', \n // Date & Time\n 'date', 'datetime', 'time',\n // Logic\n 'boolean', 'toggle', // Toggle is a distinct UI from checkbox\n // Selection\n 'select', // Single select dropdown\n 'multiselect', // Multi select (often tags)\n 'radio', // Radio group\n 'checkboxes', // Checkbox group\n // Relational\n 'lookup', 'master_detail', // Dynamic reference\n 'tree', // Hierarchical reference\n // Media\n 'image', 'file', 'avatar', 'video', 'audio',\n // Calculated / System\n 'formula', 'summary', 'autonumber',\n // Enhanced Types\n 'location', // GPS coordinates\n 'address', // Structured address\n 'code', // Code editor (JSON/SQL/JS)\n 'json', // Structured JSON data\n 'color', // Color picker\n 'rating', // Star rating\n 'slider', // Numeric slider\n 'signature', // Digital signature\n 'qrcode', // QR code / Barcode\n 'progress', // Progress bar\n 'tags', // Simple tag list\n // AI/ML Types\n 'vector', // Vector embeddings for AI/ML (semantic search, RAG)\n]);\n\nexport type FieldType = z.infer<typeof FieldType>;\n\n/**\n * Select Option Schema\n * \n * Defines option values for select/picklist fields.\n * \n * **CRITICAL RULE**: The `value` field is a machine identifier that gets stored in the database.\n * It MUST be lowercase to avoid case-sensitivity issues in queries and comparisons.\n * \n * @example Good\n * { label: 'New', value: 'new' }\n * { label: 'In Progress', value: 'in_progress' }\n * { label: 'Closed Won', value: 'closed_won' }\n * \n * @example Bad (will be rejected)\n * { label: 'New', value: 'New' } // uppercase\n * { label: 'In Progress', value: 'In Progress' } // spaces and uppercase\n * { label: 'Closed Won', value: 'Closed_Won' } // mixed case\n */\nexport const SelectOptionSchema = z.object({\n label: z.string().describe('Display label (human-readable, any case allowed)'),\n value: SystemIdentifierSchema.describe('Stored value (lowercase machine identifier)'),\n color: z.string().optional().describe('Color code for badges/charts'),\n default: z.boolean().optional().describe('Is default option'),\n});\n\n/**\n * Location Coordinates Schema\n * GPS coordinates for location field type\n */\nexport const LocationCoordinatesSchema = z.object({\n latitude: z.number().min(-90).max(90).describe('Latitude coordinate'),\n longitude: z.number().min(-180).max(180).describe('Longitude coordinate'),\n altitude: z.number().optional().describe('Altitude in meters'),\n accuracy: z.number().optional().describe('Accuracy in meters'),\n});\n\n/**\n * Currency Configuration Schema\n * Configuration for currency field type supporting multi-currency\n * \n * Note: Currency codes are validated by length only (3 characters) to support:\n * - Standard ISO 4217 codes (USD, EUR, CNY, etc.)\n * - Cryptocurrency codes (BTC, ETH, etc.)\n * - Custom business-specific codes\n * Stricter validation can be implemented at the application layer based on business requirements.\n */\nexport const CurrencyConfigSchema = z.object({\n precision: z.number().int().min(0).max(10).default(2).describe('Decimal precision (default: 2)'),\n currencyMode: z.enum(['dynamic', 'fixed']).default('dynamic').describe('Currency mode: dynamic (user selectable) or fixed (single currency)'),\n defaultCurrency: z.string().length(3).default('CNY').describe('Default or fixed currency code (ISO 4217, e.g., USD, CNY, EUR)'),\n});\n\n/**\n * Currency Value Schema\n * Runtime value structure for currency fields\n * \n * Note: Currency codes are validated by length only (3 characters) to support flexibility.\n * See CurrencyConfigSchema for details on currency code validation strategy.\n */\nexport const CurrencyValueSchema = z.object({\n value: z.number().describe('Monetary amount'),\n currency: z.string().length(3).describe('Currency code (ISO 4217)'),\n});\n\n/**\n * Address Schema\n * Structured address for address field type\n */\nexport const AddressSchema = z.object({\n street: z.string().optional().describe('Street address'),\n city: z.string().optional().describe('City name'),\n state: z.string().optional().describe('State/Province'),\n postalCode: z.string().optional().describe('Postal/ZIP code'),\n country: z.string().optional().describe('Country name or code'),\n countryCode: z.string().optional().describe('ISO country code (e.g., US, GB)'),\n formatted: z.string().optional().describe('Formatted address string'),\n});\n\n/**\n * Vector Configuration Schema\n * Configuration for vector field type supporting AI/ML embeddings\n * \n * Vector fields store numerical embeddings for semantic search, similarity matching,\n * and Retrieval-Augmented Generation (RAG) workflows.\n * \n * @example\n * // Text embeddings for semantic search\n * {\n * dimensions: 1536, // OpenAI text-embedding-ada-002\n * distanceMetric: 'cosine',\n * indexed: true\n * }\n * \n * @example\n * // Image embeddings with normalization\n * {\n * dimensions: 512, // ResNet-50\n * distanceMetric: 'euclidean',\n * normalized: true,\n * indexed: true\n * }\n */\nexport const VectorConfigSchema = z.object({\n dimensions: z.number().int().min(1).max(10000).describe('Vector dimensionality (e.g., 1536 for OpenAI embeddings)'),\n distanceMetric: z.enum(['cosine', 'euclidean', 'dotProduct', 'manhattan']).default('cosine').describe('Distance/similarity metric for vector search'),\n normalized: z.boolean().default(false).describe('Whether vectors are normalized (unit length)'),\n indexed: z.boolean().default(true).describe('Whether to create a vector index for fast similarity search'),\n indexType: z.enum(['hnsw', 'ivfflat', 'flat']).optional().describe('Vector index algorithm (HNSW for high accuracy, IVFFlat for large datasets)'),\n});\n\n/**\n * File Attachment Configuration Schema\n * Configuration for file and attachment field types\n * \n * Provides comprehensive file upload capabilities with:\n * - File type restrictions (allowed/blocked)\n * - File size limits (min/max)\n * - Virus scanning integration\n * - Storage provider integration\n * - Image-specific features (dimensions, thumbnails)\n * \n * @example Basic file upload with size limit\n * {\n * maxSize: 10485760, // 10MB\n * allowedTypes: ['.pdf', '.docx', '.xlsx'],\n * virusScan: true\n * }\n * \n * @example Image upload with validation\n * {\n * maxSize: 5242880, // 5MB\n * allowedTypes: ['.jpg', '.jpeg', '.png', '.webp'],\n * imageValidation: {\n * maxWidth: 4096,\n * maxHeight: 4096,\n * generateThumbnails: true\n * }\n * }\n */\nexport const FileAttachmentConfigSchema = z.object({\n /** File Size Limits */\n minSize: z.number().min(0).optional().describe('Minimum file size in bytes'),\n maxSize: z.number().min(1).optional().describe('Maximum file size in bytes (e.g., 10485760 = 10MB)'),\n \n /** File Type Restrictions */\n allowedTypes: z.array(z.string()).optional().describe('Allowed file extensions (e.g., [\".pdf\", \".docx\", \".jpg\"])'),\n blockedTypes: z.array(z.string()).optional().describe('Blocked file extensions (e.g., [\".exe\", \".bat\", \".sh\"])'),\n allowedMimeTypes: z.array(z.string()).optional().describe('Allowed MIME types (e.g., [\"image/jpeg\", \"application/pdf\"])'),\n blockedMimeTypes: z.array(z.string()).optional().describe('Blocked MIME types'),\n \n /** Virus Scanning */\n virusScan: z.boolean().default(false).describe('Enable virus scanning for uploaded files'),\n virusScanProvider: z.enum(['clamav', 'virustotal', 'metadefender', 'custom']).optional().describe('Virus scanning service provider'),\n virusScanOnUpload: z.boolean().default(true).describe('Scan files immediately on upload'),\n quarantineOnThreat: z.boolean().default(true).describe('Quarantine files if threat detected'),\n \n /** Storage Configuration */\n storageProvider: z.string().optional().describe('Object storage provider name (references ObjectStorageConfig)'),\n storageBucket: z.string().optional().describe('Target bucket name'),\n storagePrefix: z.string().optional().describe('Storage path prefix (e.g., \"uploads/documents/\")'),\n \n /** Image-Specific Validation */\n imageValidation: z.object({\n minWidth: z.number().min(1).optional().describe('Minimum image width in pixels'),\n maxWidth: z.number().min(1).optional().describe('Maximum image width in pixels'),\n minHeight: z.number().min(1).optional().describe('Minimum image height in pixels'),\n maxHeight: z.number().min(1).optional().describe('Maximum image height in pixels'),\n aspectRatio: z.string().optional().describe('Required aspect ratio (e.g., \"16:9\", \"1:1\")'),\n generateThumbnails: z.boolean().default(false).describe('Auto-generate thumbnails'),\n thumbnailSizes: z.array(z.object({\n name: z.string().describe('Thumbnail variant name (e.g., \"small\", \"medium\", \"large\")'),\n width: z.number().min(1).describe('Thumbnail width in pixels'),\n height: z.number().min(1).describe('Thumbnail height in pixels'),\n crop: z.boolean().default(false).describe('Crop to exact dimensions'),\n })).optional().describe('Thumbnail size configurations'),\n preserveMetadata: z.boolean().default(false).describe('Preserve EXIF metadata'),\n autoRotate: z.boolean().default(true).describe('Auto-rotate based on EXIF orientation'),\n }).optional().describe('Image-specific validation rules'),\n \n /** Upload Behavior */\n allowMultiple: z.boolean().default(false).describe('Allow multiple file uploads (overrides field.multiple)'),\n allowReplace: z.boolean().default(true).describe('Allow replacing existing files'),\n allowDelete: z.boolean().default(true).describe('Allow deleting uploaded files'),\n requireUpload: z.boolean().default(false).describe('Require at least one file when field is required'),\n \n /** Metadata Extraction */\n extractMetadata: z.boolean().default(true).describe('Extract file metadata (name, size, type, etc.)'),\n extractText: z.boolean().default(false).describe('Extract text content from documents (OCR/parsing)'),\n \n /** Versioning */\n versioningEnabled: z.boolean().default(false).describe('Keep previous versions of replaced files'),\n maxVersions: z.number().min(1).optional().describe('Maximum number of versions to retain'),\n \n /** Access Control */\n publicRead: z.boolean().default(false).describe('Allow public read access to uploaded files'),\n presignedUrlExpiry: z.number().min(60).max(604800).default(3600).describe('Presigned URL expiration in seconds (default: 1 hour)'),\n}).refine((data) => {\n // Validate minSize is less than or equal to maxSize\n if (data.minSize !== undefined && data.maxSize !== undefined && data.minSize > data.maxSize) {\n return false;\n }\n return true;\n}, {\n message: 'minSize must be less than or equal to maxSize',\n}).refine((data) => {\n // Validate virusScanProvider requires virusScan to be enabled\n if (data.virusScanProvider !== undefined && data.virusScan !== true) {\n return false;\n }\n return true;\n}, {\n message: 'virusScanProvider requires virusScan to be enabled',\n});\n\n/**\n * Data Quality Rules Schema\n * Defines data quality validation and monitoring for fields\n * \n * @example Unique SSN field with completeness requirement\n * {\n * uniqueness: true,\n * completeness: 0.95, // 95% of records must have this field\n * accuracy: {\n * source: 'government_db',\n * threshold: 0.98\n * }\n * }\n */\nexport const DataQualityRulesSchema = z.object({\n /** Enforce uniqueness constraint */\n uniqueness: z.boolean().default(false).describe('Enforce unique values across all records'),\n \n /** Completeness ratio (0-1) indicating minimum percentage of non-null values */\n completeness: z.number().min(0).max(1).default(0).describe('Minimum ratio of non-null values (0-1, default: 0 = no requirement)'),\n \n /** Accuracy validation against authoritative source */\n accuracy: z.object({\n source: z.string().describe('Reference data source for validation (e.g., \"api.verify.com\", \"master_data\")'),\n threshold: z.number().min(0).max(1).describe('Minimum accuracy threshold (0-1, e.g., 0.95 = 95% match required)'),\n }).optional().describe('Accuracy validation configuration'),\n});\n\n/**\n * Computed Field Caching Schema\n * Configuration for caching computed/formula field results\n * \n * @example Cache product price with 1-hour TTL, invalidate on inventory changes\n * {\n * enabled: true,\n * ttl: 3600,\n * invalidateOn: ['inventory.quantity', 'pricing.discount']\n * }\n */\nexport const ComputedFieldCacheSchema = z.object({\n /** Enable caching for this computed field */\n enabled: z.boolean().describe('Enable caching for computed field results'),\n \n /** Time-to-live in seconds */\n ttl: z.number().min(0).describe('Cache TTL in seconds (0 = no expiration)'),\n \n /** Array of field paths that trigger cache invalidation when changed */\n invalidateOn: z.array(z.string()).describe('Field paths that invalidate cache (e.g., [\"inventory.quantity\", \"pricing.base_price\"])'),\n});\n\n/**\n * Field Schema - Best Practice Enterprise Pattern\n */\n/**\n * Field Definition Schema\n * Defines the properties, type, and behavior of a single field (column) on an object.\n * \n * @example Lookup Field\n * {\n * name: \"account_id\",\n * label: \"Account\",\n * type: \"lookup\",\n * reference: \"accounts\",\n * required: true\n * }\n * \n * @example Select Field\n * {\n * name: \"status\",\n * label: \"Status\",\n * type: \"select\",\n * options: [\n * { label: \"Open\", value: \"open\" },\n * { label: \"Closed\", value: \"closed\" }\n * ],\n * defaultValue: \"open\"\n * }\n */\nexport const FieldSchema = z.object({\n /** Identity */\n name: z.string().regex(/^[a-z_][a-z0-9_]*$/).describe('Machine name (snake_case)').optional(),\n label: z.string().optional().describe('Human readable label'),\n type: FieldType.describe('Field Data Type'),\n description: z.string().optional().describe('Tooltip/Help text'),\n format: z.string().optional().describe('Format string (e.g. email, phone)'),\n\n /** Database Constraints */\n required: z.boolean().default(false).describe('Is required'),\n searchable: z.boolean().default(false).describe('Is searchable'),\n multiple: z.boolean().default(false).describe('Allow multiple values (Stores as Array/JSON). Applicable for select, lookup, file, image.'),\n unique: z.boolean().default(false).describe('Is unique constraint'),\n defaultValue: z.unknown().optional().describe('Default value'),\n \n /** Text/String Constraints */\n maxLength: z.number().optional().describe('Max character length'),\n minLength: z.number().optional().describe('Min character length'),\n \n /** Number Constraints */\n precision: z.number().optional().describe('Total digits'),\n scale: z.number().optional().describe('Decimal places'),\n min: z.number().optional().describe('Minimum value'),\n max: z.number().optional().describe('Maximum value'),\n\n /** Selection Options */\n options: z.array(SelectOptionSchema).optional().describe('Static options for select/multiselect'),\n\n /** Relationship Config */\n reference: z.string().optional().describe('Target Object Name'),\n referenceFilters: z.array(z.string()).optional().describe('Filters applied to lookup dialogs (e.g. \"active = true\")'),\n writeRequiresMasterRead: z.boolean().optional().describe('If true, user needs read access to master record to edit this field'),\n deleteBehavior: z.enum(['set_null', 'cascade', 'restrict']).optional().default('set_null').describe('What happens if referenced record is deleted'),\n\n /** Calculation */\n expression: z.string().optional().describe('Formula expression'),\n summaryOperations: z.object({\n object: z.string(),\n field: z.string(),\n function: z.enum(['count', 'sum', 'min', 'max', 'avg'])\n }).optional().describe('Roll-up summary definition'),\n\n /** Enhanced Field Type Configurations */\n // Code field config\n language: z.string().optional().describe('Programming language for syntax highlighting (e.g., javascript, python, sql)'),\n theme: z.string().optional().describe('Code editor theme (e.g., dark, light, monokai)'),\n lineNumbers: z.boolean().optional().describe('Show line numbers in code editor'),\n \n // Rating field config\n maxRating: z.number().optional().describe('Maximum rating value (default: 5)'),\n allowHalf: z.boolean().optional().describe('Allow half-star ratings'),\n \n // Location field config\n displayMap: z.boolean().optional().describe('Display map widget for location field'),\n allowGeocoding: z.boolean().optional().describe('Allow address-to-coordinate conversion'),\n \n // Address field config\n addressFormat: z.enum(['us', 'uk', 'international']).optional().describe('Address format template'),\n \n // Color field config\n colorFormat: z.enum(['hex', 'rgb', 'rgba', 'hsl']).optional().describe('Color value format'),\n allowAlpha: z.boolean().optional().describe('Allow transparency/alpha channel'),\n presetColors: z.array(z.string()).optional().describe('Preset color options'),\n \n // Slider field config\n step: z.number().optional().describe('Step increment for slider (default: 1)'),\n showValue: z.boolean().optional().describe('Display current value on slider'),\n marks: z.record(z.string(), z.string()).optional().describe('Custom marks/labels at specific values (e.g., {0: \"Low\", 50: \"Medium\", 100: \"High\"})'),\n \n // QR Code / Barcode field config\n // Note: qrErrorCorrection is only applicable when barcodeFormat='qr'\n // Runtime validation should enforce this constraint\n barcodeFormat: z.enum(['qr', 'ean13', 'ean8', 'code128', 'code39', 'upca', 'upce']).optional().describe('Barcode format type'),\n qrErrorCorrection: z.enum(['L', 'M', 'Q', 'H']).optional().describe('QR code error correction level (L=7%, M=15%, Q=25%, H=30%). Only applicable when barcodeFormat is \"qr\"'),\n displayValue: z.boolean().optional().describe('Display human-readable value below barcode/QR code'),\n allowScanning: z.boolean().optional().describe('Enable camera scanning for barcode/QR code input'),\n\n // Currency field config\n currencyConfig: CurrencyConfigSchema.optional().describe('Configuration for currency field type'),\n\n // Vector field config\n vectorConfig: VectorConfigSchema.optional().describe('Configuration for vector field type (AI/ML embeddings)'),\n\n // File attachment field config\n fileAttachmentConfig: FileAttachmentConfigSchema.optional().describe('Configuration for file and attachment field types'),\n\n /** Enhanced Security & Compliance */\n // Encryption configuration\n encryptionConfig: EncryptionConfigSchema.optional().describe('Field-level encryption configuration for sensitive data (GDPR/HIPAA/PCI-DSS)'),\n \n // Data masking rules\n maskingRule: MaskingRuleSchema.optional().describe('Data masking rules for PII protection'),\n \n // Audit trail\n auditTrail: z.boolean().default(false).describe('Enable detailed audit trail for this field (tracks all changes with user and timestamp)'),\n \n /** Field Dependencies & Relationships */\n // Field dependencies\n dependencies: z.array(z.string()).optional().describe('Array of field names that this field depends on (for formulas, visibility rules, etc.)'),\n \n /** Computed Field Optimization */\n // Computed field caching\n cached: ComputedFieldCacheSchema.optional().describe('Caching configuration for computed/formula fields'),\n \n /** Data Quality & Governance */\n // Data quality rules\n dataQuality: DataQualityRulesSchema.optional().describe('Data quality validation and monitoring rules'),\n\n /** Security & Visibility */\n hidden: z.boolean().default(false).describe('Hidden from default UI'),\n readonly: z.boolean().default(false).describe('Read-only in UI'),\n sortable: z.boolean().optional().default(true).describe('Whether field is sortable in list views'),\n inlineHelpText: z.string().optional().describe('Help text displayed below the field in forms'),\n trackFeedHistory: z.boolean().optional().describe('Track field changes in Chatter/activity feed (Salesforce pattern)'),\n caseSensitive: z.boolean().optional().describe('Whether text comparisons are case-sensitive'),\n autonumberFormat: z.string().optional().describe('Auto-number display format pattern (e.g., \"CASE-{0000}\")'),\n /** Indexing */\n index: z.boolean().default(false).describe('Create standard database index'),\n externalId: z.boolean().default(false).describe('Is external ID for upsert operations'),\n});\n\nexport type Field = z.infer<typeof FieldSchema>;\nexport type SelectOption = z.infer<typeof SelectOptionSchema>;\nexport type LocationCoordinates = z.infer<typeof LocationCoordinatesSchema>;\nexport type Address = z.infer<typeof AddressSchema>;\nexport type CurrencyConfig = z.infer<typeof CurrencyConfigSchema>;\nexport type CurrencyConfigInput = z.input<typeof CurrencyConfigSchema>;\nexport type CurrencyValue = z.infer<typeof CurrencyValueSchema>;\nexport type VectorConfig = z.infer<typeof VectorConfigSchema>;\nexport type VectorConfigInput = z.input<typeof VectorConfigSchema>;\nexport type FileAttachmentConfig = z.infer<typeof FileAttachmentConfigSchema>;\nexport type FileAttachmentConfigInput = z.input<typeof FileAttachmentConfigSchema>;\nexport type DataQualityRules = z.infer<typeof DataQualityRulesSchema>;\nexport type DataQualityRulesInput = z.input<typeof DataQualityRulesSchema>;\nexport type ComputedFieldCache = z.infer<typeof ComputedFieldCacheSchema>;\n\n/**\n * Field Factory Helper\n */\nexport type FieldInput = Omit<Partial<Field>, 'type'>;\n\nexport const Field = {\n text: (config: FieldInput = {}) => ({ type: 'text', ...config } as const),\n textarea: (config: FieldInput = {}) => ({ type: 'textarea', ...config } as const),\n number: (config: FieldInput = {}) => ({ type: 'number', ...config } as const),\n boolean: (config: FieldInput = {}) => ({ type: 'boolean', ...config } as const),\n date: (config: FieldInput = {}) => ({ type: 'date', ...config } as const),\n datetime: (config: FieldInput = {}) => ({ type: 'datetime', ...config } as const),\n currency: (config: FieldInput = {}) => ({ type: 'currency', ...config } as const),\n percent: (config: FieldInput = {}) => ({ type: 'percent', ...config } as const),\n url: (config: FieldInput = {}) => ({ type: 'url', ...config } as const),\n email: (config: FieldInput = {}) => ({ type: 'email', ...config } as const),\n phone: (config: FieldInput = {}) => ({ type: 'phone', ...config } as const),\n image: (config: FieldInput = {}) => ({ type: 'image', ...config } as const),\n file: (config: FieldInput = {}) => ({ type: 'file', ...config } as const),\n avatar: (config: FieldInput = {}) => ({ type: 'avatar', ...config } as const),\n formula: (config: FieldInput = {}) => ({ type: 'formula', ...config } as const),\n summary: (config: FieldInput = {}) => ({ type: 'summary', ...config } as const),\n autonumber: (config: FieldInput = {}) => ({ type: 'autonumber', ...config } as const),\n markdown: (config: FieldInput = {}) => ({ type: 'markdown', ...config } as const),\n html: (config: FieldInput = {}) => ({ type: 'html', ...config } as const),\n password: (config: FieldInput = {}) => ({ type: 'password', ...config } as const),\n \n /**\n * Select field helper with backward-compatible API\n * \n * Automatically converts option values to lowercase to enforce naming conventions.\n * \n * @example Old API (array first) - auto-converts to lowercase\n * Field.select(['High', 'Low'], { label: 'Priority' })\n * // Results in: [{ label: 'High', value: 'high' }, { label: 'Low', value: 'low' }]\n * \n * @example New API (config object) - enforces lowercase\n * Field.select({ options: [{label: 'High', value: 'high'}], label: 'Priority' })\n * \n * @example Multi-word values - converts to snake_case\n * Field.select(['In Progress', 'Closed Won'], { label: 'Status' })\n * // Results in: [{ label: 'In Progress', value: 'in_progress' }, { label: 'Closed Won', value: 'closed_won' }]\n */\n select: (optionsOrConfig: SelectOption[] | string[] | FieldInput & { options: SelectOption[] | string[] }, config?: FieldInput) => {\n // Helper function to convert string to lowercase snake_case\n const toSnakeCase = (str: string): string => {\n return str\n .toLowerCase()\n .replace(/\\s+/g, '_') // Replace spaces with underscores\n .replace(/[^a-z0-9_]/g, ''); // Remove invalid characters (keeping underscores only)\n };\n\n // Support both old and new signatures:\n // Old: Field.select(['a', 'b'], { label: 'X' })\n // New: Field.select({ options: [{label: 'A', value: 'a'}], label: 'X' })\n let options: SelectOption[];\n let finalConfig: FieldInput;\n \n if (Array.isArray(optionsOrConfig)) {\n // Old signature: array as first param\n options = optionsOrConfig.map(o => \n typeof o === 'string' \n ? { label: o, value: toSnakeCase(o) } // Auto-convert string to snake_case\n : { ...o, value: o.value.toLowerCase() } // Ensure value is lowercase\n );\n finalConfig = config || {};\n } else {\n // New signature: config object with options\n options = (optionsOrConfig.options || []).map(o => \n typeof o === 'string' \n ? { label: o, value: toSnakeCase(o) } // Auto-convert string to snake_case\n : { ...o, value: o.value.toLowerCase() } // Ensure value is lowercase\n );\n // Remove options from config to avoid confusion\n const { options: _, ...restConfig } = optionsOrConfig;\n finalConfig = restConfig;\n }\n \n return { type: 'select', options, ...finalConfig } as const;\n },\n\n \n lookup: (reference: string, config: FieldInput = {}) => ({ \n type: 'lookup', \n reference, \n ...config \n } as const),\n \n masterDetail: (reference: string, config: FieldInput = {}) => ({ \n type: 'master_detail', \n reference, \n ...config \n } as const),\n\n // Enhanced Field Type Helpers\n location: (config: FieldInput = {}) => ({ \n type: 'location', \n ...config \n } as const),\n \n address: (config: FieldInput = {}) => ({ \n type: 'address', \n ...config \n } as const),\n \n richtext: (config: FieldInput = {}) => ({ \n type: 'richtext', \n ...config \n } as const),\n \n code: (language?: string, config: FieldInput = {}) => ({ \n type: 'code', \n language,\n ...config \n } as const),\n \n color: (config: FieldInput = {}) => ({ \n type: 'color', \n ...config \n } as const),\n \n rating: (maxRating: number = 5, config: FieldInput = {}) => ({ \n type: 'rating', \n maxRating,\n ...config \n } as const),\n \n signature: (config: FieldInput = {}) => ({ \n type: 'signature', \n ...config \n } as const),\n \n slider: (config: FieldInput = {}) => ({ \n type: 'slider', \n ...config \n } as const),\n \n qrcode: (config: FieldInput = {}) => ({ \n type: 'qrcode', \n ...config \n } as const),\n \n vector: (dimensions: number, config: FieldInput = {}) => ({ \n type: 'vector', \n vectorConfig: {\n dimensions,\n distanceMetric: 'cosine' as const,\n normalized: false,\n indexed: true,\n ...config.vectorConfig\n },\n ...config \n } as const),\n};\n","// Copyright (c) 2025 ObjectStack. Licensed under the Apache-2.0 license.\n\nimport { z } from 'zod';\n\n/**\n * Field-level encryption protocol\n * GDPR/HIPAA/PCI-DSS compliant\n */\nexport const EncryptionAlgorithmSchema = z.enum([\n 'aes-256-gcm',\n 'aes-256-cbc',\n 'chacha20-poly1305',\n]).describe('Supported encryption algorithm');\n\nexport type EncryptionAlgorithm = z.infer<typeof EncryptionAlgorithmSchema>;\n\nexport const KeyManagementProviderSchema = z.enum([\n 'local',\n 'aws-kms',\n 'azure-key-vault',\n 'gcp-kms',\n 'hashicorp-vault',\n]).describe('Key management service provider');\n\nexport type KeyManagementProvider = z.infer<typeof KeyManagementProviderSchema>;\n\nexport const KeyRotationPolicySchema = z.object({\n enabled: z.boolean().default(false).describe('Enable automatic key rotation'),\n frequencyDays: z.number().min(1).default(90).describe('Rotation frequency in days'),\n retainOldVersions: z.number().default(3).describe('Number of old key versions to retain'),\n autoRotate: z.boolean().default(true).describe('Automatically rotate without manual approval'),\n}).describe('Policy for automatic encryption key rotation');\n\nexport type KeyRotationPolicy = z.infer<typeof KeyRotationPolicySchema>;\nexport type KeyRotationPolicyInput = z.input<typeof KeyRotationPolicySchema>;\n\nexport const EncryptionConfigSchema = z.object({\n enabled: z.boolean().default(false).describe('Enable field-level encryption'),\n algorithm: EncryptionAlgorithmSchema.default('aes-256-gcm').describe('Encryption algorithm'),\n keyManagement: z.object({\n provider: KeyManagementProviderSchema.describe('Key management service provider'),\n keyId: z.string().optional().describe('Key identifier in the provider'),\n rotationPolicy: KeyRotationPolicySchema.optional().describe('Key rotation policy'),\n }).describe('Key management configuration'),\n scope: z.enum(['field', 'record', 'table', 'database']).describe('Encryption scope level'),\n deterministicEncryption: z.boolean().default(false).describe('Allows equality queries on encrypted data'),\n searchableEncryption: z.boolean().default(false).describe('Allows search on encrypted data'),\n}).describe('Field-level encryption configuration');\n\nexport type EncryptionConfig = z.infer<typeof EncryptionConfigSchema>;\nexport type EncryptionConfigInput = z.input<typeof EncryptionConfigSchema>;\n\nexport const FieldEncryptionSchema = z.object({\n fieldName: z.string().describe('Name of the field to encrypt'),\n encryptionConfig: EncryptionConfigSchema.describe('Encryption settings for this field'),\n indexable: z.boolean().default(false).describe('Allow indexing on encrypted field'),\n}).describe('Per-field encryption assignment');\n\nexport type FieldEncryption = z.infer<typeof FieldEncryptionSchema>;\nexport type FieldEncryptionInput = z.input<typeof FieldEncryptionSchema>;\n","// Copyright (c) 2025 ObjectStack. Licensed under the Apache-2.0 license.\n\nimport { z } from 'zod';\n\n/**\n * Data masking protocol for PII protection\n */\nexport const MaskingStrategySchema = z.enum([\n 'redact', // Complete redaction: ****\n 'partial', // Partial masking: 138****5678\n 'hash', // Hash value: sha256(value)\n 'tokenize', // Tokenization: token-12345\n 'randomize', // Randomize: generate random value\n 'nullify', // Null value: null\n 'substitute', // Substitute with dummy data\n]).describe('Data masking strategy for PII protection');\n\nexport type MaskingStrategy = z.infer<typeof MaskingStrategySchema>;\n\nexport const MaskingRuleSchema = z.object({\n field: z.string().describe('Field name to apply masking to'),\n strategy: MaskingStrategySchema.describe('Masking strategy to use'),\n pattern: z.string().optional().describe('Regex pattern for partial masking'),\n preserveFormat: z.boolean().default(true).describe('Keep the original data format after masking'),\n preserveLength: z.boolean().default(true).describe('Keep the original data length after masking'),\n roles: z.array(z.string()).optional().describe('Roles that see masked data'),\n exemptRoles: z.array(z.string()).optional().describe('Roles that see unmasked data'),\n}).describe('Masking rule for a single field');\n\nexport type MaskingRule = z.infer<typeof MaskingRuleSchema>;\nexport type MaskingRuleInput = z.input<typeof MaskingRuleSchema>;\n\nexport const MaskingConfigSchema = z.object({\n enabled: z.boolean().default(false).describe('Enable data masking'),\n rules: z.array(MaskingRuleSchema).describe('List of field-level masking rules'),\n auditUnmasking: z.boolean().default(true).describe('Log when masked data is accessed unmasked'),\n}).describe('Top-level data masking configuration for PII protection');\n\nexport type MaskingConfig = z.infer<typeof MaskingConfigSchema>;\nexport type MaskingConfigInput = z.input<typeof MaskingConfigSchema>;\n","// Copyright (c) 2025 ObjectStack. Licensed under the Apache-2.0 license.\n\nimport { z } from 'zod';\n\n/**\n * # ObjectStack Validation Protocol\n * \n * This module defines the validation schema protocol for ObjectStack, providing a comprehensive\n * type-safe validation system similar to Salesforce's validation rules but with enhanced capabilities.\n * \n * ## Overview\n * \n * Validation rules are applied at the data layer to ensure data integrity and enforce business logic.\n * The system supports multiple validation types:\n * \n * 1. **Script Validation**: Formula-based validation using expressions\n * 2. **Uniqueness Validation**: Enforce unique constraints across fields\n * 3. **State Machine Validation**: Control allowed state transitions\n * 4. **Format Validation**: Validate field formats (email, URL, regex, etc.)\n * 5. **Cross-Field Validation**: Validate relationships between multiple fields\n * 6. **Async Validation**: Remote validation via API calls\n * 7. **Custom Validation**: User-defined validation functions\n * 8. **Conditional Validation**: Apply validations based on conditions\n * \n * ## Salesforce Comparison\n * \n * ObjectStack validation rules are inspired by Salesforce validation rules but enhanced:\n * - Salesforce: Formula-based validation with `Error Condition Formula`\n * - ObjectStack: Multiple validation types with composable rules\n * \n * Example Salesforce validation rule:\n * ```\n * Rule Name: Discount_Cannot_Exceed_40_Percent\n * Error Condition Formula: Discount_Percent__c > 0.40\n * Error Message: Discount cannot exceed 40%.\n * ```\n * \n * Equivalent ObjectStack rule:\n * ```typescript\n * {\n * type: 'script',\n * name: 'discount_cannot_exceed_40_percent',\n * condition: 'discount_percent > 0.40',\n * message: 'Discount cannot exceed 40%',\n * severity: 'error'\n * }\n * ```\n */\n\n/**\n * Base Validation Rule\n * \n * All validation rules extend from this base schema with common properties.\n * \n * ## Industry Standard Enhancements\n * - **Label/Description**: Essential for governance in large systems with thousands of rules.\n * - **Events**: granular control over validation timing (Context-aware validation).\n * - **Tags**: categorization for reporting and management.\n */\nconst BaseValidationSchema = z.object({\n // Identification\n name: z.string().regex(/^[a-z_][a-z0-9_]*$/).describe('Unique rule name (snake_case)'),\n label: z.string().optional().describe('Human-readable label for the rule listing'),\n description: z.string().optional().describe('Administrative notes explaining the business reason'),\n \n // Execution Control\n active: z.boolean().default(true),\n events: z.array(z.enum(['insert', 'update', 'delete'])).default(['insert', 'update']).describe('Validation contexts'),\n \n // Classification\n tags: z.array(z.string()).optional().describe('Categorization tags (e.g., \"compliance\", \"billing\")'),\n \n // Feedback\n severity: z.enum(['error', 'warning', 'info']).default('error'),\n message: z.string().describe('Error message to display to the user'),\n});\n\n/**\n * 1. Script/Expression Validation\n * Generic formula-based validation.\n */\nexport const ScriptValidationSchema = BaseValidationSchema.extend({\n type: z.literal('script'),\n condition: z.string().describe('Formula expression. If TRUE, validation fails. (e.g. amount < 0)'),\n});\n\n/**\n * 2. Uniqueness Validation\n * specialized optimized check for unique constraints.\n */\nexport const UniquenessValidationSchema = BaseValidationSchema.extend({\n type: z.literal('unique'),\n fields: z.array(z.string()).describe('Fields that must be combined unique'),\n scope: z.string().optional().describe('Formula condition for scope (e.g. active = true)'),\n caseSensitive: z.boolean().default(true),\n});\n\n/**\n * 3. State Machine Validation\n * State transition logic.\n */\nexport const StateMachineValidationSchema = BaseValidationSchema.extend({\n type: z.literal('state_machine'),\n field: z.string().describe('State field (e.g. status)'),\n transitions: z.record(z.string(), z.array(z.string())).describe('Map of { OldState: [AllowedNewStates] }'),\n});\n\n/**\n * 4. Value Format Validation\n * Regex or specialized formats.\n */\nexport const FormatValidationSchema = BaseValidationSchema.extend({\n type: z.literal('format'),\n field: z.string(),\n regex: z.string().optional(),\n format: z.enum(['email', 'url', 'phone', 'json']).optional(),\n});\n\n/**\n * 5. Cross-Field Validation\n * Validates relationships between multiple fields.\n * \n * ## Use Cases\n * - Date range validations (end_date > start_date)\n * - Amount comparisons (discount < total)\n * - Complex business rules involving multiple fields\n * \n * ## Salesforce Examples\n * \n * ### Example 1: Close Date Must Be In Current or Future Month\n * **Salesforce Formula:**\n * ```\n * MONTH(CloseDate) < MONTH(TODAY()) ||\n * YEAR(CloseDate) < YEAR(TODAY())\n * ```\n * \n * **ObjectStack Equivalent:**\n * ```typescript\n * {\n * type: 'cross_field',\n * name: 'close_date_future',\n * condition: 'MONTH(close_date) >= MONTH(TODAY()) AND YEAR(close_date) >= YEAR(TODAY())',\n * fields: ['close_date'],\n * message: 'Close Date must be in the current or a future month'\n * }\n * ```\n * \n * ### Example 2: Discount Validation\n * **Salesforce Formula:**\n * ```\n * Discount__c > (Amount__c * 0.40)\n * ```\n * \n * **ObjectStack Equivalent:**\n * ```typescript\n * {\n * type: 'cross_field',\n * name: 'discount_limit',\n * condition: 'discount > (amount * 0.40)',\n * fields: ['discount', 'amount'],\n * message: 'Discount cannot exceed 40% of the amount'\n * }\n * ```\n * \n * ### Example 3: Opportunity Must Have Products\n * **Salesforce Formula:**\n * ```\n * ISBLANK(Products__c) && ISPICKVAL(StageName, \"Closed Won\")\n * ```\n * \n * **ObjectStack Equivalent:**\n * ```typescript\n * {\n * type: 'cross_field',\n * name: 'products_required_for_won',\n * condition: 'products = null AND stage = \"closed_won\"',\n * fields: ['products', 'stage'],\n * message: 'Opportunity must have products to be marked as Closed Won'\n * }\n * ```\n */\nexport const CrossFieldValidationSchema = BaseValidationSchema.extend({\n type: z.literal('cross_field'),\n condition: z.string().describe('Formula expression comparing fields (e.g. \"end_date > start_date\")'),\n fields: z.array(z.string()).describe('Fields involved in the validation'),\n});\n\n/**\n * 6. JSON Structure Validation\n * Validates JSON fields against a JSON Schema.\n * \n * ## Use Cases\n * - Validating configuration objects stored in JSON fields\n * - Enforcing API payload structures\n * - Complex nested data validation\n */\nexport const JSONValidationSchema = BaseValidationSchema.extend({\n type: z.literal('json_schema'),\n field: z.string().describe('JSON field to validate'),\n schema: z.record(z.string(), z.unknown()).describe('JSON Schema object definition'),\n});\n\n/**\n * 7. Async Validation\n * Remote validation via API call or database query.\n * \n * ## Use Cases\n * \n * ### 1. Email Uniqueness Check\n * Check if an email address is already registered in the system.\n * ```typescript\n * {\n * type: 'async',\n * name: 'unique_email',\n * field: 'email',\n * validatorUrl: '/api/users/check-email',\n * message: 'This email address is already registered',\n * debounce: 500, // Wait 500ms after user stops typing\n * timeout: 3000\n * }\n * ```\n * \n * ### 2. Username Availability\n * Verify username is available before form submission.\n * ```typescript\n * {\n * type: 'async',\n * name: 'username_available',\n * field: 'username',\n * validatorUrl: '/api/users/check-username',\n * message: 'This username is already taken',\n * debounce: 300,\n * timeout: 2000\n * }\n * ```\n * \n * ### 3. Tax ID Validation\n * Validate tax ID with government API (e.g., IRS, HMRC).\n * ```typescript\n * {\n * type: 'async',\n * name: 'validate_tax_id',\n * field: 'tax_id',\n * validatorFunction: 'validateTaxIdWithIRS',\n * message: 'Invalid Tax ID number',\n * timeout: 10000, // Government APIs may be slow\n * params: { country: 'US', format: 'EIN' }\n * }\n * ```\n * \n * ### 4. Credit Card Validation\n * Verify credit card with payment gateway without charging.\n * ```typescript\n * {\n * type: 'async',\n * name: 'validate_card',\n * field: 'card_number',\n * validatorUrl: 'https://api.stripe.com/v1/tokens/validate',\n * message: 'Invalid credit card number',\n * timeout: 5000,\n * params: { \n * mode: 'validate_only',\n * checkFunds: false \n * }\n * }\n * ```\n * \n * ### 5. Address Validation\n * Validate and standardize addresses using geocoding services.\n * ```typescript\n * {\n * type: 'async',\n * name: 'validate_address',\n * field: 'street_address',\n * validatorFunction: 'validateAddressWithGoogleMaps',\n * message: 'Unable to verify address',\n * timeout: 4000,\n * params: {\n * includeFields: ['city', 'state', 'zip'],\n * strictMode: true,\n * country: 'US'\n * }\n * }\n * ```\n * \n * ### 6. Domain Name Availability\n * Check if domain name is available for registration.\n * ```typescript\n * {\n * type: 'async',\n * name: 'domain_available',\n * field: 'domain_name',\n * validatorUrl: '/api/domains/check-availability',\n * message: 'This domain is already taken or reserved',\n * debounce: 500,\n * timeout: 2000\n * }\n * ```\n * \n * ### 7. Coupon Code Validation\n * Verify coupon code is valid and not expired.\n * ```typescript\n * {\n * type: 'async',\n * name: 'validate_coupon',\n * field: 'coupon_code',\n * validatorUrl: '/api/coupons/validate',\n * message: 'Invalid or expired coupon code',\n * timeout: 2000,\n * params: {\n * checkExpiration: true,\n * checkUsageLimit: true,\n * userId: '{{current_user_id}}'\n * }\n * }\n * ```\n */\nexport const AsyncValidationSchema = BaseValidationSchema.extend({\n type: z.literal('async'),\n field: z.string().describe('Field to validate'),\n validatorUrl: z.string().optional().describe('External API endpoint for validation'),\n method: z.enum(['GET', 'POST']).default('GET').describe('HTTP method for external call'),\n headers: z.record(z.string(), z.string()).optional().describe('Custom headers for the request'),\n validatorFunction: z.string().optional().describe('Reference to custom validator function'),\n timeout: z.number().optional().default(5000).describe('Timeout in milliseconds'),\n debounce: z.number().optional().describe('Debounce delay in milliseconds'),\n params: z.record(z.string(), z.unknown()).optional().describe('Additional parameters to pass to validator'),\n});\n\n/**\n * 8. Custom Validator Function\n * User-defined validation logic with code reference.\n */\nexport const CustomValidatorSchema = BaseValidationSchema.extend({\n type: z.literal('custom'),\n handler: z.string().describe('Name of the custom validation function registered in the system'),\n params: z.record(z.string(), z.unknown()).optional().describe('Parameters passed to the custom handler'),\n});\n\n/**\n * 9. Master Validation Rule Schema\n */\n/** Base type for validation rules - used for z.lazy() recursive type annotation */\nexport interface BaseValidationRuleShape {\n type: string;\n name: string;\n message: string;\n label?: string;\n description?: string;\n active?: boolean;\n events?: ('insert' | 'update' | 'delete')[];\n tags?: string[];\n severity?: 'error' | 'warning' | 'info';\n [key: string]: unknown;\n}\n\nexport const ValidationRuleSchema: z.ZodType<BaseValidationRuleShape> = z.lazy(() =>\n z.discriminatedUnion('type', [\n ScriptValidationSchema,\n UniquenessValidationSchema,\n StateMachineValidationSchema,\n FormatValidationSchema,\n CrossFieldValidationSchema,\n JSONValidationSchema,\n AsyncValidationSchema,\n CustomValidatorSchema,\n ConditionalValidationSchema,\n ])\n);\n\n/**\n * 8. Conditional Validation\n * Validation that only applies when a condition is met.\n * \n * ## Overview\n * Conditional validations follow the pattern: \"Validate X only if Y is true\"\n * This allows for context-aware validation rules that adapt to different scenarios.\n * \n * ## Use Cases\n * \n * ### 1. Validate Based on Record Type\n * Apply different validation rules based on the type of record.\n * ```typescript\n * {\n * type: 'conditional',\n * name: 'enterprise_approval_required',\n * when: 'account_type = \"enterprise\"',\n * message: 'Enterprise validation',\n * then: {\n * type: 'script',\n * name: 'require_approval',\n * message: 'Enterprise accounts require manager approval',\n * condition: 'approval_status = null'\n * }\n * }\n * ```\n * \n * ### 2. Conditional Field Requirements\n * Require certain fields only when specific conditions are met.\n * ```typescript\n * {\n * type: 'conditional',\n * name: 'shipping_address_when_required',\n * when: 'requires_shipping = true',\n * message: 'Shipping validation',\n * then: {\n * type: 'script',\n * name: 'shipping_address_required',\n * message: 'Shipping address is required for physical products',\n * condition: 'shipping_address = null OR shipping_address = \"\"'\n * }\n * }\n * ```\n * \n * ### 3. Amount-Based Validation\n * Apply different rules based on transaction amount.\n * ```typescript\n * {\n * type: 'conditional',\n * name: 'high_value_approval',\n * when: 'order_total > 10000',\n * message: 'High value order validation',\n * then: {\n * type: 'script',\n * name: 'manager_approval_required',\n * message: 'Orders over $10,000 require manager approval',\n * condition: 'manager_approval_id = null'\n * },\n * otherwise: {\n * type: 'script',\n * name: 'standard_validation',\n * message: 'Payment method is required',\n * condition: 'payment_method = null'\n * }\n * }\n * ```\n * \n * ### 4. Regional Compliance\n * Apply region-specific validation rules.\n * ```typescript\n * {\n * type: 'conditional',\n * name: 'regional_compliance',\n * when: 'region = \"EU\"',\n * message: 'EU compliance validation',\n * then: {\n * type: 'script',\n * name: 'gdpr_consent',\n * message: 'GDPR consent is required for EU customers',\n * condition: 'gdpr_consent_given = false'\n * },\n * otherwise: {\n * type: 'script',\n * name: 'tos_acceptance',\n * message: 'Terms of Service acceptance required',\n * condition: 'tos_accepted = false'\n * }\n * }\n * ```\n * \n * ### 5. Nested Conditional Validation\n * Create complex validation logic with nested conditions.\n * ```typescript\n * {\n * type: 'conditional',\n * name: 'country_state_validation',\n * when: 'country = \"US\"',\n * message: 'US-specific validation',\n * then: {\n * type: 'conditional',\n * name: 'california_validation',\n * when: 'state = \"CA\"',\n * message: 'California-specific validation',\n * then: {\n * type: 'script',\n * name: 'ca_tax_id_required',\n * message: 'California requires a valid tax ID',\n * condition: 'tax_id = null OR NOT(REGEX(tax_id, \"^\\\\d{2}-\\\\d{7}$\"))'\n * }\n * }\n * }\n * ```\n * \n * ### 6. Tax Validation for Taxable Items\n * Only validate tax fields when the item is taxable.\n * ```typescript\n * {\n * type: 'conditional',\n * name: 'tax_field_validation',\n * when: 'is_taxable = true',\n * message: 'Tax validation',\n * then: {\n * type: 'script',\n * name: 'tax_code_required',\n * message: 'Tax code is required for taxable items',\n * condition: 'tax_code = null OR tax_code = \"\"'\n * }\n * }\n * ```\n * \n * ### 7. Role-Based Validation\n * Apply validation based on user role.\n * ```typescript\n * {\n * type: 'conditional',\n * name: 'role_based_approval_limit',\n * when: 'user_role = \"manager\"',\n * message: 'Manager approval limits',\n * then: {\n * type: 'script',\n * name: 'manager_limit',\n * message: 'Managers can approve up to $50,000',\n * condition: 'approval_amount > 50000'\n * }\n * }\n * ```\n * \n * ## Salesforce Pattern Comparison\n * \n * Salesforce doesn't have explicit \"conditional validation\" rules but achieves similar\n * behavior using formula logic. ObjectStack makes this pattern explicit and composable.\n * \n * **Salesforce Approach:**\n * ```\n * IF(\n * ISPICKVAL(Type, \"Enterprise\"),\n * AND(Amount > 100000, ISBLANK(Approval__c)),\n * FALSE\n * )\n * ```\n * \n * **ObjectStack Approach:**\n * ```typescript\n * {\n * type: 'conditional',\n * name: 'enterprise_high_value',\n * when: 'type = \"enterprise\"',\n * then: {\n * type: 'cross_field',\n * name: 'amount_approval',\n * condition: 'amount > 100000 AND approval = null',\n * fields: ['amount', 'approval']\n * }\n * }\n * ```\n */\nexport const ConditionalValidationSchema = BaseValidationSchema.extend({\n type: z.literal('conditional'),\n when: z.string().describe('Condition formula (e.g. \"type = \\'enterprise\\'\")'),\n then: ValidationRuleSchema.describe('Validation rule to apply when condition is true'),\n otherwise: ValidationRuleSchema.optional().describe('Validation rule to apply when condition is false'),\n});\n\nexport type ValidationRule = z.infer<typeof ValidationRuleSchema>;\nexport type ScriptValidation = z.infer<typeof ScriptValidationSchema>;\nexport type UniquenessValidation = z.infer<typeof UniquenessValidationSchema>;\nexport type StateMachineValidation = z.infer<typeof StateMachineValidationSchema>;\nexport type FormatValidation = z.infer<typeof FormatValidationSchema>;\nexport type CrossFieldValidation = z.infer<typeof CrossFieldValidationSchema>;\nexport type JSONValidation = z.infer<typeof JSONValidationSchema>;\nexport type AsyncValidation = z.infer<typeof AsyncValidationSchema>;\nexport type CustomValidation = z.infer<typeof CustomValidatorSchema>;\nexport type ConditionalValidation = z.infer<typeof ConditionalValidationSchema>;","// Copyright (c) 2025 ObjectStack. Licensed under the Apache-2.0 license.\n\nimport { z } from 'zod';\nimport { SnakeCaseIdentifierSchema } from '../shared/identifiers.zod';\n\n/**\n * XState-inspired State Machine Protocol\n * Used to define strict business logic constraints and lifecycle management.\n * Prevent AI \"hallucinations\" by enforcing valid valid transitions.\n */\n\n// --- Primitives ---\n\n/**\n * References a named action (side effect)\n * Can be a script, a webhook, or a field update.\n */\nexport const ActionRefSchema = z.union([\n z.string().describe('Action Name'),\n z.object({\n type: z.string(), // e.g., 'xstate.assign', 'log', 'email'\n params: z.record(z.string(), z.unknown()).optional()\n })\n]);\n\n/**\n * References a named condition (guard)\n * Must evaluate to true for the transition to occur.\n */\nexport const GuardRefSchema = z.union([\n z.string().describe('Guard Name (e.g., \"isManager\", \"amountGT1000\")'),\n z.object({\n type: z.string(),\n params: z.record(z.string(), z.unknown()).optional()\n })\n]);\n\n// --- Core Structure ---\n\n/**\n * State Transition Definition\n * \"When EVENT happens, if GUARD is true, go to TARGET and run ACTIONS\"\n */\nexport const TransitionSchema = z.object({\n target: z.string().optional().describe('Target State ID'),\n cond: GuardRefSchema.optional().describe('Condition (Guard) required to take this path'),\n actions: z.array(ActionRefSchema).optional().describe('Actions to execute during transition'),\n description: z.string().optional().describe('Human readable description of this rule'),\n});\n\n/**\n * Event Definition (Signals)\n */\nexport const EventSchema = z.object({\n type: z.string().describe('Event Type (e.g. \"APPROVE\", \"REJECT\", \"Submit\")'),\n // Payload validation schema could go here if we want deep validation\n schema: z.record(z.string(), z.unknown()).optional().describe('Expected event payload structure'),\n});\n\nexport type ActionRef = z.infer<typeof ActionRefSchema>;\nexport type Transition = z.infer<typeof TransitionSchema>;\n\nexport type StateNodeConfig = {\n type?: 'atomic' | 'compound' | 'parallel' | 'final' | 'history';\n entry?: ActionRef[];\n exit?: ActionRef[];\n on?: Record<string, string | Transition | Transition[]>;\n always?: Transition[];\n initial?: string;\n states?: Record<string, StateNodeConfig>;\n meta?: {\n label?: string;\n description?: string;\n color?: string;\n aiInstructions?: string;\n };\n};\n\n/**\n * State Node Definition\n */\nexport const StateNodeSchema: z.ZodType<StateNodeConfig> = z.lazy(() => z.object({\n /** Type of state */\n type: z.enum(['atomic', 'compound', 'parallel', 'final', 'history']).default('atomic'),\n \n /** Entry/Exit Actions */\n entry: z.array(ActionRefSchema).optional().describe('Actions to run when entering this state'),\n exit: z.array(ActionRefSchema).optional().describe('Actions to run when leaving this state'),\n \n /** Transitions (Events) */\n on: z.record(z.string(), z.union([\n z.string(), // Shorthand target\n TransitionSchema, \n z.array(TransitionSchema)\n ])).optional().describe('Map of Event Type -> Transition Definition'),\n \n /** Always Transitions (Eventless) */\n always: z.array(TransitionSchema).optional(),\n\n /** Nesting (Hierarchical States) */\n initial: z.string().optional().describe('Initial child state (if compound)'),\n states: z.record(z.string(), StateNodeSchema).optional(),\n \n /** Metadata for UI/AI */\n meta: z.object({\n label: z.string().optional(),\n description: z.string().optional(),\n color: z.string().optional(), // For UI diagrams\n // Instructions for AI Agent when in this state\n aiInstructions: z.string().optional().describe('Specific instructions for AI when in this state'),\n }).optional(),\n}));\n\n/**\n * Top-Level State Machine Definition\n */\nexport const StateMachineSchema = z.object({\n id: SnakeCaseIdentifierSchema.describe('Unique Machine ID'),\n description: z.string().optional(),\n \n /** Context (Memory) Schema */\n contextSchema: z.record(z.string(), z.unknown()).optional().describe('Zod Schema for the machine context/memory'),\n \n /** Initial State */\n initial: z.string().describe('Initial State ID'),\n \n /** State Definitions */\n states: z.record(z.string(), StateNodeSchema).describe('State Nodes'),\n \n /** Global Listeners */\n on: z.record(z.string(), z.union([z.string(), TransitionSchema, z.array(TransitionSchema)])).optional(),\n});\n\nexport type StateMachineConfig = z.infer<typeof StateMachineSchema>;\n","// Copyright (c) 2025 ObjectStack. Licensed under the Apache-2.0 license.\n\nimport { z } from 'zod';\nimport { SnakeCaseIdentifierSchema } from '../shared/identifiers.zod';\n\n/**\n * Base Navigation Item Schema\n * Shared properties for all navigation types.\n * \n * **NAMING CONVENTION:**\n * Navigation item IDs are used in URLs and configuration and must be lowercase snake_case.\n * \n * @example Good IDs\n * - 'menu_accounts'\n * - 'page_dashboard'\n * - 'nav_settings'\n * \n * @example Bad IDs (will be rejected)\n * - 'MenuAccounts' (PascalCase)\n * - 'Page Dashboard' (spaces)\n */\nconst BaseNavItemSchema = z.object({\n /** Unique identifier for the item */\n id: SnakeCaseIdentifierSchema.describe('Unique identifier for this navigation item (lowercase snake_case)'),\n \n /** Display label */\n label: z.string().describe('Display proper label'),\n \n /** Icon name (Lucide) */\n icon: z.string().optional().describe('Icon name'),\n\n /** \n * Visibility condition. \n * Formula expression returning boolean. \n * e.g. \"user.is_admin || user.department == 'sales'\"\n */\n visible: z.string().optional().describe('Visibility formula condition'),\n});\n\n/**\n * 1. Object Navigation Item\n * Navigates to an object's list view.\n */\nexport const ObjectNavItemSchema = BaseNavItemSchema.extend({\n type: z.literal('object'),\n objectName: z.string().describe('Target object name'),\n viewName: z.string().optional().describe('Default list view to open. Defaults to \"all\"'),\n});\n\n/**\n * 2. Dashboard Navigation Item\n * Navigates to a specific dashboard.\n */\nexport const DashboardNavItemSchema = BaseNavItemSchema.extend({\n type: z.literal('dashboard'),\n dashboardName: z.string().describe('Target dashboard name'),\n});\n\n/**\n * 3. Page Navigation Item\n * Navigates to a custom UI page/component.\n */\nexport const PageNavItemSchema = BaseNavItemSchema.extend({\n type: z.literal('page'),\n pageName: z.string().describe('Target custom page component name'),\n params: z.record(z.string(), z.unknown()).optional().describe('Parameters passed to the page context'),\n});\n\n/**\n * 4. URL Navigation Item\n * Navigates to an external or absolute URL.\n */\nexport const UrlNavItemSchema = BaseNavItemSchema.extend({\n type: z.literal('url'),\n url: z.string().describe('Target external URL'),\n target: z.enum(['_self', '_blank']).default('_self').describe('Link target window'),\n});\n\n/**\n * 5. Group Navigation Item\n * A container for child navigation items (Sub-menu).\n * Does not perform navigation itself.\n */\nexport const GroupNavItemSchema = BaseNavItemSchema.extend({\n type: z.literal('group'),\n expanded: z.boolean().default(false).describe('Default expansion state in sidebar'),\n // children property is added in the recursive definition below\n});\n\n/**\n * Recursive Union of all navigation item types.\n * Allows constructing a navigation tree.\n */\nexport const NavigationItemSchema: z.ZodType<any> = z.lazy(() => \n z.union([\n // Object Item can now have children (Airtable style: Object -> Views)\n ObjectNavItemSchema.extend({\n children: z.array(NavigationItemSchema).optional().describe('Child navigation items (e.g. specific views)'),\n }),\n DashboardNavItemSchema,\n PageNavItemSchema,\n UrlNavItemSchema,\n GroupNavItemSchema.extend({\n children: z.array(NavigationItemSchema).describe('Child navigation items'),\n })\n ])\n);\n\n/**\n * App Branding Configuration\n * Allows configuring the look and feel of the specific app.\n */\nexport const AppBrandingSchema = z.object({\n primaryColor: z.string().optional().describe('Primary theme color hex code'),\n logo: z.string().optional().describe('Custom logo URL for this app'),\n favicon: z.string().optional().describe('Custom favicon URL for this app'),\n});\n\n/**\n * Schema for Applications (Apps).\n * A logical container for business functionality (e.g., \"Sales CRM\", \"HR Portal\").\n * \n * **NAMING CONVENTION:**\n * App names are used in URLs and routing and must be lowercase snake_case.\n * Prefix with 'app_' is recommended for clarity.\n * \n * @example Good app names\n * - 'app_crm'\n * - 'app_finance'\n * - 'app_portal'\n * - 'sales_app'\n * \n * @example Bad app names (will be rejected)\n * - 'CRM' (uppercase)\n * - 'FinanceApp' (mixed case)\n * - 'Sales App' (spaces)\n */\n/**\n * App Configuration Schema\n * Defines a business application container, including its navigation, branding, and permissions.\n * \n * @example CRM App\n * {\n * name: \"crm\",\n * label: \"Sales CRM\",\n * icon: \"briefcase\",\n * navigation: [\n * { type: \"object\", id: \"nav_leads\", label: \"Leads\", objectName: \"leads\" },\n * { type: \"object\", id: \"nav_deals\", label: \"Deals\", objectName: \"deals\" }\n * ],\n * requiredPermissions: [\"app.crm.access\"]\n * }\n */\nexport const AppSchema = z.object({\n /** Machine name (id) */\n name: SnakeCaseIdentifierSchema.describe('App unique machine name (lowercase snake_case)'),\n \n /** Display label */\n label: z.string().describe('App display label'),\n\n /** App version */\n version: z.string().optional().describe('App version'),\n \n /** Description */\n description: z.string().optional().describe('App description'),\n \n /** Icon name (Lucide) */\n icon: z.string().optional().describe('App icon used in the App Launcher'),\n \n /** Branding/Theming Configuration */\n branding: AppBrandingSchema.optional().describe('App-specific branding'),\n \n /** Application status */\n active: z.boolean().optional().default(true).describe('Whether the app is enabled'),\n\n /** Is this the default app for new users? */\n isDefault: z.boolean().optional().default(false).describe('Is default app'),\n \n /** \n * Navigation Tree Structure.\n * Replaces the old flat 'tabs' list with a structured menu.\n */\n navigation: z.array(NavigationItemSchema).optional().describe('Structured navigation menu tree'),\n \n /** \n * App-level Home Page Override\n * ID of the navigation item to act as the landing page.\n * If not set, usually defaults to the first navigation item.\n */\n homePageId: z.string().optional().describe('ID of the navigation item to serve as landing page'),\n\n /** \n * Access Control\n * List of permissions required to access this app.\n * Modern replacement for role/profile based assignment.\n * Example: [\"app.access.crm\"]\n */\n requiredPermissions: z.array(z.string()).optional().describe('Permissions required to access this app'),\n \n /** \n * Package Components (For config file convenience)\n * In a real monorepo these might be auto-discovered, but here we allow explicit registration.\n */\n objects: z.array(z.unknown()).optional().describe('Objects belonging to this app'),\n apis: z.array(z.unknown()).optional().describe('Custom APIs belonging to this app'),\n});\n\n/**\n * App Factory Helper\n */\nexport const App = {\n create: (config: z.input<typeof AppSchema>): App => AppSchema.parse(config),\n} as const;\n\n// Main Types\nexport type App = z.infer<typeof AppSchema>;\nexport type AppInput = z.input<typeof AppSchema>;\nexport type AppBranding = z.infer<typeof AppBrandingSchema>;\nexport type NavigationItem = z.infer<typeof NavigationItemSchema>;\n\n// Discriminated Item Types (Helper exports)\nexport type ObjectNavItem = z.infer<typeof ObjectNavItemSchema>;\nexport type DashboardNavItem = z.infer<typeof DashboardNavItemSchema>;\nexport type PageNavItem = z.infer<typeof PageNavItemSchema>;\nexport type UrlNavItem = z.infer<typeof UrlNavItemSchema>;\nexport type GroupNavItem = z.infer<typeof GroupNavItemSchema> & { children: NavigationItem[] };\n","// Copyright (c) 2025 ObjectStack. Licensed under the Apache-2.0 license.\n\nimport { z } from 'zod';\nimport { CoreServiceName, ServiceCriticalitySchema } from '../system/core-services.zod';\n\n/**\n * # HttpDispatcher Protocol\n * \n * Defines how the ObjectStack HttpDispatcher routes incoming API requests\n * to the correct kernel service based on URL prefix matching.\n * \n * The dispatcher is the central routing component that:\n * 1. Matches incoming request URLs against registered route prefixes\n * 2. Delegates to the corresponding CoreService implementation\n * 3. Returns 503 Service Unavailable when a service is not registered\n * 4. Supports dynamic route registration from plugins via contributes.routes\n * \n * Architecture alignment:\n * - Kubernetes: API server aggregation layer\n * - Eclipse: Extension registry routing\n * - VS Code: Command palette routing\n */\n\n// ============================================================================\n// Route Definition\n// ============================================================================\n\n/**\n * Dispatcher Route Schema\n * Maps a URL prefix to a kernel service.\n * \n * @example\n * {\n * \"prefix\": \"/api/v1/data\",\n * \"service\": \"data\",\n * \"authRequired\": true,\n * \"criticality\": \"required\"\n * }\n */\nexport const DispatcherRouteSchema = z.object({\n /**\n * URL path prefix for routing.\n * Incoming requests matching this prefix are routed to the target service.\n * Must start with '/'.\n */\n prefix: z.string().regex(/^\\//).describe('URL path prefix for routing (e.g. /api/v1/data)'),\n \n /**\n * Target core service name.\n * The service that handles requests matching this prefix.\n */\n service: CoreServiceName.describe('Target core service name'),\n \n /**\n * Whether requests to this route require authentication.\n * Discovery endpoint is typically public; most others require auth.\n * @default true\n */\n authRequired: z.boolean().default(true).describe('Whether authentication is required'),\n \n /**\n * Service criticality level.\n * Determines behavior when the service is unavailable:\n * - required: return 500 Internal Server Error\n * - core: return 503 with degraded notice\n * - optional: return 503 Service Unavailable\n * @default 'optional'\n */\n criticality: ServiceCriticalitySchema.default('optional')\n .describe('Service criticality level for unavailability handling'),\n \n /**\n * Required permissions for accessing this route namespace.\n * Applied as a baseline before individual endpoint permission checks.\n */\n permissions: z.array(z.string()).optional()\n .describe('Required permissions for this route namespace'),\n});\n\nexport type DispatcherRoute = z.infer<typeof DispatcherRouteSchema>;\nexport type DispatcherRouteInput = z.input<typeof DispatcherRouteSchema>;\n\n// ============================================================================\n// Dispatcher Configuration\n// ============================================================================\n\n/**\n * Dispatcher Configuration Schema\n * Complete configuration for the HttpDispatcher routing table.\n * \n * @example\n * {\n * \"routes\": [\n * { \"prefix\": \"/api/v1/discovery\", \"service\": \"metadata\", \"authRequired\": false },\n * { \"prefix\": \"/api/v1/meta\", \"service\": \"metadata\" },\n * { \"prefix\": \"/api/v1/data\", \"service\": \"data\", \"criticality\": \"required\" },\n * { \"prefix\": \"/api/v1/auth\", \"service\": \"auth\", \"criticality\": \"required\" },\n * { \"prefix\": \"/api/v1/ai\", \"service\": \"ai\" }\n * ],\n * \"fallback\": \"404\"\n * }\n */\nexport const DispatcherConfigSchema = z.object({\n /**\n * Registered route mappings.\n * Routes are matched by longest-prefix-first strategy.\n */\n routes: z.array(DispatcherRouteSchema).describe('Route-to-service mappings'),\n \n /**\n * Behavior when no route matches the request.\n * - 404: Return 404 Not Found (default)\n * - proxy: Forward to a configured proxy target\n * - custom: Delegate to a custom handler\n * @default '404'\n */\n fallback: z.enum(['404', 'proxy', 'custom']).default('404')\n .describe('Behavior when no route matches'),\n \n /**\n * Proxy target URL for fallback: 'proxy' mode.\n */\n proxyTarget: z.string().url().optional()\n .describe('Proxy target URL when fallback is \"proxy\"'),\n});\n\nexport type DispatcherConfig = z.infer<typeof DispatcherConfigSchema>;\nexport type DispatcherConfigInput = z.input<typeof DispatcherConfigSchema>;\n\n// ============================================================================\n// Default Route Table\n// ============================================================================\n\n/**\n * Default route table for the ObjectStack HttpDispatcher.\n * Maps all Protocol namespaces to their corresponding services.\n * \n * This is the recommended baseline configuration. Plugins can extend\n * this table by declaring routes in their manifest's contributes.routes.\n */\nexport const DEFAULT_DISPATCHER_ROUTES: DispatcherRouteInput[] = [\n // Discovery (public)\n { prefix: '/api/v1/discovery', service: 'metadata', authRequired: false, criticality: 'required' },\n \n // Required Services\n { prefix: '/api/v1/meta', service: 'metadata', criticality: 'required' },\n { prefix: '/api/v1/data', service: 'data', criticality: 'required' },\n { prefix: '/api/v1/auth', service: 'auth', criticality: 'required' },\n \n // Optional Services (plugin-provided)\n { prefix: '/api/v1/packages', service: 'metadata' },\n { prefix: '/api/v1/ui', service: 'ui' },\n { prefix: '/api/v1/workflow', service: 'workflow' },\n { prefix: '/api/v1/analytics', service: 'analytics' },\n { prefix: '/api/v1/automation', service: 'automation' },\n { prefix: '/api/v1/i18n', service: 'i18n' },\n { prefix: '/api/v1/notifications', service: 'notification' },\n { prefix: '/api/v1/realtime', service: 'realtime' },\n { prefix: '/api/v1/ai', service: 'ai' },\n];\n","// Copyright (c) 2025 ObjectStack. Licensed under the Apache-2.0 license.\n\nimport { z } from 'zod';\n\n/**\n * # Service Registry Protocol\n * \n * Defines the standard built-in services that constitute the ObjectStack Kernel.\n * This registry is used by the `ObjectKernel` and `HttpDispatcher` to:\n * 1. Verify service availability.\n * 2. Route requests to the correct service handler.\n * 3. Type-check service interactions.\n */\n\n// ==========================================\n// Service Identifiers\n// ==========================================\n\nexport const CoreServiceName = z.enum([\n // Core Data & Metadata\n 'metadata', // Object/Field Definitions\n 'data', // CRUD & Query Engine\n 'auth', // Authentication & Identity\n \n // Infrastructure\n 'file-storage', // Storage Driver (Local/S3)\n 'search', // Search Engine (Elastic/Meili)\n 'cache', // Cache Driver (Redis/Memory)\n 'queue', // Job Queue (BullMQ/Redis)\n \n // Advanced Capabilities\n 'automation', // Flow & Script Engine\n 'graphql', // GraphQL API Engine\n 'analytics', // BI & Semantic Layer\n 'realtime', // WebSocket & PubSub\n 'job', // Background Job Manager\n 'notification', // Email/Push/SMS\n 'ai', // AI Engine (NLQ, Chat, Suggest, Insights)\n 'i18n', // Internationalization Service\n 'ui', // UI Metadata Service (View CRUD)\n 'workflow', // Workflow State Machine Engine\n]);\n\nexport type CoreServiceName = z.infer<typeof CoreServiceName>;\n\n/**\n * Service Criticality Level\n * Defines the startup behavior when a service is missing.\n */\nexport const ServiceCriticalitySchema = z.enum([\n 'required', // System fails to start if missing (Exit Code 1)\n 'core', // System warns if missing, functionality degraded (Warn)\n 'optional', // System ignores if missing, feature disabled (Info)\n]);\n\n/**\n * Service Requirement Definition\n */\nexport const ServiceRequirementDef = {\n // Required: The kernel cannot function without these\n metadata: 'required',\n data: 'required',\n\n // Core: Highly recommended, defaults to in-memory / no-op if missing\n auth: 'core',\n\n // Core: Highly recommended, defaults to in-memory if missing\n cache: 'core',\n queue: 'core',\n job: 'core',\n\n // Optional: Add-on capabilities\n 'file-storage': 'optional',\n search: 'optional',\n automation: 'optional',\n graphql: 'optional',\n analytics: 'optional',\n realtime: 'optional',\n notification: 'optional',\n ai: 'optional',\n i18n: 'optional',\n ui: 'optional',\n workflow: 'optional',\n} as const;\n\n// ==========================================\n// Service Capabilities\n// ==========================================\n\n/**\n * Describes the availability and health of a service\n */\nexport const ServiceStatusSchema = z.object({\n name: CoreServiceName,\n enabled: z.boolean(),\n status: z.enum(['running', 'stopped', 'degraded', 'initializing']),\n version: z.string().optional(),\n provider: z.string().optional().describe('Implementation provider (e.g. \"s3\" for storage)'),\n features: z.array(z.string()).optional().describe('List of supported sub-features'),\n});\n\n/**\n * The Contract definition for what the Kernel MUST expose\n * map<ServiceName, ServiceInstance>\n */\nexport const KernelServiceMapSchema = z.record(\n CoreServiceName, \n z.unknown().describe('Service Instance implementing the protocol interface')\n);\n\n// ==========================================\n// Service Interfaces (Stub definitions)\n// ==========================================\n// Ideally, we would define strict Typescript interfaces here \n// for what methods each service must expose to the Registry.\n// For Zod, we primarily validate configuration and status.\n\n// e.g.\nexport const ServiceConfigSchema = z.object({\n id: z.string(),\n name: CoreServiceName,\n options: z.record(z.string(), z.unknown()).optional(),\n});\n","// Copyright (c) 2025 ObjectStack. Licensed under the Apache-2.0 license.\n\nimport { z } from 'zod';\nimport { HttpMethod } from '../shared/http.zod';\nimport { MiddlewareConfigSchema } from '../system/http-server.zod';\n\n/**\n * REST API Plugin Protocol\n * \n * Defines the schema for REST API plugins that register Discovery, Metadata,\n * Data CRUD, Batch, and Permission routes with the HTTP Dispatcher.\n * \n * This plugin type implements Phase 2 of the API Protocol implementation plan,\n * providing standardized REST endpoints with:\n * - Request validation middleware using Zod schemas\n * - Response envelope wrapping with BaseResponseSchema\n * - Error handling using ApiErrorSchema\n * - OpenAPI documentation auto-generation\n * \n * Features:\n * - Route registration for core API endpoints\n * - Automatic schema-based validation\n * - Standardized request/response envelopes\n * - OpenAPI/Swagger documentation generation\n * \n * Architecture Alignment:\n * - Salesforce: REST API with metadata and data CRUD\n * - Microsoft Dynamics: Web API with entity operations\n * - Strapi: Auto-generated REST endpoints from schemas\n * \n * @example Plugin Manifest\n * ```typescript\n * {\n * \"name\": \"rest_api\",\n * \"version\": \"1.0.0\",\n * \"type\": \"server\",\n * \"contributes\": {\n * \"routes\": [\n * {\n * \"prefix\": \"/api/v1/discovery\",\n * \"service\": \"metadata\",\n * \"methods\": [\"getDiscovery\"],\n * \"middleware\": [\n * { \"name\": \"response_envelope\", \"type\": \"transformation\", \"enabled\": true }\n * ]\n * },\n * {\n * \"prefix\": \"/api/v1/meta\",\n * \"service\": \"metadata\",\n * \"methods\": [\"getMetaTypes\", \"getMetaItems\", \"getMetaItem\", \"saveMetaItem\"],\n * \"middleware\": [\n * { \"name\": \"auth\", \"type\": \"authentication\", \"enabled\": true },\n * { \"name\": \"request_validation\", \"type\": \"validation\", \"enabled\": true }\n * ]\n * },\n * {\n * \"prefix\": \"/api/v1/data\",\n * \"service\": \"data\",\n * \"methods\": [\"findData\", \"getData\", \"createData\", \"updateData\", \"deleteData\"]\n * }\n * ]\n * }\n * }\n * ```\n */\n\n// ==========================================\n// REST API Route Categories\n// ==========================================\n\n/**\n * REST API Route Category Enum\n * Categorizes REST API routes by their primary function\n */\nexport const RestApiRouteCategory = z.enum([\n 'discovery', // API discovery and capabilities\n 'metadata', // Metadata operations (objects, fields, views)\n 'data', // Data CRUD operations\n 'batch', // Batch/bulk operations\n 'permission', // Permission/authorization checks\n 'analytics', // Analytics and reporting\n 'automation', // Automation triggers and flows\n 'workflow', // Workflow state management\n 'ui', // UI metadata (views, layouts)\n 'realtime', // Realtime/WebSocket\n 'notification', // Notification management\n 'ai', // AI operations (NLQ, chat)\n 'i18n', // Internationalization\n]);\n\nexport type RestApiRouteCategory = z.infer<typeof RestApiRouteCategory>;\n\n// ==========================================\n// Route Registration Schema\n// ==========================================\n\n/**\n * REST API Endpoint Schema\n * Defines a single REST API endpoint with its metadata\n * \n * @example Discovery Endpoint\n * {\n * \"method\": \"GET\",\n * \"path\": \"/api/v1/discovery\",\n * \"handler\": \"getDiscovery\",\n * \"category\": \"discovery\",\n * \"public\": true,\n * \"description\": \"Get API discovery information\"\n * }\n */\nexport const RestApiEndpointSchema = z.object({\n /**\n * HTTP method\n */\n method: HttpMethod.describe('HTTP method for this endpoint'),\n \n /**\n * URL path pattern (supports parameters like :id)\n */\n path: z.string().describe('URL path pattern (e.g., /api/v1/data/:object/:id)'),\n \n /**\n * Handler reference (protocol method name)\n */\n handler: z.string().describe('Protocol method name or handler identifier'),\n \n /**\n * Route category\n */\n category: RestApiRouteCategory.describe('Route category'),\n \n /**\n * Whether endpoint is publicly accessible (no auth required)\n */\n public: z.boolean().default(false).describe('Is publicly accessible without authentication'),\n \n /**\n * Required permissions\n */\n permissions: z.array(z.string()).optional().describe('Required permissions (e.g., [\"data.read\", \"object.account.read\"])'),\n \n /**\n * OpenAPI documentation metadata\n */\n summary: z.string().optional().describe('Short description for OpenAPI'),\n description: z.string().optional().describe('Detailed description for OpenAPI'),\n tags: z.array(z.string()).optional().describe('OpenAPI tags for grouping'),\n \n /**\n * Request/Response schema references\n */\n requestSchema: z.string().optional().describe('Request schema name (for validation)'),\n responseSchema: z.string().optional().describe('Response schema name (for documentation)'),\n \n /**\n * Performance and reliability settings\n */\n timeout: z.number().int().optional().describe('Request timeout in milliseconds'),\n rateLimit: z.string().optional().describe('Rate limit policy name'),\n cacheable: z.boolean().default(false).describe('Whether response can be cached'),\n cacheTtl: z.number().int().optional().describe('Cache TTL in seconds'),\n});\n\nexport type RestApiEndpoint = z.infer<typeof RestApiEndpointSchema>;\n\n/**\n * REST API Route Registration Schema\n * Registers a group of related endpoints under a common prefix\n * \n * @example Data CRUD Routes\n * {\n * \"prefix\": \"/api/v1/data\",\n * \"service\": \"data\",\n * \"category\": \"data\",\n * \"endpoints\": [\n * { \"method\": \"GET\", \"path\": \"/:object\", \"handler\": \"findData\" },\n * { \"method\": \"GET\", \"path\": \"/:object/:id\", \"handler\": \"getData\" },\n * { \"method\": \"POST\", \"path\": \"/:object\", \"handler\": \"createData\" },\n * { \"method\": \"PATCH\", \"path\": \"/:object/:id\", \"handler\": \"updateData\" },\n * { \"method\": \"DELETE\", \"path\": \"/:object/:id\", \"handler\": \"deleteData\" }\n * ],\n * \"middleware\": [\n * { \"name\": \"auth\", \"type\": \"authentication\", \"enabled\": true },\n * { \"name\": \"validation\", \"type\": \"validation\", \"enabled\": true },\n * { \"name\": \"response_envelope\", \"type\": \"transformation\", \"enabled\": true }\n * ]\n * }\n */\nexport const RestApiRouteRegistrationSchema = z.object({\n /**\n * URL prefix for this route group (e.g., /api/v1/data)\n */\n prefix: z.string().regex(/^\\//).describe('URL path prefix for this route group'),\n \n /**\n * Service name that handles these routes\n */\n service: z.string().describe('Core service name (metadata, data, auth, etc.)'),\n \n /**\n * Route category\n */\n category: RestApiRouteCategory.describe('Primary category for this route group'),\n \n /**\n * Protocol methods implemented\n */\n methods: z.array(z.string()).optional().describe('Protocol method names implemented'),\n \n /**\n * Detailed endpoint definitions\n */\n endpoints: z.array(RestApiEndpointSchema).optional().describe('Endpoint definitions'),\n \n /**\n * Middleware applied to all routes in this group\n */\n middleware: z.array(MiddlewareConfigSchema).optional().describe('Middleware stack for this route group'),\n \n /**\n * Whether authentication is required for all routes\n */\n authRequired: z.boolean().default(true).describe('Whether authentication is required by default'),\n \n /**\n * OpenAPI documentation\n */\n documentation: z.object({\n title: z.string().optional().describe('Route group title'),\n description: z.string().optional().describe('Route group description'),\n tags: z.array(z.string()).optional().describe('OpenAPI tags'),\n }).optional().describe('Documentation metadata for this route group'),\n});\n\nexport type RestApiRouteRegistration = z.infer<typeof RestApiRouteRegistrationSchema>;\n\n// ==========================================\n// Request Validation Configuration\n// ==========================================\n\n/**\n * Request Validation Mode Enum\n * Defines how validation errors are handled\n */\nexport const ValidationMode = z.enum([\n 'strict', // Reject requests with validation errors (400 Bad Request)\n 'permissive', // Log validation errors but allow request to proceed\n 'strip', // Remove invalid fields and continue with valid data\n]);\n\nexport type ValidationMode = z.infer<typeof ValidationMode>;\n\n/**\n * Request Validation Configuration Schema\n * Configures Zod-based request validation middleware\n * \n * @example\n * {\n * \"enabled\": true,\n * \"mode\": \"strict\",\n * \"validateBody\": true,\n * \"validateQuery\": true,\n * \"validateParams\": true,\n * \"includeFieldErrors\": true\n * }\n */\nexport const RequestValidationConfigSchema = z.object({\n /**\n * Enable request validation\n */\n enabled: z.boolean().default(true).describe('Enable automatic request validation'),\n \n /**\n * Validation mode\n */\n mode: ValidationMode.default('strict').describe('How to handle validation errors'),\n \n /**\n * Validate request body\n */\n validateBody: z.boolean().default(true).describe('Validate request body against schema'),\n \n /**\n * Validate query parameters\n */\n validateQuery: z.boolean().default(true).describe('Validate query string parameters'),\n \n /**\n * Validate URL parameters\n */\n validateParams: z.boolean().default(true).describe('Validate URL path parameters'),\n \n /**\n * Validate request headers\n */\n validateHeaders: z.boolean().default(false).describe('Validate request headers'),\n \n /**\n * Include detailed field errors in response\n */\n includeFieldErrors: z.boolean().default(true).describe('Include field-level error details in response'),\n \n /**\n * Custom error message prefix\n */\n errorPrefix: z.string().optional().describe('Custom prefix for validation error messages'),\n \n /**\n * Schema registry reference\n */\n schemaRegistry: z.string().optional().describe('Schema registry name to use for validation'),\n});\n\nexport type RequestValidationConfig = z.infer<typeof RequestValidationConfigSchema>;\nexport type RequestValidationConfigInput = z.input<typeof RequestValidationConfigSchema>;\n\n// ==========================================\n// Response Envelope Configuration\n// ==========================================\n\n/**\n * Response Envelope Configuration Schema\n * Configures automatic response wrapping with BaseResponseSchema\n * \n * @example\n * {\n * \"enabled\": true,\n * \"includeMetadata\": true,\n * \"includeTimestamp\": true,\n * \"includeRequestId\": true,\n * \"includeDuration\": true\n * }\n */\nexport const ResponseEnvelopeConfigSchema = z.object({\n /**\n * Enable response envelope wrapping\n */\n enabled: z.boolean().default(true).describe('Enable automatic response envelope wrapping'),\n \n /**\n * Include metadata object\n */\n includeMetadata: z.boolean().default(true).describe('Include meta object in responses'),\n \n /**\n * Include timestamp in metadata\n */\n includeTimestamp: z.boolean().default(true).describe('Include timestamp in response metadata'),\n \n /**\n * Include request ID in metadata\n */\n includeRequestId: z.boolean().default(true).describe('Include requestId in response metadata'),\n \n /**\n * Include request duration in metadata\n */\n includeDuration: z.boolean().default(false).describe('Include request duration in ms'),\n \n /**\n * Include trace ID for distributed tracing\n */\n includeTraceId: z.boolean().default(false).describe('Include distributed traceId'),\n \n /**\n * Custom metadata fields\n */\n customMetadata: z.record(z.string(), z.unknown()).optional().describe('Additional metadata fields to include'),\n \n /**\n * Whether to wrap already-wrapped responses\n */\n skipIfWrapped: z.boolean().default(true).describe('Skip wrapping if response already has success field'),\n});\n\nexport type ResponseEnvelopeConfig = z.infer<typeof ResponseEnvelopeConfigSchema>;\nexport type ResponseEnvelopeConfigInput = z.input<typeof ResponseEnvelopeConfigSchema>;\n\n// ==========================================\n// Error Handling Configuration\n// ==========================================\n\n/**\n * Error Handling Configuration Schema\n * Configures error handling and ApiErrorSchema formatting\n * \n * @example\n * {\n * \"enabled\": true,\n * \"includeStackTrace\": false,\n * \"logErrors\": true,\n * \"exposeInternalErrors\": false,\n * \"customErrorMessages\": {\n * \"validation_error\": \"The request data is invalid. Please check your input.\"\n * }\n * }\n */\nexport const ErrorHandlingConfigSchema = z.object({\n /**\n * Enable standardized error handling\n */\n enabled: z.boolean().default(true).describe('Enable standardized error handling'),\n \n /**\n * Include stack traces in error responses (dev only)\n */\n includeStackTrace: z.boolean().default(false).describe('Include stack traces in error responses'),\n \n /**\n * Log errors to logger\n */\n logErrors: z.boolean().default(true).describe('Log errors to system logger'),\n \n /**\n * Expose internal error details\n */\n exposeInternalErrors: z.boolean().default(false).describe('Expose internal error details in responses'),\n \n /**\n * Include request ID in errors\n */\n includeRequestId: z.boolean().default(true).describe('Include requestId in error responses'),\n \n /**\n * Include timestamp in errors\n */\n includeTimestamp: z.boolean().default(true).describe('Include timestamp in error responses'),\n \n /**\n * Include error documentation URLs\n */\n includeDocumentation: z.boolean().default(true).describe('Include documentation URLs for errors'),\n \n /**\n * Documentation base URL\n */\n documentationBaseUrl: z.string().url().optional().describe('Base URL for error documentation'),\n \n /**\n * Custom error messages by code\n */\n customErrorMessages: z.record(z.string(), z.string()).optional()\n .describe('Custom error messages by error code'),\n \n /**\n * Sensitive fields to redact from error details\n */\n redactFields: z.array(z.string()).optional().describe('Field names to redact from error details'),\n});\n\nexport type ErrorHandlingConfig = z.infer<typeof ErrorHandlingConfigSchema>;\nexport type ErrorHandlingConfigInput = z.input<typeof ErrorHandlingConfigSchema>;\n\n// ==========================================\n// OpenAPI Documentation Configuration\n// ==========================================\n\n/**\n * OpenAPI Generation Configuration Schema\n * Configures automatic OpenAPI documentation generation\n * \n * @example\n * {\n * \"enabled\": true,\n * \"version\": \"3.0.0\",\n * \"title\": \"ObjectStack API\",\n * \"description\": \"ObjectStack REST API\",\n * \"outputPath\": \"/api/docs/openapi.json\",\n * \"uiPath\": \"/api/docs\",\n * \"includeInternal\": false,\n * \"generateSchemas\": true\n * }\n */\nexport const OpenApiGenerationConfigSchema = z.object({\n /**\n * Enable OpenAPI generation\n */\n enabled: z.boolean().default(true).describe('Enable automatic OpenAPI documentation generation'),\n \n /**\n * OpenAPI specification version\n */\n version: z.enum(['3.0.0', '3.0.1', '3.0.2', '3.0.3', '3.1.0']).default('3.0.3')\n .describe('OpenAPI specification version'),\n \n /**\n * API title\n */\n title: z.string().default('ObjectStack API').describe('API title'),\n \n /**\n * API description\n */\n description: z.string().optional().describe('API description'),\n \n /**\n * API version\n */\n apiVersion: z.string().default('1.0.0').describe('API version'),\n \n /**\n * Output path for OpenAPI spec\n */\n outputPath: z.string().default('/api/docs/openapi.json').describe('URL path to serve OpenAPI JSON'),\n \n /**\n * UI path for Swagger/Redoc\n */\n uiPath: z.string().default('/api/docs').describe('URL path to serve documentation UI'),\n \n /**\n * UI framework to use\n */\n uiFramework: z.enum(['swagger-ui', 'redoc', 'rapidoc', 'elements']).default('swagger-ui')\n .describe('Documentation UI framework'),\n \n /**\n * Include internal/admin endpoints\n */\n includeInternal: z.boolean().default(false).describe('Include internal endpoints in documentation'),\n \n /**\n * Generate JSON schemas from Zod\n */\n generateSchemas: z.boolean().default(true).describe('Auto-generate schemas from Zod definitions'),\n \n /**\n * Include examples in documentation\n */\n includeExamples: z.boolean().default(true).describe('Include request/response examples'),\n \n /**\n * Server URLs\n */\n servers: z.array(z.object({\n url: z.string().describe('Server URL'),\n description: z.string().optional().describe('Server description'),\n })).optional().describe('Server URLs for API'),\n \n /**\n * Contact information\n */\n contact: z.object({\n name: z.string().optional(),\n url: z.string().url().optional(),\n email: z.string().email().optional(),\n }).optional().describe('API contact information'),\n \n /**\n * License information\n */\n license: z.object({\n name: z.string().describe('License name'),\n url: z.string().url().optional().describe('License URL'),\n }).optional().describe('API license information'),\n \n /**\n * Security schemes\n */\n securitySchemes: z.record(z.string(), z.object({\n type: z.enum(['apiKey', 'http', 'oauth2', 'openIdConnect']),\n scheme: z.string().optional(),\n bearerFormat: z.string().optional(),\n })).optional().describe('Security scheme definitions'),\n});\n\nexport type OpenApiGenerationConfig = z.infer<typeof OpenApiGenerationConfigSchema>;\nexport type OpenApiGenerationConfigInput = z.input<typeof OpenApiGenerationConfigSchema>;\n\n// ==========================================\n// REST API Plugin Configuration\n// ==========================================\n\n/**\n * REST API Plugin Configuration Schema\n * Complete configuration for REST API plugin\n * \n * @example\n * {\n * \"enabled\": true,\n * \"basePath\": \"/api\",\n * \"version\": \"v1\",\n * \"routes\": [...],\n * \"validation\": { \"enabled\": true, \"mode\": \"strict\" },\n * \"responseEnvelope\": { \"enabled\": true, \"includeMetadata\": true },\n * \"errorHandling\": { \"enabled\": true, \"includeStackTrace\": false },\n * \"openApi\": { \"enabled\": true, \"title\": \"ObjectStack API\" }\n * }\n */\nexport const RestApiPluginConfigSchema = z.object({\n /**\n * Enable REST API plugin\n */\n enabled: z.boolean().default(true).describe('Enable REST API plugin'),\n \n /**\n * API base path\n */\n basePath: z.string().default('/api').describe('Base path for all API routes'),\n \n /**\n * API version\n */\n version: z.string().default('v1').describe('API version identifier'),\n \n /**\n * Route registrations\n */\n routes: z.array(RestApiRouteRegistrationSchema).describe('Route registrations'),\n \n /**\n * Request validation configuration\n */\n validation: RequestValidationConfigSchema.optional().describe('Request validation configuration'),\n \n /**\n * Response envelope configuration\n */\n responseEnvelope: ResponseEnvelopeConfigSchema.optional().describe('Response envelope configuration'),\n \n /**\n * Error handling configuration\n */\n errorHandling: ErrorHandlingConfigSchema.optional().describe('Error handling configuration'),\n \n /**\n * OpenAPI documentation configuration\n */\n openApi: OpenApiGenerationConfigSchema.optional().describe('OpenAPI documentation configuration'),\n \n /**\n * Global middleware applied to all routes\n */\n globalMiddleware: z.array(MiddlewareConfigSchema).optional().describe('Global middleware stack'),\n \n /**\n * CORS configuration\n */\n cors: z.object({\n enabled: z.boolean().default(true),\n origins: z.array(z.string()).optional(),\n methods: z.array(HttpMethod).optional(),\n credentials: z.boolean().default(true),\n }).optional().describe('CORS configuration'),\n \n /**\n * Performance settings\n */\n performance: z.object({\n enableCompression: z.boolean().default(true).describe('Enable response compression'),\n enableETag: z.boolean().default(true).describe('Enable ETag generation'),\n enableCaching: z.boolean().default(true).describe('Enable HTTP caching'),\n defaultCacheTtl: z.number().int().default(300).describe('Default cache TTL in seconds'),\n }).optional().describe('Performance optimization settings'),\n});\n\nexport type RestApiPluginConfig = z.infer<typeof RestApiPluginConfigSchema>;\nexport type RestApiPluginConfigInput = z.input<typeof RestApiPluginConfigSchema>;\n\n// ==========================================\n// Default Route Registrations\n// ==========================================\n\n/**\n * Default Discovery Routes\n * Standard routes for API discovery endpoint\n */\nexport const DEFAULT_DISCOVERY_ROUTES: RestApiRouteRegistration = {\n prefix: '/api/v1/discovery',\n service: 'metadata',\n category: 'discovery',\n methods: ['getDiscovery'],\n authRequired: false,\n endpoints: [{\n method: 'GET',\n path: '',\n handler: 'getDiscovery',\n category: 'discovery',\n public: true,\n summary: 'Get API discovery information',\n description: 'Returns API version, capabilities, and available routes',\n tags: ['Discovery'],\n responseSchema: 'GetDiscoveryResponseSchema',\n cacheable: true,\n cacheTtl: 3600, // Cache for 1 hour as discovery info rarely changes\n }],\n middleware: [\n { name: 'response_envelope', type: 'transformation', enabled: true, order: 100 },\n ],\n};\n\n/**\n * Default Metadata Routes\n * Standard routes for metadata operations\n * \n * Note: getMetaItemCached is not a separate endpoint - it's handled by the getMetaItem\n * endpoint with HTTP cache headers (ETag, If-None-Match, etc.) for conditional requests.\n */\nexport const DEFAULT_METADATA_ROUTES: RestApiRouteRegistration = {\n prefix: '/api/v1/meta',\n service: 'metadata',\n category: 'metadata',\n methods: ['getMetaTypes', 'getMetaItems', 'getMetaItem', 'saveMetaItem'],\n authRequired: true,\n endpoints: [\n {\n method: 'GET',\n path: '',\n handler: 'getMetaTypes',\n category: 'metadata',\n public: false,\n summary: 'List all metadata types',\n description: 'Returns available metadata types (object, field, view, etc.)',\n tags: ['Metadata'],\n responseSchema: 'GetMetaTypesResponseSchema',\n cacheable: true,\n cacheTtl: 3600,\n },\n {\n method: 'GET',\n path: '/:type',\n handler: 'getMetaItems',\n category: 'metadata',\n public: false,\n summary: 'List metadata items of a type',\n description: 'Returns all items of the specified metadata type',\n tags: ['Metadata'],\n responseSchema: 'GetMetaItemsResponseSchema',\n cacheable: true,\n cacheTtl: 3600,\n },\n {\n method: 'GET',\n path: '/:type/:name',\n handler: 'getMetaItem',\n category: 'metadata',\n public: false,\n summary: 'Get specific metadata item',\n description: 'Returns a specific metadata item by type and name',\n tags: ['Metadata'],\n requestSchema: 'GetMetaItemRequestSchema',\n responseSchema: 'GetMetaItemResponseSchema',\n cacheable: true,\n cacheTtl: 3600,\n },\n {\n method: 'PUT',\n path: '/:type/:name',\n handler: 'saveMetaItem',\n category: 'metadata',\n public: false,\n summary: 'Create or update metadata item',\n description: 'Creates or updates a metadata item',\n tags: ['Metadata'],\n requestSchema: 'SaveMetaItemRequestSchema',\n responseSchema: 'SaveMetaItemResponseSchema',\n permissions: ['metadata.write'],\n cacheable: false,\n },\n ],\n middleware: [\n { name: 'auth', type: 'authentication', enabled: true, order: 10 },\n { name: 'validation', type: 'validation', enabled: true, order: 20 },\n { name: 'response_envelope', type: 'transformation', enabled: true, order: 100 },\n ],\n};\n\n/**\n * Default Data CRUD Routes\n * Standard routes for data operations\n */\nexport const DEFAULT_DATA_CRUD_ROUTES: RestApiRouteRegistration = {\n prefix: '/api/v1/data',\n service: 'data',\n category: 'data',\n methods: ['findData', 'getData', 'createData', 'updateData', 'deleteData'],\n authRequired: true,\n endpoints: [\n {\n method: 'GET',\n path: '/:object',\n handler: 'findData',\n category: 'data',\n public: false,\n summary: 'Query records',\n description: 'Query records with filtering, sorting, and pagination',\n tags: ['Data'],\n requestSchema: 'FindDataRequestSchema',\n responseSchema: 'ListRecordResponseSchema',\n permissions: ['data.read'],\n cacheable: false,\n },\n {\n method: 'GET',\n path: '/:object/:id',\n handler: 'getData',\n category: 'data',\n public: false,\n summary: 'Get record by ID',\n description: 'Retrieve a single record by its ID',\n tags: ['Data'],\n requestSchema: 'IdRequestSchema',\n responseSchema: 'SingleRecordResponseSchema',\n permissions: ['data.read'],\n cacheable: false,\n },\n {\n method: 'POST',\n path: '/:object',\n handler: 'createData',\n category: 'data',\n public: false,\n summary: 'Create record',\n description: 'Create a new record',\n tags: ['Data'],\n requestSchema: 'CreateRequestSchema',\n responseSchema: 'SingleRecordResponseSchema',\n permissions: ['data.create'],\n cacheable: false,\n },\n {\n method: 'PATCH',\n path: '/:object/:id',\n handler: 'updateData',\n category: 'data',\n public: false,\n summary: 'Update record',\n description: 'Update an existing record',\n tags: ['Data'],\n requestSchema: 'UpdateRequestSchema',\n responseSchema: 'SingleRecordResponseSchema',\n permissions: ['data.update'],\n cacheable: false,\n },\n {\n method: 'DELETE',\n path: '/:object/:id',\n handler: 'deleteData',\n category: 'data',\n public: false,\n summary: 'Delete record',\n description: 'Delete a record by ID',\n tags: ['Data'],\n requestSchema: 'IdRequestSchema',\n responseSchema: 'DeleteResponseSchema',\n permissions: ['data.delete'],\n cacheable: false,\n },\n ],\n middleware: [\n { name: 'auth', type: 'authentication', enabled: true, order: 10 },\n { name: 'validation', type: 'validation', enabled: true, order: 20 },\n { name: 'response_envelope', type: 'transformation', enabled: true, order: 100 },\n { name: 'error_handler', type: 'error', enabled: true, order: 200 },\n ],\n};\n\n/**\n * Default Batch Routes\n * Standard routes for batch operations\n */\nexport const DEFAULT_BATCH_ROUTES: RestApiRouteRegistration = {\n prefix: '/api/v1/data/:object',\n service: 'data',\n category: 'batch',\n methods: ['batchData', 'createManyData', 'updateManyData', 'deleteManyData'],\n authRequired: true,\n endpoints: [\n {\n method: 'POST',\n path: '/batch',\n handler: 'batchData',\n category: 'batch',\n public: false,\n summary: 'Batch operation',\n description: 'Execute a batch operation (create, update, upsert, delete)',\n tags: ['Batch'],\n requestSchema: 'BatchUpdateRequestSchema',\n responseSchema: 'BatchUpdateResponseSchema',\n permissions: ['data.batch'],\n timeout: 60000, // 60 seconds for batch operations\n cacheable: false,\n },\n {\n method: 'POST',\n path: '/createMany',\n handler: 'createManyData',\n category: 'batch',\n public: false,\n summary: 'Batch create',\n description: 'Create multiple records in a single operation',\n tags: ['Batch'],\n requestSchema: 'CreateManyRequestSchema',\n responseSchema: 'BatchUpdateResponseSchema',\n permissions: ['data.create', 'data.batch'],\n timeout: 60000,\n cacheable: false,\n },\n {\n method: 'POST',\n path: '/updateMany',\n handler: 'updateManyData',\n category: 'batch',\n public: false,\n summary: 'Batch update',\n description: 'Update multiple records in a single operation',\n tags: ['Batch'],\n requestSchema: 'UpdateManyRequestSchema',\n responseSchema: 'BatchUpdateResponseSchema',\n permissions: ['data.update', 'data.batch'],\n timeout: 60000,\n cacheable: false,\n },\n {\n method: 'POST',\n path: '/deleteMany',\n handler: 'deleteManyData',\n category: 'batch',\n public: false,\n summary: 'Batch delete',\n description: 'Delete multiple records in a single operation',\n tags: ['Batch'],\n requestSchema: 'DeleteManyRequestSchema',\n responseSchema: 'BatchUpdateResponseSchema',\n permissions: ['data.delete', 'data.batch'],\n timeout: 60000,\n cacheable: false,\n },\n ],\n middleware: [\n { name: 'auth', type: 'authentication', enabled: true, order: 10 },\n { name: 'validation', type: 'validation', enabled: true, order: 20 },\n { name: 'response_envelope', type: 'transformation', enabled: true, order: 100 },\n { name: 'error_handler', type: 'error', enabled: true, order: 200 },\n ],\n};\n\n/**\n * Default Permission Routes\n * Standard routes for permission checking\n */\nexport const DEFAULT_PERMISSION_ROUTES: RestApiRouteRegistration = {\n prefix: '/api/v1/auth',\n service: 'auth',\n category: 'permission',\n methods: ['checkPermission', 'getObjectPermissions', 'getEffectivePermissions'],\n authRequired: true,\n endpoints: [\n {\n method: 'POST',\n path: '/check',\n handler: 'checkPermission',\n category: 'permission',\n public: false,\n summary: 'Check permission',\n description: 'Check if current user has a specific permission',\n tags: ['Permission'],\n requestSchema: 'CheckPermissionRequestSchema',\n responseSchema: 'CheckPermissionResponseSchema',\n cacheable: false,\n },\n {\n method: 'GET',\n path: '/permissions/:object',\n handler: 'getObjectPermissions',\n category: 'permission',\n public: false,\n summary: 'Get object permissions',\n description: 'Get all permissions for a specific object',\n tags: ['Permission'],\n responseSchema: 'ObjectPermissionsResponseSchema',\n cacheable: true,\n cacheTtl: 300,\n },\n {\n method: 'GET',\n path: '/permissions/effective',\n handler: 'getEffectivePermissions',\n category: 'permission',\n public: false,\n summary: 'Get effective permissions',\n description: 'Get all effective permissions for current user',\n tags: ['Permission'],\n responseSchema: 'EffectivePermissionsResponseSchema',\n cacheable: true,\n cacheTtl: 300,\n },\n ],\n middleware: [\n { name: 'auth', type: 'authentication', enabled: true, order: 10 },\n { name: 'response_envelope', type: 'transformation', enabled: true, order: 100 },\n ],\n};\n\n// ==========================================\n// View Management Routes\n// ==========================================\n\n/**\n * Default View Management Routes\n * Standard routes for UI view CRUD operations\n */\nexport const DEFAULT_VIEW_ROUTES: RestApiRouteRegistration = {\n prefix: '/api/v1/ui',\n service: 'ui',\n category: 'ui',\n methods: ['listViews', 'getView', 'createView', 'updateView', 'deleteView'],\n authRequired: true,\n endpoints: [\n {\n method: 'GET',\n path: '/views/:object',\n handler: 'listViews',\n category: 'ui',\n public: false,\n summary: 'List views for an object',\n description: 'Returns all views (list, form) for the specified object',\n tags: ['Views', 'UI'],\n responseSchema: 'ListViewsResponseSchema',\n cacheable: true,\n cacheTtl: 1800,\n },\n {\n method: 'GET',\n path: '/views/:object/:viewId',\n handler: 'getView',\n category: 'ui',\n public: false,\n summary: 'Get a specific view',\n description: 'Returns a specific view definition by object and view ID',\n tags: ['Views', 'UI'],\n responseSchema: 'GetViewResponseSchema',\n cacheable: true,\n cacheTtl: 1800,\n },\n {\n method: 'POST',\n path: '/views/:object',\n handler: 'createView',\n category: 'ui',\n public: false,\n summary: 'Create a new view',\n description: 'Creates a new view definition for the specified object',\n tags: ['Views', 'UI'],\n requestSchema: 'CreateViewRequestSchema',\n responseSchema: 'CreateViewResponseSchema',\n permissions: ['ui.view.create'],\n cacheable: false,\n },\n {\n method: 'PATCH',\n path: '/views/:object/:viewId',\n handler: 'updateView',\n category: 'ui',\n public: false,\n summary: 'Update a view',\n description: 'Updates an existing view definition',\n tags: ['Views', 'UI'],\n requestSchema: 'UpdateViewRequestSchema',\n responseSchema: 'UpdateViewResponseSchema',\n permissions: ['ui.view.update'],\n cacheable: false,\n },\n {\n method: 'DELETE',\n path: '/views/:object/:viewId',\n handler: 'deleteView',\n category: 'ui',\n public: false,\n summary: 'Delete a view',\n description: 'Deletes a view definition',\n tags: ['Views', 'UI'],\n responseSchema: 'DeleteViewResponseSchema',\n permissions: ['ui.view.delete'],\n cacheable: false,\n },\n ],\n middleware: [\n { name: 'auth', type: 'authentication', enabled: true, order: 10 },\n { name: 'validation', type: 'validation', enabled: true, order: 20 },\n { name: 'response_envelope', type: 'transformation', enabled: true, order: 100 },\n ],\n};\n\n// ==========================================\n// Workflow Routes\n// ==========================================\n\n/**\n * Default Workflow Routes\n * Standard routes for workflow state management and transitions\n */\nexport const DEFAULT_WORKFLOW_ROUTES: RestApiRouteRegistration = {\n prefix: '/api/v1/workflow',\n service: 'workflow',\n category: 'workflow',\n methods: ['getWorkflowConfig', 'getWorkflowState', 'workflowTransition', 'workflowApprove', 'workflowReject'],\n authRequired: true,\n endpoints: [\n {\n method: 'GET',\n path: '/:object/config',\n handler: 'getWorkflowConfig',\n category: 'workflow',\n public: false,\n summary: 'Get workflow configuration',\n description: 'Returns workflow rules and state machine configuration for an object',\n tags: ['Workflow'],\n responseSchema: 'GetWorkflowConfigResponseSchema',\n cacheable: true,\n cacheTtl: 3600,\n },\n {\n method: 'GET',\n path: '/:object/:recordId/state',\n handler: 'getWorkflowState',\n category: 'workflow',\n public: false,\n summary: 'Get workflow state',\n description: 'Returns current workflow state and available transitions for a record',\n tags: ['Workflow'],\n responseSchema: 'GetWorkflowStateResponseSchema',\n cacheable: false,\n },\n {\n method: 'POST',\n path: '/:object/:recordId/transition',\n handler: 'workflowTransition',\n category: 'workflow',\n public: false,\n summary: 'Execute workflow transition',\n description: 'Transitions a record to a new workflow state',\n tags: ['Workflow'],\n requestSchema: 'WorkflowTransitionRequestSchema',\n responseSchema: 'WorkflowTransitionResponseSchema',\n permissions: ['workflow.transition'],\n cacheable: false,\n },\n {\n method: 'POST',\n path: '/:object/:recordId/approve',\n handler: 'workflowApprove',\n category: 'workflow',\n public: false,\n summary: 'Approve workflow step',\n description: 'Approves a pending workflow approval step',\n tags: ['Workflow'],\n requestSchema: 'WorkflowApproveRequestSchema',\n responseSchema: 'WorkflowApproveResponseSchema',\n permissions: ['workflow.approve'],\n cacheable: false,\n },\n {\n method: 'POST',\n path: '/:object/:recordId/reject',\n handler: 'workflowReject',\n category: 'workflow',\n public: false,\n summary: 'Reject workflow step',\n description: 'Rejects a pending workflow approval step',\n tags: ['Workflow'],\n requestSchema: 'WorkflowRejectRequestSchema',\n responseSchema: 'WorkflowRejectResponseSchema',\n permissions: ['workflow.reject'],\n cacheable: false,\n },\n ],\n middleware: [\n { name: 'auth', type: 'authentication', enabled: true, order: 10 },\n { name: 'validation', type: 'validation', enabled: true, order: 20 },\n { name: 'response_envelope', type: 'transformation', enabled: true, order: 100 },\n { name: 'error_handler', type: 'error', enabled: true, order: 200 },\n ],\n};\n\n// ==========================================\n// Realtime Routes\n// ==========================================\n\n/**\n * Default Realtime Routes\n * Standard routes for realtime connection management and subscriptions\n */\nexport const DEFAULT_REALTIME_ROUTES: RestApiRouteRegistration = {\n prefix: '/api/v1/realtime',\n service: 'realtime',\n category: 'realtime',\n methods: ['realtimeConnect', 'realtimeDisconnect', 'realtimeSubscribe', 'realtimeUnsubscribe', 'setPresence', 'getPresence'],\n authRequired: true,\n endpoints: [\n {\n method: 'POST',\n path: '/connect',\n handler: 'realtimeConnect',\n category: 'realtime',\n public: false,\n summary: 'Establish realtime connection',\n description: 'Negotiates a realtime connection (WebSocket/SSE) and returns connection details',\n tags: ['Realtime'],\n requestSchema: 'RealtimeConnectRequestSchema',\n responseSchema: 'RealtimeConnectResponseSchema',\n cacheable: false,\n },\n {\n method: 'POST',\n path: '/disconnect',\n handler: 'realtimeDisconnect',\n category: 'realtime',\n public: false,\n summary: 'Close realtime connection',\n description: 'Closes an active realtime connection',\n tags: ['Realtime'],\n requestSchema: 'RealtimeDisconnectRequestSchema',\n responseSchema: 'RealtimeDisconnectResponseSchema',\n cacheable: false,\n },\n {\n method: 'POST',\n path: '/subscribe',\n handler: 'realtimeSubscribe',\n category: 'realtime',\n public: false,\n summary: 'Subscribe to channel',\n description: 'Subscribes to a realtime channel for receiving events',\n tags: ['Realtime'],\n requestSchema: 'RealtimeSubscribeRequestSchema',\n responseSchema: 'RealtimeSubscribeResponseSchema',\n cacheable: false,\n },\n {\n method: 'POST',\n path: '/unsubscribe',\n handler: 'realtimeUnsubscribe',\n category: 'realtime',\n public: false,\n summary: 'Unsubscribe from channel',\n description: 'Unsubscribes from a realtime channel',\n tags: ['Realtime'],\n requestSchema: 'RealtimeUnsubscribeRequestSchema',\n responseSchema: 'RealtimeUnsubscribeResponseSchema',\n cacheable: false,\n },\n {\n method: 'PUT',\n path: '/presence/:channel',\n handler: 'setPresence',\n category: 'realtime',\n public: false,\n summary: 'Set presence state',\n description: 'Sets the current user\\'s presence state in a channel',\n tags: ['Realtime'],\n requestSchema: 'SetPresenceRequestSchema',\n responseSchema: 'SetPresenceResponseSchema',\n cacheable: false,\n },\n {\n method: 'GET',\n path: '/presence/:channel',\n handler: 'getPresence',\n category: 'realtime',\n public: false,\n summary: 'Get channel presence',\n description: 'Returns all active members and their presence state in a channel',\n tags: ['Realtime'],\n responseSchema: 'GetPresenceResponseSchema',\n cacheable: false,\n },\n ],\n middleware: [\n { name: 'auth', type: 'authentication', enabled: true, order: 10 },\n { name: 'response_envelope', type: 'transformation', enabled: true, order: 100 },\n ],\n};\n\n// ==========================================\n// Notification Routes\n// ==========================================\n\n/**\n * Default Notification Routes\n * Standard routes for notification management (device registration, preferences, listing)\n */\nexport const DEFAULT_NOTIFICATION_ROUTES: RestApiRouteRegistration = {\n prefix: '/api/v1/notifications',\n service: 'notification',\n category: 'notification',\n methods: [\n 'registerDevice', 'unregisterDevice',\n 'getNotificationPreferences', 'updateNotificationPreferences',\n 'listNotifications', 'markNotificationsRead', 'markAllNotificationsRead',\n ],\n authRequired: true,\n endpoints: [\n {\n method: 'POST',\n path: '/devices',\n handler: 'registerDevice',\n category: 'notification',\n public: false,\n summary: 'Register device for push notifications',\n description: 'Registers a device token for receiving push notifications',\n tags: ['Notifications'],\n requestSchema: 'RegisterDeviceRequestSchema',\n responseSchema: 'RegisterDeviceResponseSchema',\n cacheable: false,\n },\n {\n method: 'DELETE',\n path: '/devices/:deviceId',\n handler: 'unregisterDevice',\n category: 'notification',\n public: false,\n summary: 'Unregister device',\n description: 'Removes a device from push notification registration',\n tags: ['Notifications'],\n responseSchema: 'UnregisterDeviceResponseSchema',\n cacheable: false,\n },\n {\n method: 'GET',\n path: '/preferences',\n handler: 'getNotificationPreferences',\n category: 'notification',\n public: false,\n summary: 'Get notification preferences',\n description: 'Returns current user notification preferences',\n tags: ['Notifications'],\n responseSchema: 'GetNotificationPreferencesResponseSchema',\n cacheable: false,\n },\n {\n method: 'PATCH',\n path: '/preferences',\n handler: 'updateNotificationPreferences',\n category: 'notification',\n public: false,\n summary: 'Update notification preferences',\n description: 'Updates user notification preferences',\n tags: ['Notifications'],\n requestSchema: 'UpdateNotificationPreferencesRequestSchema',\n responseSchema: 'UpdateNotificationPreferencesResponseSchema',\n cacheable: false,\n },\n {\n method: 'GET',\n path: '',\n handler: 'listNotifications',\n category: 'notification',\n public: false,\n summary: 'List notifications',\n description: 'Returns paginated list of notifications for the current user',\n tags: ['Notifications'],\n responseSchema: 'ListNotificationsResponseSchema',\n cacheable: false,\n },\n {\n method: 'POST',\n path: '/read',\n handler: 'markNotificationsRead',\n category: 'notification',\n public: false,\n summary: 'Mark notifications as read',\n description: 'Marks specific notifications as read by their IDs',\n tags: ['Notifications'],\n requestSchema: 'MarkNotificationsReadRequestSchema',\n responseSchema: 'MarkNotificationsReadResponseSchema',\n cacheable: false,\n },\n {\n method: 'POST',\n path: '/read/all',\n handler: 'markAllNotificationsRead',\n category: 'notification',\n public: false,\n summary: 'Mark all notifications as read',\n description: 'Marks all notifications as read for the current user',\n tags: ['Notifications'],\n responseSchema: 'MarkAllNotificationsReadResponseSchema',\n cacheable: false,\n },\n ],\n middleware: [\n { name: 'auth', type: 'authentication', enabled: true, order: 10 },\n { name: 'validation', type: 'validation', enabled: true, order: 20 },\n { name: 'response_envelope', type: 'transformation', enabled: true, order: 100 },\n ],\n};\n\n// ==========================================\n// AI Routes\n// ==========================================\n\n/**\n * Default AI Routes\n * Standard routes for AI operations (NLQ, Chat, Suggest, Insights)\n */\nexport const DEFAULT_AI_ROUTES: RestApiRouteRegistration = {\n prefix: '/api/v1/ai',\n service: 'ai',\n category: 'ai',\n methods: ['aiNlq', 'aiChat', 'aiSuggest', 'aiInsights'],\n authRequired: true,\n endpoints: [\n {\n method: 'POST',\n path: '/nlq',\n handler: 'aiNlq',\n category: 'ai',\n public: false,\n summary: 'Natural language query',\n description: 'Converts a natural language query to a structured query AST',\n tags: ['AI'],\n requestSchema: 'AiNlqRequestSchema',\n responseSchema: 'AiNlqResponseSchema',\n timeout: 30000,\n cacheable: false,\n },\n {\n method: 'POST',\n path: '/chat',\n handler: 'aiChat',\n category: 'ai',\n public: false,\n summary: 'AI chat interaction',\n description: 'Sends a message to the AI assistant and receives a response',\n tags: ['AI'],\n requestSchema: 'AiChatRequestSchema',\n responseSchema: 'AiChatResponseSchema',\n timeout: 60000,\n cacheable: false,\n },\n {\n method: 'POST',\n path: '/suggest',\n handler: 'aiSuggest',\n category: 'ai',\n public: false,\n summary: 'Get AI-powered suggestions',\n description: 'Returns AI-generated field value suggestions based on context',\n tags: ['AI'],\n requestSchema: 'AiSuggestRequestSchema',\n responseSchema: 'AiSuggestResponseSchema',\n timeout: 15000,\n cacheable: false,\n },\n {\n method: 'POST',\n path: '/insights',\n handler: 'aiInsights',\n category: 'ai',\n public: false,\n summary: 'Get AI-generated insights',\n description: 'Returns AI-generated insights (summaries, trends, anomalies, recommendations)',\n tags: ['AI'],\n requestSchema: 'AiInsightsRequestSchema',\n responseSchema: 'AiInsightsResponseSchema',\n timeout: 60000,\n cacheable: false,\n },\n ],\n middleware: [\n { name: 'auth', type: 'authentication', enabled: true, order: 10 },\n { name: 'validation', type: 'validation', enabled: true, order: 20 },\n { name: 'response_envelope', type: 'transformation', enabled: true, order: 100 },\n { name: 'error_handler', type: 'error', enabled: true, order: 200 },\n ],\n};\n\n// ==========================================\n// i18n Routes\n// ==========================================\n\n/**\n * Default i18n Routes\n * Standard routes for internationalization operations\n */\nexport const DEFAULT_I18N_ROUTES: RestApiRouteRegistration = {\n prefix: '/api/v1/i18n',\n service: 'i18n',\n category: 'i18n',\n methods: ['getLocales', 'getTranslations', 'getFieldLabels'],\n authRequired: true,\n endpoints: [\n {\n method: 'GET',\n path: '/locales',\n handler: 'getLocales',\n category: 'i18n',\n public: false,\n summary: 'Get available locales',\n description: 'Returns all available locales with their metadata',\n tags: ['i18n'],\n responseSchema: 'GetLocalesResponseSchema',\n cacheable: true,\n cacheTtl: 86400, // 24 hours — locales change very rarely\n },\n {\n method: 'GET',\n path: '/translations/:locale',\n handler: 'getTranslations',\n category: 'i18n',\n public: false,\n summary: 'Get translations for a locale',\n description: 'Returns translation strings for the specified locale and optional namespace',\n tags: ['i18n'],\n responseSchema: 'GetTranslationsResponseSchema',\n cacheable: true,\n cacheTtl: 3600,\n },\n {\n method: 'GET',\n path: '/labels/:object/:locale',\n handler: 'getFieldLabels',\n category: 'i18n',\n public: false,\n summary: 'Get translated field labels',\n description: 'Returns translated field labels, help text, and option labels for an object',\n tags: ['i18n'],\n responseSchema: 'GetFieldLabelsResponseSchema',\n cacheable: true,\n cacheTtl: 3600,\n },\n ],\n middleware: [\n { name: 'auth', type: 'authentication', enabled: true, order: 10 },\n { name: 'response_envelope', type: 'transformation', enabled: true, order: 100 },\n ],\n};\n\n// ==========================================\n// Analytics Routes\n// ==========================================\n\n/**\n * Default Analytics Routes\n * Standard routes for analytics and BI operations\n */\nexport const DEFAULT_ANALYTICS_ROUTES: RestApiRouteRegistration = {\n prefix: '/api/v1/analytics',\n service: 'analytics',\n category: 'analytics',\n methods: ['analyticsQuery', 'getAnalyticsMeta'],\n authRequired: true,\n endpoints: [\n {\n method: 'POST',\n path: '/query',\n handler: 'analyticsQuery',\n category: 'analytics',\n public: false,\n summary: 'Execute analytics query',\n description: 'Executes a structured analytics query against the semantic layer',\n tags: ['Analytics'],\n requestSchema: 'AnalyticsQueryRequestSchema',\n responseSchema: 'AnalyticsResultResponseSchema',\n permissions: ['analytics.query'],\n timeout: 120000, // 2 minutes for analytics queries\n cacheable: false,\n },\n {\n method: 'GET',\n path: '/meta',\n handler: 'getAnalyticsMeta',\n category: 'analytics',\n public: false,\n summary: 'Get analytics metadata',\n description: 'Returns available cubes, dimensions, measures, and segments',\n tags: ['Analytics'],\n responseSchema: 'AnalyticsMetadataResponseSchema',\n cacheable: true,\n cacheTtl: 3600,\n },\n ],\n middleware: [\n { name: 'auth', type: 'authentication', enabled: true, order: 10 },\n { name: 'validation', type: 'validation', enabled: true, order: 20 },\n { name: 'response_envelope', type: 'transformation', enabled: true, order: 100 },\n { name: 'error_handler', type: 'error', enabled: true, order: 200 },\n ],\n};\n\n// ==========================================\n// Automation Routes\n// ==========================================\n\n/**\n * Default Automation Routes\n * Standard routes for automation triggers\n */\nexport const DEFAULT_AUTOMATION_ROUTES: RestApiRouteRegistration = {\n prefix: '/api/v1/automation',\n service: 'automation',\n category: 'automation',\n methods: ['triggerAutomation'],\n authRequired: true,\n endpoints: [\n {\n method: 'POST',\n path: '/trigger',\n handler: 'triggerAutomation',\n category: 'automation',\n public: false,\n summary: 'Trigger automation',\n description: 'Triggers an automation flow or script by name',\n tags: ['Automation'],\n requestSchema: 'AutomationTriggerRequestSchema',\n responseSchema: 'AutomationTriggerResponseSchema',\n permissions: ['automation.trigger'],\n timeout: 120000, // 2 minutes for long-running automations\n cacheable: false,\n },\n ],\n middleware: [\n { name: 'auth', type: 'authentication', enabled: true, order: 10 },\n { name: 'validation', type: 'validation', enabled: true, order: 20 },\n { name: 'response_envelope', type: 'transformation', enabled: true, order: 100 },\n { name: 'error_handler', type: 'error', enabled: true, order: 200 },\n ],\n};\n\n// ==========================================\n// Helper Functions\n// ==========================================\n\n/**\n * Helper to create REST API plugin configuration\n */\nexport const RestApiPluginConfig = Object.assign(RestApiPluginConfigSchema, {\n create: <T extends z.input<typeof RestApiPluginConfigSchema>>(config: T) => config,\n});\n\n/**\n * Helper to create route registration\n */\nexport const RestApiRouteRegistration = Object.assign(RestApiRouteRegistrationSchema, {\n create: <T extends z.input<typeof RestApiRouteRegistrationSchema>>(registration: T) => registration,\n});\n\n/**\n * Get all default route registrations.\n * Returns the complete set of standard REST API routes covering all protocol namespaces.\n * \n * Route groups (13 total):\n * 1. Discovery - API capabilities and routing info\n * 2. Metadata - Object/field schema CRUD\n * 3. Data CRUD - Record operations\n * 4. Batch - Bulk operations\n * 5. Permission - Authorization checks\n * 6. Views - UI view CRUD\n * 7. Workflow - State machine transitions\n * 8. Realtime - WebSocket/SSE connections\n * 9. Notification - Push notifications and preferences\n * 10. AI - NLQ, chat, suggestions, insights\n * 11. i18n - Locales and translations\n * 12. Analytics - BI queries and metadata\n * 13. Automation - Trigger flows and scripts\n */\nexport function getDefaultRouteRegistrations(): RestApiRouteRegistration[] {\n return [\n DEFAULT_DISCOVERY_ROUTES,\n DEFAULT_METADATA_ROUTES,\n DEFAULT_DATA_CRUD_ROUTES,\n DEFAULT_BATCH_ROUTES,\n DEFAULT_PERMISSION_ROUTES,\n DEFAULT_VIEW_ROUTES,\n DEFAULT_WORKFLOW_ROUTES,\n DEFAULT_REALTIME_ROUTES,\n DEFAULT_NOTIFICATION_ROUTES,\n DEFAULT_AI_ROUTES,\n DEFAULT_I18N_ROUTES,\n DEFAULT_ANALYTICS_ROUTES,\n DEFAULT_AUTOMATION_ROUTES,\n ];\n}\n","// Copyright (c) 2025 ObjectStack. Licensed under the Apache-2.0 license.\n\nimport { z } from 'zod';\nimport { HttpMethod, CorsConfigSchema, RateLimitConfigSchema, StaticMountSchema } from '../shared/http.zod';\n\n/**\n * HTTP Server Protocol\n * \n * Defines the runtime HTTP server configuration and capabilities.\n * Provides abstractions for HTTP server implementations (Express, Fastify, Hono, etc.)\n * \n * Architecture alignment:\n * - Kubernetes: Service and Ingress resources\n * - AWS: API Gateway configuration\n * - Spring Boot: Application properties\n */\n\n// ==========================================\n// Server Configuration\n// ==========================================\n\n/**\n * HTTP Server Configuration Schema\n * Core configuration for HTTP server instances\n * \n * @example\n * {\n * \"port\": 3000,\n * \"host\": \"0.0.0.0\",\n * \"cors\": {\n * \"enabled\": true,\n * \"origins\": [\"http://localhost:3000\"]\n * },\n * \"compression\": true,\n * \"requestTimeout\": 30000\n * }\n */\nexport const HttpServerConfigSchema = z.object({\n /**\n * Server port number\n */\n port: z.number().int().min(1).max(65535).default(3000).describe('Port number to listen on'),\n \n /**\n * Server host address\n */\n host: z.string().default('0.0.0.0').describe('Host address to bind to'),\n \n /**\n * CORS configuration\n */\n cors: CorsConfigSchema.optional().describe('CORS configuration'),\n \n /**\n * Request handling options\n */\n requestTimeout: z.number().int().default(30000).describe('Request timeout in milliseconds'),\n bodyLimit: z.string().default('10mb').describe('Maximum request body size'),\n \n /**\n * Compression settings\n */\n compression: z.boolean().default(true).describe('Enable response compression'),\n \n /**\n * Security headers\n */\n security: z.object({\n helmet: z.boolean().default(true).describe('Enable security headers via helmet'),\n rateLimit: RateLimitConfigSchema.optional().describe('Global rate limiting configuration'),\n }).optional().describe('Security configuration'),\n \n /**\n * Static file serving\n */\n static: z.array(StaticMountSchema).optional().describe('Static file serving configuration'),\n \n /**\n * Trust proxy settings\n */\n trustProxy: z.boolean().default(false).describe('Trust X-Forwarded-* headers'),\n});\n\nexport type HttpServerConfig = z.infer<typeof HttpServerConfigSchema>;\nexport type HttpServerConfigInput = z.input<typeof HttpServerConfigSchema>;\n\n// ==========================================\n// Route Registration\n// ==========================================\n\n/**\n * Route Handler Metadata Schema\n * Metadata for route handlers used in registration\n */\nexport const RouteHandlerMetadataSchema = z.object({\n /**\n * HTTP method\n */\n method: HttpMethod.describe('HTTP method'),\n \n /**\n * URL path pattern (supports parameters like /api/users/:id)\n */\n path: z.string().describe('URL path pattern'),\n \n /**\n * Handler function name or identifier\n */\n handler: z.string().describe('Handler identifier or name'),\n \n /**\n * Route metadata\n */\n metadata: z.object({\n summary: z.string().optional().describe('Route summary for documentation'),\n description: z.string().optional().describe('Route description'),\n tags: z.array(z.string()).optional().describe('Tags for grouping'),\n operationId: z.string().optional().describe('Unique operation identifier'),\n }).optional(),\n \n /**\n * Security requirements\n */\n security: z.object({\n authRequired: z.boolean().default(true).describe('Require authentication'),\n permissions: z.array(z.string()).optional().describe('Required permissions'),\n rateLimit: z.string().optional().describe('Rate limit policy override'),\n }).optional(),\n});\n\nexport type RouteHandlerMetadata = z.infer<typeof RouteHandlerMetadataSchema>;\nexport type RouteHandlerMetadataInput = z.input<typeof RouteHandlerMetadataSchema>;\n\n// ==========================================\n// Middleware Configuration\n// ==========================================\n\n/**\n * Middleware Type Enum\n */\nexport const MiddlewareType = z.enum([\n 'authentication', // Authentication middleware\n 'authorization', // Authorization/permission checks\n 'logging', // Request/response logging\n 'validation', // Input validation\n 'transformation', // Request/response transformation\n 'error', // Error handling\n 'custom', // Custom middleware\n]);\n\nexport type MiddlewareType = z.infer<typeof MiddlewareType>;\n\n/**\n * Middleware Configuration Schema\n * Defines middleware execution order and configuration\n * \n * @example\n * {\n * \"name\": \"auth_middleware\",\n * \"type\": \"authentication\",\n * \"enabled\": true,\n * \"order\": 10,\n * \"config\": {\n * \"jwtSecret\": \"secret\",\n * \"excludePaths\": [\"/health\", \"/metrics\"]\n * }\n * }\n */\nexport const MiddlewareConfigSchema = z.object({\n /**\n * Middleware identifier\n */\n name: z.string().regex(/^[a-z_][a-z0-9_]*$/).describe('Middleware name (snake_case)'),\n \n /**\n * Middleware type\n */\n type: MiddlewareType.describe('Middleware type'),\n \n /**\n * Enable/disable middleware\n */\n enabled: z.boolean().default(true).describe('Whether middleware is enabled'),\n \n /**\n * Execution order (lower numbers execute first)\n */\n order: z.number().int().default(100).describe('Execution order priority'),\n \n /**\n * Middleware-specific configuration\n */\n config: z.record(z.string(), z.unknown()).optional().describe('Middleware configuration object'),\n \n /**\n * Path patterns to apply middleware to\n */\n paths: z.object({\n include: z.array(z.string()).optional().describe('Include path patterns (glob)'),\n exclude: z.array(z.string()).optional().describe('Exclude path patterns (glob)'),\n }).optional().describe('Path filtering'),\n});\n\nexport type MiddlewareConfig = z.infer<typeof MiddlewareConfigSchema>;\nexport type MiddlewareConfigInput = z.input<typeof MiddlewareConfigSchema>;\n\n// ==========================================\n// Server Lifecycle Events\n// ==========================================\n\n/**\n * Server Event Type Enum\n */\nexport const ServerEventType = z.enum([\n 'starting', // Server is starting\n 'started', // Server has started and is listening\n 'stopping', // Server is stopping\n 'stopped', // Server has stopped\n 'request', // Request received\n 'response', // Response sent\n 'error', // Error occurred\n]);\n\nexport type ServerEventType = z.infer<typeof ServerEventType>;\n\n/**\n * Server Event Schema\n * Events emitted by the HTTP server during lifecycle\n */\nexport const ServerEventSchema = z.object({\n /**\n * Event type\n */\n type: ServerEventType.describe('Event type'),\n \n /**\n * Timestamp\n */\n timestamp: z.string().datetime().describe('Event timestamp (ISO 8601)'),\n \n /**\n * Event payload\n */\n data: z.record(z.string(), z.unknown()).optional().describe('Event-specific data'),\n});\n\nexport type ServerEvent = z.infer<typeof ServerEventSchema>;\n\n// ==========================================\n// Server Capability Declaration\n// ==========================================\n\n/**\n * Server Capabilities Schema\n * Declares what features a server implementation supports\n */\nexport const ServerCapabilitiesSchema = z.object({\n /**\n * Supported HTTP versions\n */\n httpVersions: z.array(z.enum(['1.0', '1.1', '2.0', '3.0'])).default(['1.1']).describe('Supported HTTP versions'),\n \n /**\n * WebSocket support\n */\n websocket: z.boolean().default(false).describe('WebSocket support'),\n \n /**\n * Server-Sent Events support\n */\n sse: z.boolean().default(false).describe('Server-Sent Events support'),\n \n /**\n * HTTP/2 Server Push\n */\n serverPush: z.boolean().default(false).describe('HTTP/2 Server Push support'),\n \n /**\n * Streaming support\n */\n streaming: z.boolean().default(true).describe('Response streaming support'),\n \n /**\n * Middleware support\n */\n middleware: z.boolean().default(true).describe('Middleware chain support'),\n \n /**\n * Route parameterization\n */\n routeParams: z.boolean().default(true).describe('URL parameter support (/users/:id)'),\n \n /**\n * Built-in compression\n */\n compression: z.boolean().default(true).describe('Built-in compression support'),\n});\n\nexport type ServerCapabilities = z.infer<typeof ServerCapabilitiesSchema>;\nexport type ServerCapabilitiesInput = z.input<typeof ServerCapabilitiesSchema>;\n\n// ==========================================\n// Server Status & Metrics\n// ==========================================\n\n/**\n * Server Status Schema\n * Current operational status of the server\n */\nexport const ServerStatusSchema = z.object({\n /**\n * Server state\n */\n state: z.enum(['stopped', 'starting', 'running', 'stopping', 'error']).describe('Current server state'),\n \n /**\n * Uptime in milliseconds\n */\n uptime: z.number().int().optional().describe('Server uptime in milliseconds'),\n \n /**\n * Server information\n */\n server: z.object({\n port: z.number().int().describe('Listening port'),\n host: z.string().describe('Bound host'),\n url: z.string().optional().describe('Full server URL'),\n }).optional(),\n \n /**\n * Connection metrics\n */\n connections: z.object({\n active: z.number().int().describe('Active connections'),\n total: z.number().int().describe('Total connections handled'),\n }).optional(),\n \n /**\n * Request metrics\n */\n requests: z.object({\n total: z.number().int().describe('Total requests processed'),\n success: z.number().int().describe('Successful requests'),\n errors: z.number().int().describe('Failed requests'),\n }).optional(),\n});\n\nexport type ServerStatus = z.infer<typeof ServerStatusSchema>;\n\n// ==========================================\n// Helper Functions\n// ==========================================\n\n/**\n * Helper to create HTTP server configuration\n */\nexport const HttpServerConfig = Object.assign(HttpServerConfigSchema, {\n create: <T extends z.input<typeof HttpServerConfigSchema>>(config: T) => config,\n});\n\n/**\n * Helper to create middleware configuration\n */\nexport const MiddlewareConfig = Object.assign(MiddlewareConfigSchema, {\n create: <T extends z.input<typeof MiddlewareConfigSchema>>(config: T) => config,\n});\n"],"mappings":";AAEA,SAAS,KAAAA,UAAS;;;ACAlB,SAAS,KAAAC,UAAS;;;ACAlB,SAAS,SAAS;AAiCX,IAAM,uBAAuB,EAAE,OAAO;AAAA,EAC3C,QAAQ,EAAE,OAAO,EAAE,SAAS,6BAA6B;AAC3D,CAAC;AAYM,IAAM,yBAAyB,EAAE,OAAO;AAAA;AAAA,EAE7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IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,EACF;AACF;","names":["z","z","z","z","z","z","z","z","z","z","z","z","z","z","z","z","z","z","z","z","z","z","z","z","z","z","z","z","z","z","z","z","z","z","z","z","z","z","z","z","z","z","z","z","z","z","z","z","z","z","z","z","z","z","z","z","z","z","z","z","z","z","z","z","z","VersioningConfigSchema","z","z","z","z","z","z","z","z","z","z","z"]}
|
|
1
|
+
{"version":3,"sources":["../../src/api/contract.zod.ts","../../src/data/query.zod.ts","../../src/data/filter.zod.ts","../../src/api/endpoint.zod.ts","../../src/shared/http.zod.ts","../../src/api/discovery.zod.ts","../../src/api/realtime-shared.zod.ts","../../src/api/realtime.zod.ts","../../src/api/websocket.zod.ts","../../src/shared/identifiers.zod.ts","../../src/api/router.zod.ts","../../src/api/odata.zod.ts","../../src/api/graphql.zod.ts","../../src/api/batch.zod.ts","../../src/api/http-cache.zod.ts","../../src/api/errors.zod.ts","../../src/api/protocol.zod.ts","../../src/ui/view.zod.ts","../../src/ui/i18n.zod.ts","../../src/security/permission.zod.ts","../../src/security/rls.zod.ts","../../src/automation/workflow.zod.ts","../../src/system/translation.zod.ts","../../src/kernel/package-registry.zod.ts","../../src/kernel/manifest.zod.ts","../../src/kernel/plugin-capability.zod.ts","../../src/kernel/plugin-loading.zod.ts","../../src/kernel/plugin.zod.ts","../../src/data/dataset.zod.ts","../../src/api/rest-server.zod.ts","../../src/api/registry.zod.ts","../../src/api/documentation.zod.ts","../../src/api/analytics.zod.ts","../../src/data/analytics.zod.ts","../../src/api/versioning.zod.ts","../../src/api/auth.zod.ts","../../src/api/auth-endpoints.zod.ts","../../src/api/storage.zod.ts","../../src/system/object-storage.zod.ts","../../src/api/metadata.zod.ts","../../src/data/object.zod.ts","../../src/data/field.zod.ts","../../src/system/encryption.zod.ts","../../src/system/masking.zod.ts","../../src/data/validation.zod.ts","../../src/automation/state-machine.zod.ts","../../src/ui/app.zod.ts","../../src/api/dispatcher.zod.ts","../../src/system/core-services.zod.ts","../../src/api/plugin-rest-api.zod.ts","../../src/system/http-server.zod.ts","../../src/api/query-adapter.zod.ts"],"sourcesContent":["// Copyright (c) 2025 ObjectStack. Licensed under the Apache-2.0 license.\n\nimport { z } from 'zod';\nimport { QuerySchema } from '../data/query.zod';\n\n// ==========================================\n// 1. Base Envelopes\n// ==========================================\n\nexport const ApiErrorSchema = z.object({\n code: z.string().describe('Error code (e.g. validation_error)'),\n message: z.string().describe('Readable error message'),\n category: z.string().optional().describe('Error category (e.g. validation, authorization)'),\n details: z.unknown().optional().describe('Additional error context (e.g. field validation errors)'),\n requestId: z.string().optional().describe('Request ID for tracking'),\n});\n\nexport const BaseResponseSchema = z.object({\n success: z.boolean().describe('Operation success status'),\n error: ApiErrorSchema.optional().describe('Error details if success is false'),\n meta: z.object({\n timestamp: z.string(),\n duration: z.number().optional(),\n requestId: z.string().optional(),\n traceId: z.string().optional(),\n }).optional().describe('Response metadata'),\n});\n\n// ==========================================\n// 2. Request Payloads (Inputs)\n// ==========================================\n\nexport const RecordDataSchema = z.record(z.string(), z.unknown()).describe('Key-value map of record data');\n\n/**\n * Standard Create Request\n */\nexport const CreateRequestSchema = z.object({\n data: RecordDataSchema.describe('Record data to insert'),\n});\n\n/**\n * Standard Update Request\n */\nexport const UpdateRequestSchema = z.object({\n data: RecordDataSchema.describe('Partial record data to update'),\n});\n\n/**\n * Standard Bulk Request\n */\nexport const BulkRequestSchema = z.object({\n records: z.array(RecordDataSchema).describe('Array of records to process'),\n allOrNone: z.boolean().default(true).describe('If true, rollback entire transaction on any failure'),\n});\n\n/**\n * Export Request\n */\nexport const ExportRequestSchema = z.intersection(\n QuerySchema,\n z.object({\n format: z.enum(['csv', 'json', 'xlsx']).default('csv'),\n })\n);\n\n// ==========================================\n// 3. Response Payloads (Outputs)\n// ==========================================\n\n/**\n * Single Record Response (Get/Create/Update)\n */\nexport const SingleRecordResponseSchema = BaseResponseSchema.extend({\n data: RecordDataSchema.describe('The requested or modified record'),\n});\n\n/**\n * List/Query Response\n */\nexport const ListRecordResponseSchema = BaseResponseSchema.extend({\n data: z.array(RecordDataSchema).describe('Array of matching records'),\n pagination: z.object({\n total: z.number().optional().describe('Total matching records count'),\n limit: z.number().optional().describe('Page size'),\n offset: z.number().optional().describe('Page offset'),\n cursor: z.string().optional().describe('Cursor for next page'),\n nextCursor: z.string().optional().describe('Next cursor for pagination'),\n hasMore: z.boolean().describe('Are there more pages?'),\n }).describe('Pagination info'),\n});\n\n/**\n * ID Request (Get/Delete)\n */\nexport const IdRequestSchema = z.object({\n id: z.string().describe('Record ID'),\n});\n\n/**\n * Modification Result (for Batch/Bulk operations)\n */\nexport const ModificationResultSchema = z.object({\n id: z.string().optional().describe('Record ID if processed'),\n success: z.boolean(),\n errors: z.array(ApiErrorSchema).optional(),\n index: z.number().optional().describe('Index in original request'),\n data: z.unknown().optional().describe('Result data (e.g. created record)'),\n});\n\n/**\n * Bulk Operation Response\n */\nexport const BulkResponseSchema = BaseResponseSchema.extend({\n data: z.array(ModificationResultSchema).describe('Results for each item in the batch'),\n});\n\n/**\n * Delete Response\n */\nexport const DeleteResponseSchema = BaseResponseSchema.extend({\n id: z.string().describe('ID of the deleted record'),\n});\n\n// ==========================================\n// 4. API Contract Registry\n// ==========================================\n\n/**\n * Standard API Contracts map\n * Used for generating SDKs and Documentation\n */\nexport const StandardApiContracts = {\n create: {\n input: CreateRequestSchema,\n output: SingleRecordResponseSchema\n },\n delete: {\n input: IdRequestSchema,\n output: DeleteResponseSchema\n },\n get: {\n input: IdRequestSchema,\n output: SingleRecordResponseSchema\n },\n update: {\n input: UpdateRequestSchema,\n output: SingleRecordResponseSchema\n },\n list: {\n input: QuerySchema,\n output: ListRecordResponseSchema\n },\n bulkCreate: {\n input: BulkRequestSchema,\n output: BulkResponseSchema\n },\n bulkUpdate: {\n input: BulkRequestSchema,\n output: BulkResponseSchema\n },\n bulkUpsert: {\n input: BulkRequestSchema,\n output: BulkResponseSchema\n },\n bulkDelete: {\n input: z.object({ ids: z.array(z.string()) }),\n output: BulkResponseSchema\n }\n};\n\n// ==========================================\n// 5. DataLoader / N+1 Query Prevention\n// ==========================================\n\n/**\n * DataLoader Configuration Schema\n * Batch loading configuration to prevent N+1 query problems\n */\nexport const DataLoaderConfigSchema = z.object({\n maxBatchSize: z.number().int().default(100).describe('Maximum number of keys per batch load'),\n batchScheduleFn: z.enum(['microtask', 'timeout', 'manual']).default('microtask')\n .describe('Scheduling strategy for collecting batch keys'),\n cacheEnabled: z.boolean().default(true).describe('Enable per-request result caching'),\n cacheKeyFn: z.string().optional().describe('Name or identifier of the cache key function'),\n cacheTtl: z.number().min(0).optional().describe('Cache time-to-live in seconds (0 = no expiration)'),\n coalesceRequests: z.boolean().default(true).describe('Deduplicate identical requests within a batch window'),\n maxConcurrency: z.number().int().optional().describe('Maximum parallel batch requests'),\n});\n\n/**\n * Batch Loading Strategy Schema\n * Defines how batched data loading is orchestrated\n */\nexport const BatchLoadingStrategySchema = z.object({\n strategy: z.enum(['dataloader', 'windowed', 'prefetch']).describe('Batch loading strategy type'),\n windowMs: z.number().optional().describe('Collection window duration in milliseconds (for windowed strategy)'),\n prefetchDepth: z.number().int().optional().describe('Depth of relation prefetching (for prefetch strategy)'),\n associationLoading: z.enum(['lazy', 'eager', 'batch']).default('batch')\n .describe('How to load related associations'),\n});\n\n/**\n * Query Optimization Configuration Schema\n * Top-level configuration for N+1 prevention and query optimization\n */\nexport const QueryOptimizationConfigSchema = z.object({\n preventNPlusOne: z.boolean().describe('Enable N+1 query detection and prevention'),\n dataLoader: DataLoaderConfigSchema.optional().describe('DataLoader batch loading configuration'),\n batchStrategy: BatchLoadingStrategySchema.optional().describe('Batch loading strategy configuration'),\n maxQueryDepth: z.number().int().describe('Maximum depth for nested relation queries'),\n queryComplexityLimit: z.number().optional().describe('Maximum allowed query complexity score'),\n enableQueryPlan: z.boolean().default(false).describe('Log query execution plans for debugging'),\n});\n\nexport type ApiError = z.infer<typeof ApiErrorSchema>;\nexport type BaseResponse = z.infer<typeof BaseResponseSchema>;\nexport type RecordData = z.infer<typeof RecordDataSchema>;\nexport type CreateRequest = z.infer<typeof CreateRequestSchema>;\nexport type UpdateRequest = z.infer<typeof UpdateRequestSchema>;\nexport type BulkRequest = z.infer<typeof BulkRequestSchema>;\nexport type ExportRequest = z.infer<typeof ExportRequestSchema>;\nexport type SingleRecordResponse = z.infer<typeof SingleRecordResponseSchema>;\nexport type ListRecordResponse = z.infer<typeof ListRecordResponseSchema>;\nexport type IdRequest = z.infer<typeof IdRequestSchema>;\nexport type ModificationResult = z.infer<typeof ModificationResultSchema>;\nexport type BulkResponse = z.infer<typeof BulkResponseSchema>;\nexport type DeleteResponse = z.infer<typeof DeleteResponseSchema>;\nexport type DataLoaderConfig = z.infer<typeof DataLoaderConfigSchema>;\nexport type BatchLoadingStrategy = z.infer<typeof BatchLoadingStrategySchema>;\nexport type QueryOptimizationConfig = z.infer<typeof QueryOptimizationConfigSchema>;\n","// Copyright (c) 2025 ObjectStack. Licensed under the Apache-2.0 license.\n\nimport { z } from 'zod';\nimport { FilterConditionSchema } from './filter.zod';\n\n/**\n * Sort Node\n * Represents \"Order By\".\n */\nexport const SortNodeSchema = z.object({\n field: z.string(),\n order: z.enum(['asc', 'desc']).default('asc')\n});\n\n/**\n * Aggregation Function Enum\n * Standard aggregation functions for data analysis.\n * \n * Supported Functions:\n * - **count**: Count rows (SQL: COUNT(*) or COUNT(field))\n * - **sum**: Sum numeric values (SQL: SUM(field))\n * - **avg**: Average numeric values (SQL: AVG(field))\n * - **min**: Minimum value (SQL: MIN(field))\n * - **max**: Maximum value (SQL: MAX(field))\n * - **count_distinct**: Count unique values (SQL: COUNT(DISTINCT field))\n * - **array_agg**: Aggregate values into array (SQL: ARRAY_AGG(field))\n * - **string_agg**: Concatenate values (SQL: STRING_AGG(field, delimiter))\n * \n * Performance Considerations:\n * - COUNT(*) is typically faster than COUNT(field) as it doesn't check for nulls\n * - COUNT DISTINCT may require additional memory for tracking unique values\n * - Window aggregates (with OVER clause) can be more efficient than subqueries\n * - Large GROUP BY operations benefit from proper indexing on grouped fields\n * \n * @example\n * // SQL: SELECT region, SUM(amount) FROM sales GROUP BY region\n * {\n * object: 'sales',\n * fields: ['region'],\n * aggregations: [\n * { function: 'sum', field: 'amount', alias: 'total_sales' }\n * ],\n * groupBy: ['region']\n * }\n * \n * @example\n * // Salesforce SOQL: SELECT COUNT(Id) FROM Account\n * {\n * object: 'account',\n * aggregations: [\n * { function: 'count', alias: 'total_accounts' }\n * ]\n * }\n */\nexport const AggregationFunction = z.enum([\n 'count', 'sum', 'avg', 'min', 'max',\n 'count_distinct', 'array_agg', 'string_agg'\n]);\n\n/**\n * Aggregation Node\n * Represents an aggregated field with function.\n * \n * Aggregations summarize data across groups of rows (GROUP BY).\n * Used with `groupBy` to create analytical queries.\n * \n * @example\n * // SQL: SELECT customer_id, COUNT(*), SUM(amount) FROM orders GROUP BY customer_id\n * {\n * object: 'order',\n * fields: ['customer_id'],\n * aggregations: [\n * { function: 'count', alias: 'order_count' },\n * { function: 'sum', field: 'amount', alias: 'total_amount' }\n * ],\n * groupBy: ['customer_id']\n * }\n * \n * @example\n * // Salesforce SOQL: SELECT LeadSource, COUNT(Id) FROM Lead GROUP BY LeadSource\n * {\n * object: 'lead',\n * fields: ['lead_source'],\n * aggregations: [\n * { function: 'count', alias: 'lead_count' }\n * ],\n * groupBy: ['lead_source']\n * }\n */\nexport const AggregationNodeSchema = z.object({\n function: AggregationFunction.describe('Aggregation function'),\n field: z.string().optional().describe('Field to aggregate (optional for COUNT(*))'),\n alias: z.string().describe('Result column alias'),\n distinct: z.boolean().optional().describe('Apply DISTINCT before aggregation'),\n filter: FilterConditionSchema.optional().describe('Filter/Condition to apply to the aggregation (FILTER WHERE clause)'),\n});\n\n/**\n * Join Type Enum\n * Standard SQL join types for combining tables.\n * \n * Join Types:\n * - **inner**: Returns only matching rows from both tables (SQL: INNER JOIN)\n * - **left**: Returns all rows from left table, matching rows from right (SQL: LEFT JOIN)\n * - **right**: Returns all rows from right table, matching rows from left (SQL: RIGHT JOIN)\n * - **full**: Returns all rows from both tables (SQL: FULL OUTER JOIN)\n * \n * @example\n * // SQL: SELECT * FROM orders INNER JOIN customers ON orders.customer_id = customers.id\n * {\n * object: 'order',\n * joins: [\n * {\n * type: 'inner',\n * object: 'customer',\n * on: ['order.customer_id', '=', 'customer.id']\n * }\n * ]\n * }\n * \n * @example\n * // Salesforce SOQL-style: Find all customers and their orders (if any)\n * {\n * object: 'customer',\n * joins: [\n * {\n * type: 'left',\n * object: 'order',\n * on: ['customer.id', '=', 'order.customer_id']\n * }\n * ]\n * }\n */\nexport const JoinType = z.enum(['inner', 'left', 'right', 'full']);\n\n/**\n * Join Execution Strategy\n * Hints to the query engine on how to execute the join.\n * \n * Strategies:\n * - **auto**: Engine decides best strategy (Default).\n * - **database**: Push down join to the database (Requires same datasource).\n * - **hash**: Load both sets into memory and hash join (Cross-datasource, memory intensive).\n * - **loop**: Nested loop lookup (N+1 safe version). (Good for small right-side lookups).\n */\nexport const JoinStrategy = z.enum(['auto', 'database', 'hash', 'loop']);\n\n/**\n * Join Node\n * Represents table joins for combining data from multiple objects.\n * \n * Joins connect related data across multiple tables using ON conditions.\n * Supports both direct object joins and subquery joins.\n * \n * @example\n * // SQL: SELECT o.*, c.name FROM orders o INNER JOIN customers c ON o.customer_id = c.id\n * {\n * object: 'order',\n * fields: ['id', 'amount'],\n * joins: [\n * {\n * type: 'inner',\n * object: 'customer',\n * alias: 'c',\n * on: ['order.customer_id', '=', 'c.id']\n * }\n * ]\n * }\n * \n * @example\n * // SQL: Multi-table join\n * // SELECT * FROM orders o\n * // INNER JOIN customers c ON o.customer_id = c.id\n * // LEFT JOIN shipments s ON o.id = s.order_id\n * {\n * object: 'order',\n * joins: [\n * {\n * type: 'inner',\n * object: 'customer',\n * alias: 'c',\n * on: ['order.customer_id', '=', 'c.id']\n * },\n * {\n * type: 'left',\n * object: 'shipment',\n * alias: 's',\n * on: ['order.id', '=', 's.order_id']\n * }\n * ]\n * }\n * \n * @example\n * // Salesforce SOQL: SELECT Name, (SELECT LastName FROM Contacts) FROM Account\n * {\n * object: 'account',\n * fields: ['name'],\n * joins: [\n * {\n * type: 'left',\n * object: 'contact',\n * on: ['account.id', '=', 'contact.account_id']\n * }\n * ]\n * }\n * \n * @example\n * // Subquery Join: Join with a filtered/aggregated dataset\n * {\n * object: 'customer',\n * joins: [\n * {\n * type: 'left',\n * object: 'order',\n * alias: 'high_value_orders',\n * on: ['customer.id', '=', 'high_value_orders.customer_id'],\n * subquery: {\n * object: 'order',\n * fields: ['customer_id', 'total'],\n * filters: ['total', '>', 1000]\n * }\n * }\n * ]\n * }\n */\nexport const JoinNodeSchema: z.ZodType<any> = z.lazy(() => \n z.object({\n type: JoinType.describe('Join type'),\n strategy: JoinStrategy.optional().describe('Execution strategy hint'),\n object: z.string().describe('Object/table to join'),\n alias: z.string().optional().describe('Table alias'),\n on: FilterConditionSchema.describe('Join condition'),\n subquery: z.lazy(() => QuerySchema).optional().describe('Subquery instead of object'),\n })\n);\n\n/**\n * Window Function Enum\n * Advanced analytical functions for row-based calculations.\n * \n * Window Functions:\n * - **row_number**: Sequential number within partition (SQL: ROW_NUMBER() OVER (...))\n * - **rank**: Rank with gaps for ties (SQL: RANK() OVER (...))\n * - **dense_rank**: Rank without gaps (SQL: DENSE_RANK() OVER (...))\n * - **percent_rank**: Relative rank as percentage (SQL: PERCENT_RANK() OVER (...))\n * - **lag**: Access previous row value (SQL: LAG(field) OVER (...))\n * - **lead**: Access next row value (SQL: LEAD(field) OVER (...))\n * - **first_value**: First value in window (SQL: FIRST_VALUE(field) OVER (...))\n * - **last_value**: Last value in window (SQL: LAST_VALUE(field) OVER (...))\n * - **sum/avg/count/min/max**: Aggregates over window (SQL: SUM(field) OVER (...))\n * \n * @example\n * // SQL: SELECT *, ROW_NUMBER() OVER (PARTITION BY customer_id ORDER BY amount DESC) as rank\n * // FROM orders\n * {\n * object: 'order',\n * fields: ['id', 'customer_id', 'amount'],\n * windowFunctions: [\n * {\n * function: 'row_number',\n * alias: 'rank',\n * over: {\n * partitionBy: ['customer_id'],\n * orderBy: [{ field: 'amount', order: 'desc' }]\n * }\n * }\n * ]\n * }\n * \n * @example\n * // SQL: Running total with SUM() OVER (...)\n * {\n * object: 'transaction',\n * fields: ['date', 'amount'],\n * windowFunctions: [\n * {\n * function: 'sum',\n * field: 'amount',\n * alias: 'running_total',\n * over: {\n * orderBy: [{ field: 'date', order: 'asc' }],\n * frame: {\n * type: 'rows',\n * start: 'UNBOUNDED PRECEDING',\n * end: 'CURRENT ROW'\n * }\n * }\n * }\n * ]\n * }\n */\nexport const WindowFunction = z.enum([\n 'row_number', 'rank', 'dense_rank', 'percent_rank',\n 'lag', 'lead', 'first_value', 'last_value',\n 'sum', 'avg', 'count', 'min', 'max'\n]);\n\n/**\n * Window Specification\n * Defines PARTITION BY and ORDER BY for window functions.\n * \n * Window specifications control how window functions compute values:\n * - **partitionBy**: Divide rows into groups (like GROUP BY but without collapsing rows)\n * - **orderBy**: Define order for ranking and offset functions\n * - **frame**: Specify which rows to include in aggregate calculations\n * \n * @example\n * // Partition by department, order by salary\n * {\n * partitionBy: ['department'],\n * orderBy: [{ field: 'salary', order: 'desc' }]\n * }\n * \n * @example\n * // Moving average with frame specification\n * {\n * orderBy: [{ field: 'date', order: 'asc' }],\n * frame: {\n * type: 'rows',\n * start: '6 PRECEDING',\n * end: 'CURRENT ROW'\n * }\n * }\n */\nexport const WindowSpecSchema = z.object({\n partitionBy: z.array(z.string()).optional().describe('PARTITION BY fields'),\n orderBy: z.array(SortNodeSchema).optional().describe('ORDER BY specification'),\n frame: z.object({\n type: z.enum(['rows', 'range']).optional(),\n start: z.string().optional().describe('Frame start (e.g., \"UNBOUNDED PRECEDING\", \"1 PRECEDING\")'),\n end: z.string().optional().describe('Frame end (e.g., \"CURRENT ROW\", \"1 FOLLOWING\")'),\n }).optional().describe('Window frame specification'),\n});\n\n/**\n * Window Function Node\n * Represents window function with OVER clause.\n * \n * Window functions perform calculations across a set of rows related to the current row,\n * without collapsing the result set (unlike GROUP BY aggregations).\n * \n * @example\n * // SQL: Top 3 products per category\n * // SELECT *, ROW_NUMBER() OVER (PARTITION BY category ORDER BY sales DESC) as rank\n * // FROM products\n * {\n * object: 'product',\n * fields: ['name', 'category', 'sales'],\n * windowFunctions: [\n * {\n * function: 'row_number',\n * alias: 'category_rank',\n * over: {\n * partitionBy: ['category'],\n * orderBy: [{ field: 'sales', order: 'desc' }]\n * }\n * }\n * ]\n * }\n * \n * @example\n * // SQL: Year-over-year comparison with LAG\n * {\n * object: 'monthly_sales',\n * fields: ['month', 'revenue'],\n * windowFunctions: [\n * {\n * function: 'lag',\n * field: 'revenue',\n * alias: 'prev_year_revenue',\n * over: {\n * orderBy: [{ field: 'month', order: 'asc' }]\n * }\n * }\n * ]\n * }\n */\nexport const WindowFunctionNodeSchema = z.object({\n function: WindowFunction.describe('Window function name'),\n field: z.string().optional().describe('Field to operate on (for aggregate window functions)'),\n alias: z.string().describe('Result column alias'),\n over: WindowSpecSchema.describe('Window specification (OVER clause)'),\n});\n\n/**\n * Field Selection Node\n * Represents \"Select\" attributes, including joins.\n */\nexport const FieldNodeSchema: z.ZodType<any> = z.lazy(() => \n z.union([\n z.string(), // Primitive field: \"name\"\n z.object({\n field: z.string(), // Relationship field: \"owner\"\n fields: z.array(FieldNodeSchema).optional(), // Nested select: [\"name\", \"email\"]\n alias: z.string().optional()\n })\n ])\n);\n\n/**\n * Full-Text Search Configuration\n * Defines full-text search parameters for text queries.\n * \n * Supports:\n * - Multi-field search\n * - Relevance scoring\n * - Fuzzy matching\n * - Language-specific analyzers\n * \n * @example\n * {\n * query: \"John Smith\",\n * fields: [\"name\", \"email\", \"description\"],\n * fuzzy: true,\n * boost: { \"name\": 2.0, \"email\": 1.5 }\n * }\n */\nexport const FullTextSearchSchema = z.object({\n query: z.string().describe('Search query text'),\n fields: z.array(z.string()).optional().describe('Fields to search in (if not specified, searches all text fields)'),\n fuzzy: z.boolean().optional().default(false).describe('Enable fuzzy matching (tolerates typos)'),\n operator: z.enum(['and', 'or']).optional().default('or').describe('Logical operator between terms'),\n boost: z.record(z.string(), z.number()).optional().describe('Field-specific relevance boosting (field name -> boost factor)'),\n minScore: z.number().optional().describe('Minimum relevance score threshold'),\n language: z.string().optional().describe('Language for text analysis (e.g., \"en\", \"zh\", \"es\")'),\n highlight: z.boolean().optional().default(false).describe('Enable search result highlighting'),\n});\n\nexport type FullTextSearch = z.infer<typeof FullTextSearchSchema>;\n\n/**\n * Query AST Schema\n * The universal data retrieval contract defined in `ast-structure.mdx`.\n * \n * This schema represents ObjectQL - a universal query language that abstracts\n * SQL, NoSQL, and SaaS APIs into a single unified interface.\n * \n * Updates (v2):\n * - Aligned with modern ORM standards (Prisma/TypeORM)\n * - Added `cursor` based pagination support\n * - Renamed `top`/`skip` to `limit`/`offset`\n * - Unified filtering syntax with `FilterConditionSchema`\n * \n * Updates (v3):\n * - Added `search` parameter for full-text search (P2 requirement)\n * \n * @example\n * // Simple query: SELECT name, email FROM account WHERE status = 'active'\n * {\n * object: 'account',\n * fields: ['name', 'email'],\n * where: { status: 'active' }\n * }\n * \n * @example\n * // Pagination with Limit/Offset\n * {\n * object: 'post',\n * where: { published: true },\n * orderBy: [{ field: 'created_at', order: 'desc' }],\n * limit: 20,\n * offset: 40\n * }\n * \n * @example\n * // Full-text search\n * {\n * object: 'article',\n * search: {\n * query: \"machine learning\",\n * fields: [\"title\", \"content\"],\n * fuzzy: true,\n * boost: { \"title\": 2.0 }\n * },\n * limit: 10\n * }\n */\nconst BaseQuerySchema = z.object({\n /** Target Entity */\n object: z.string().describe('Object name (e.g. account)'),\n \n /** Select Clause */\n fields: z.array(FieldNodeSchema).optional().describe('Fields to retrieve'),\n \n /** Where Clause (Filtering) */\n where: FilterConditionSchema.optional().describe('Filtering criteria (WHERE)'),\n \n /** Full-Text Search */\n search: FullTextSearchSchema.optional().describe('Full-text search configuration ($search parameter)'),\n \n /** Order By Clause (Sorting) */\n orderBy: z.array(SortNodeSchema).optional().describe('Sorting instructions (ORDER BY)'),\n \n /** Pagination */\n limit: z.number().optional().describe('Max records to return (LIMIT)'),\n offset: z.number().optional().describe('Records to skip (OFFSET)'),\n top: z.number().optional().describe('Alias for limit (OData compatibility)'),\n cursor: z.record(z.string(), z.unknown()).optional().describe('Cursor for keyset pagination'),\n \n /** Joins */\n joins: z.array(JoinNodeSchema).optional().describe('Explicit Table Joins'),\n \n /** Aggregations */\n aggregations: z.array(AggregationNodeSchema).optional().describe('Aggregation functions'),\n \n /** Group By Clause */\n groupBy: z.array(z.string()).optional().describe('GROUP BY fields'),\n \n /** Having Clause */\n having: FilterConditionSchema.optional().describe('HAVING clause for aggregation filtering'),\n \n /** Window Functions */\n windowFunctions: z.array(WindowFunctionNodeSchema).optional().describe('Window functions with OVER clause'),\n \n /** Subquery flag */\n distinct: z.boolean().optional().describe('SELECT DISTINCT flag'),\n});\n\nexport type QueryAST = z.infer<typeof BaseQuerySchema> & {\n expand?: Record<string, QueryAST>;\n};\n\nexport type QueryInput = z.input<typeof BaseQuerySchema> & {\n expand?: Record<string, QueryInput>;\n};\n\nexport const QuerySchema: z.ZodType<QueryAST> = BaseQuerySchema.extend({\n expand: z.lazy(() => z.record(z.string(), QuerySchema)).optional().describe('Recursive relation loading (nested queries)'),\n});\n\nexport type SortNode = z.infer<typeof SortNodeSchema>;\nexport type AggregationNode = z.infer<typeof AggregationNodeSchema>;\nexport type JoinNode = z.infer<typeof JoinNodeSchema>;\nexport type WindowFunctionNode = z.infer<typeof WindowFunctionNodeSchema>;\nexport type WindowSpec = z.infer<typeof WindowSpecSchema>;\n","// Copyright (c) 2025 ObjectStack. Licensed under the Apache-2.0 license.\n\nimport { z } from 'zod';\n\n/**\n * Unified Query DSL Specification\n * \n * Based on industry best practices from:\n * - Prisma ORM\n * - Strapi CMS\n * - TypeORM\n * - LoopBack Framework\n * \n * Version: 1.0.0\n * Status: Draft\n * \n * Objective: Define a JSON-based, database-agnostic query syntax standard\n * for data filtering interactions between frontend and backend APIs.\n * \n * Design Principles:\n * 1. Declarative: Frontend describes \"what data to get\", not \"how to query\"\n * 2. Database Agnostic: Syntax contains no database-specific directives\n * 3. Type Safe: Structure can be statically inferred by TypeScript\n * 4. Convention over Configuration: Implicit syntax for common queries\n */\n\n/**\n * Field Reference\n * Represents a reference to another field/column instead of a literal value.\n * Used for joins (ON clause) and cross-field comparisons.\n * \n * @example\n * // user.id = order.owner_id\n * { \"$eq\": { \"$field\": \"order.owner_id\" } }\n */\nexport const FieldReferenceSchema = z.object({\n $field: z.string().describe('Field Reference/Column Name')\n});\n\nexport type FieldReference = z.infer<typeof FieldReferenceSchema>;\n\n// ============================================================================\n// 3.1 Comparison Operators\n// ============================================================================\n\n/**\n * Comparison operators for equality and inequality checks.\n * Supported data types: Any\n */\nexport const EqualityOperatorSchema = z.object({\n /** Equal to (default) - SQL: = | MongoDB: $eq */\n $eq: z.any().optional(),\n \n /** Not equal to - SQL: <> or != | MongoDB: $ne */\n $ne: z.any().optional(),\n});\n\n/**\n * Comparison operators for numeric and date comparisons.\n * Supported data types: Number, Date\n */\nexport const ComparisonOperatorSchema = z.object({\n /** Greater than - SQL: > | MongoDB: $gt */\n $gt: z.union([z.number(), z.date(), FieldReferenceSchema]).optional(),\n \n /** Greater than or equal to - SQL: >= | MongoDB: $gte */\n $gte: z.union([z.number(), z.date(), FieldReferenceSchema]).optional(),\n \n /** Less than - SQL: < | MongoDB: $lt */\n $lt: z.union([z.number(), z.date(), FieldReferenceSchema]).optional(),\n \n /** Less than or equal to - SQL: <= | MongoDB: $lte */\n $lte: z.union([z.number(), z.date(), FieldReferenceSchema]).optional(),\n});\n\n// ============================================================================\n// 3.2 Set & Range Operators\n// ============================================================================\n\n/**\n * Set operators for membership checks.\n */\nexport const SetOperatorSchema = z.object({\n /** In list - SQL: IN (?, ?, ?) | MongoDB: $in */\n $in: z.array(z.any()).optional(),\n \n /** Not in list - SQL: NOT IN (...) | MongoDB: $nin */\n $nin: z.array(z.any()).optional(),\n});\n\n/**\n * Range operator for interval checks (closed interval).\n * SQL: BETWEEN ? AND ? | MongoDB: $gte AND $lte\n */\nexport const RangeOperatorSchema = z.object({\n /** Between (inclusive) - takes [min, max] array */\n $between: z.tuple([\n z.union([z.number(), z.date(), FieldReferenceSchema]),\n z.union([z.number(), z.date(), FieldReferenceSchema])\n ]).optional(),\n});\n\n// ============================================================================\n// 3.3 String-Specific Operators\n// ============================================================================\n\n/**\n * String pattern matching operators.\n * Note: Case sensitivity should be handled at backend level.\n */\nexport const StringOperatorSchema = z.object({\n /** Contains substring - SQL: LIKE %?% | MongoDB: $regex */\n $contains: z.string().optional(),\n \n /** Starts with prefix - SQL: LIKE ?% | MongoDB: $regex */\n $startsWith: z.string().optional(),\n \n /** Ends with suffix - SQL: LIKE %? | MongoDB: $regex */\n $endsWith: z.string().optional(),\n});\n\n// ============================================================================\n// 3.5 Special Operators\n// ============================================================================\n\n/**\n * Special check operators for null and existence.\n */\nexport const SpecialOperatorSchema = z.object({\n /** Is null check - SQL: IS NULL (true) / IS NOT NULL (false) | MongoDB: field: null */\n $null: z.boolean().optional(),\n \n /** Field exists check (primarily for NoSQL) - MongoDB: $exists */\n $exists: z.boolean().optional(),\n});\n\n// ============================================================================\n// Combined Field Operators\n// ============================================================================\n\n/**\n * All field-level operators combined.\n * These can be applied to individual fields in a filter.\n */\nexport const FieldOperatorsSchema = z.object({\n // Equality\n $eq: z.any().optional(),\n $ne: z.any().optional(),\n \n // Comparison (numeric/date)\n $gt: z.union([z.number(), z.date(), FieldReferenceSchema]).optional(),\n $gte: z.union([z.number(), z.date(), FieldReferenceSchema]).optional(),\n $lt: z.union([z.number(), z.date(), FieldReferenceSchema]).optional(),\n $lte: z.union([z.number(), z.date(), FieldReferenceSchema]).optional(),\n \n // Set & Range\n $in: z.array(z.any()).optional(),\n $nin: z.array(z.any()).optional(),\n $between: z.tuple([\n z.union([z.number(), z.date(), FieldReferenceSchema]),\n z.union([z.number(), z.date(), FieldReferenceSchema])\n ]).optional(),\n \n // String-specific\n $contains: z.string().optional(),\n $startsWith: z.string().optional(),\n $endsWith: z.string().optional(),\n \n // Special\n $null: z.boolean().optional(),\n $exists: z.boolean().optional(),\n});\n\n// ============================================================================\n// 3.4 Logical Operators & Recursive Filter Structure\n// ============================================================================\n\n/**\n * Recursive filter type that supports:\n * 1. Implicit equality: { field: value }\n * 2. Explicit operators: { field: { $op: value } }\n * 3. Logical combinations: { $and: [...], $or: [...], $not: {...} }\n * 4. Nested relations: { relation: { field: value } }\n */\nexport type FilterCondition = {\n [key: string]: \n | any // Implicit equality: key: value\n | z.infer<typeof FieldOperatorsSchema> // Explicit operators: key: { $op: value }\n | FilterCondition; // Nested relation: key: { nested: ... }\n} & {\n /** Logical AND - combines all conditions that must be true */\n $and?: FilterCondition[];\n \n /** Logical OR - at least one condition must be true */\n $or?: FilterCondition[];\n \n /** Logical NOT - negates the condition */\n $not?: FilterCondition;\n};\n\n/**\n * Zod schema for recursive filter validation.\n * Uses z.lazy() to handle recursive structure.\n */\nexport const FilterConditionSchema: z.ZodType<FilterCondition> = z.lazy(() =>\n z.record(z.string(), z.unknown()).and(\n z.object({\n $and: z.array(FilterConditionSchema).optional(),\n $or: z.array(FilterConditionSchema).optional(),\n $not: FilterConditionSchema.optional(),\n })\n )\n);\n\n// ============================================================================\n// Query Filter Wrapper\n// ============================================================================\n\n/**\n * Top-level query filter wrapper.\n * This is typically used as the \"where\" clause in a query.\n * \n * @example\n * ```typescript\n * const filter: QueryFilter = {\n * where: {\n * status: \"active\", // Implicit equality\n * age: { $gte: 18 }, // Explicit operator\n * $or: [ // Logical combination\n * { role: \"admin\" },\n * { email: { $contains: \"@company.com\" } }\n * ],\n * profile: { // Nested relation\n * verified: true\n * }\n * }\n * }\n * ```\n */\nexport const QueryFilterSchema = z.object({\n where: FilterConditionSchema.optional(),\n});\n\n// ============================================================================\n// TypeScript Type Exports\n// ============================================================================\n\n/**\n * Type-safe filter operators for use in TypeScript.\n * \n * @example\n * ```typescript\n * type UserFilter = Filter<User>;\n * \n * const filter: UserFilter = {\n * age: { $gte: 18 },\n * email: { $contains: \"@example.com\" }\n * };\n * ```\n */\nexport type Filter<T = any> = {\n [K in keyof T]?: \n | T[K] // Implicit equality\n | {\n $eq?: T[K];\n $ne?: T[K];\n $gt?: T[K] extends number | Date ? T[K] : never;\n $gte?: T[K] extends number | Date ? T[K] : never;\n $lt?: T[K] extends number | Date ? T[K] : never;\n $lte?: T[K] extends number | Date ? T[K] : never;\n $in?: T[K][];\n $nin?: T[K][];\n $between?: T[K] extends number | Date ? [T[K], T[K]] : never;\n $contains?: T[K] extends string ? string : never;\n $startsWith?: T[K] extends string ? string : never;\n $endsWith?: T[K] extends string ? string : never;\n $null?: boolean;\n $exists?: boolean;\n }\n | (T[K] extends object ? Filter<T[K]> : never); // Nested relation\n} & {\n $and?: Filter<T>[];\n $or?: Filter<T>[];\n $not?: Filter<T>;\n};\n\n/**\n * Scalar types supported by the filter system.\n */\nexport type Scalar = string | number | boolean | Date | null;\n\n// Export inferred types\nexport type FieldOperators = z.infer<typeof FieldOperatorsSchema>;\nexport type QueryFilter = z.infer<typeof QueryFilterSchema>;\n\n// ============================================================================\n// Normalization Utilities (Internal Representation)\n// ============================================================================\n\n/**\n * Normalized filter AST structure.\n * This is the internal representation after converting all syntactic sugar\n * to explicit operators.\n * \n * Stage 1: Normalization Pass\n * Input: { age: 18, role: \"admin\" }\n * Output: { $and: [{ age: { $eq: 18 } }, { role: { $eq: \"admin\" } }] }\n * \n * This simplifies adapter implementation by providing a consistent structure.\n */\nexport const NormalizedFilterSchema: z.ZodType<any> = z.lazy(() => \n z.object({\n $and: z.array(\n z.union([\n // Field condition: { field: { $op: value } }\n z.record(z.string(), FieldOperatorsSchema),\n // Nested logical group\n NormalizedFilterSchema,\n ])\n ).optional(),\n \n $or: z.array(\n z.union([\n z.record(z.string(), FieldOperatorsSchema),\n NormalizedFilterSchema,\n ])\n ).optional(),\n \n $not: z.union([\n z.record(z.string(), FieldOperatorsSchema),\n NormalizedFilterSchema,\n ]).optional(),\n })\n);\n\nexport type NormalizedFilter = z.infer<typeof NormalizedFilterSchema>;\n\n// ============================================================================\n// Constants & Metadata\n// ============================================================================\n\n/**\n * All supported operator keys.\n * Useful for validation and parsing.\n */\nexport const FILTER_OPERATORS = [\n // Equality\n '$eq', '$ne',\n // Comparison\n '$gt', '$gte', '$lt', '$lte',\n // Set & Range\n '$in', '$nin', '$between',\n // String\n '$contains', '$startsWith', '$endsWith',\n // Special\n '$null', '$exists',\n] as const;\n\n/**\n * Logical operator keys.\n */\nexport const LOGICAL_OPERATORS = ['$and', '$or', '$not'] as const;\n\n/**\n * All operator keys (field + logical).\n */\nexport const ALL_OPERATORS = [...FILTER_OPERATORS, ...LOGICAL_OPERATORS] as const;\n\nexport type FilterOperatorKey = typeof FILTER_OPERATORS[number];\nexport type LogicalOperatorKey = typeof LOGICAL_OPERATORS[number];\nexport type OperatorKey = typeof ALL_OPERATORS[number];\n","// Copyright (c) 2025 ObjectStack. Licensed under the Apache-2.0 license.\n\nimport { z } from 'zod';\nimport { HttpMethod, RateLimitConfigSchema } from '../shared/http.zod';\n\n/**\n * Rate Limit Strategy\n * @deprecated Use RateLimitConfigSchema from shared/http.zod.ts instead\n */\nexport const RateLimitSchema = RateLimitConfigSchema;\n\n/**\n * API Mapping Schema\n * Transform input/output data.\n */\nexport const ApiMappingSchema = z.object({\n source: z.string().describe('Source field/path'),\n target: z.string().describe('Target field/path'),\n transform: z.string().optional().describe('Transformation function name'),\n});\n\n/**\n * API Endpoint Schema\n * Defines an external facing API contract.\n */\nexport const ApiEndpointSchema = z.object({\n /** Identity */\n name: z.string().regex(/^[a-z_][a-z0-9_]*$/).describe('Unique endpoint ID'),\n path: z.string().regex(/^\\//).describe('URL Path (e.g. /api/v1/customers)'),\n method: HttpMethod.describe('HTTP Method'),\n \n /** Documentation */\n summary: z.string().optional(),\n description: z.string().optional(),\n \n /** Execution Logic */\n type: z.enum(['flow', 'script', 'object_operation', 'proxy']).describe('Implementation type'),\n target: z.string().describe('Target Flow ID, Script Name, or Proxy URL'),\n \n /** Logic Config */\n objectParams: z.object({\n object: z.string().optional(),\n operation: z.enum(['find', 'get', 'create', 'update', 'delete']).optional(),\n }).optional().describe('For object_operation type'),\n \n /** Data Transformation */\n inputMapping: z.array(ApiMappingSchema).optional().describe('Map Request Body to Internal Params'),\n outputMapping: z.array(ApiMappingSchema).optional().describe('Map Internal Result to Response Body'),\n \n /** Policies */\n authRequired: z.boolean().default(true).describe('Require authentication'),\n rateLimit: RateLimitSchema.optional().describe('Rate limiting policy'),\n cacheTtl: z.number().optional().describe('Response cache TTL in seconds'),\n});\n\nexport const ApiEndpoint = Object.assign(ApiEndpointSchema, {\n create: <T extends z.input<typeof ApiEndpointSchema>>(config: T) => config,\n});\n\nexport type ApiEndpoint = z.infer<typeof ApiEndpointSchema>;\nexport type ApiEndpointInput = z.input<typeof ApiEndpointSchema>;\n","// Copyright (c) 2025 ObjectStack. Licensed under the Apache-2.0 license.\n\nimport { z } from 'zod';\n\n/**\n * Shared HTTP Schemas\n * \n * Common HTTP-related schemas used across API and System protocols.\n * These schemas ensure consistency across different parts of the stack.\n */\n\n// ==========================================\n// Basic HTTP Types\n// ==========================================\n\n/**\n * HTTP Method Enum\n */\nexport const HttpMethod = z.enum([\n 'GET', \n 'POST', \n 'PUT', \n 'DELETE', \n 'PATCH', \n 'HEAD', \n 'OPTIONS'\n]);\n\nexport type HttpMethod = z.infer<typeof HttpMethod>;\n\n// ==========================================\n// CORS Configuration\n// ==========================================\n\n/**\n * CORS Configuration Schema\n * Cross-Origin Resource Sharing configuration\n * \n * Used by:\n * - api/router.zod.ts (RouterConfigSchema)\n * - system/http-server.zod.ts (HttpServerConfigSchema)\n * \n * @example\n * {\n * \"enabled\": true,\n * \"origins\": [\"http://localhost:3000\", \"https://app.example.com\"],\n * \"methods\": [\"GET\", \"POST\", \"PUT\", \"DELETE\"],\n * \"credentials\": true,\n * \"maxAge\": 86400\n * }\n */\nexport const CorsConfigSchema = z.object({\n /**\n * Enable CORS\n */\n enabled: z.boolean().default(true).describe('Enable CORS'),\n \n /**\n * Allowed origins (* for all)\n */\n origins: z.union([\n z.string(),\n z.array(z.string())\n ]).default('*').describe('Allowed origins (* for all)'),\n \n /**\n * Allowed HTTP methods\n */\n methods: z.array(HttpMethod).optional().describe('Allowed HTTP methods'),\n \n /**\n * Allow credentials (cookies, authorization headers)\n */\n credentials: z.boolean().default(false).describe('Allow credentials (cookies, authorization headers)'),\n \n /**\n * Preflight cache duration in seconds\n */\n maxAge: z.number().int().optional().describe('Preflight cache duration in seconds'),\n});\n\nexport type CorsConfig = z.infer<typeof CorsConfigSchema>;\n\n// ==========================================\n// Rate Limiting\n// ==========================================\n\n/**\n * Rate Limit Configuration Schema\n * \n * Used by:\n * - api/endpoint.zod.ts (ApiEndpointSchema)\n * - system/http-server.zod.ts (HttpServerConfigSchema)\n * \n * @example\n * {\n * \"enabled\": true,\n * \"windowMs\": 60000,\n * \"maxRequests\": 100\n * }\n */\nexport const RateLimitConfigSchema = z.object({\n /**\n * Enable rate limiting\n */\n enabled: z.boolean().default(false).describe('Enable rate limiting'),\n \n /**\n * Time window in milliseconds\n */\n windowMs: z.number().int().default(60000).describe('Time window in milliseconds'),\n \n /**\n * Max requests per window\n */\n maxRequests: z.number().int().default(100).describe('Max requests per window'),\n});\n\nexport type RateLimitConfig = z.infer<typeof RateLimitConfigSchema>;\n\n// ==========================================\n// Static File Serving\n// ==========================================\n\n/**\n * Static Mount Configuration Schema\n * Configuration for serving static files\n * \n * Used by:\n * - api/router.zod.ts (RouterConfigSchema)\n * - system/http-server.zod.ts (HttpServerConfigSchema)\n * \n * @example\n * {\n * \"path\": \"/static\",\n * \"directory\": \"./public\",\n * \"cacheControl\": \"public, max-age=31536000\"\n * }\n */\nexport const StaticMountSchema = z.object({\n /**\n * URL path to serve from\n */\n path: z.string().describe('URL path to serve from'),\n \n /**\n * Physical directory to serve\n */\n directory: z.string().describe('Physical directory to serve'),\n \n /**\n * Cache-Control header value\n */\n cacheControl: z.string().optional().describe('Cache-Control header value'),\n});\n\nexport type StaticMount = z.infer<typeof StaticMountSchema>;\n","// Copyright (c) 2025 ObjectStack. Licensed under the Apache-2.0 license.\n\nimport { z } from 'zod';\n\n/**\n * API Capabilities Schema\n * \n * @deprecated Capabilities are now derived from `services` map.\n * Each service's `enabled` field replaces the corresponding capability flag.\n * Kept for backward compatibility; will be removed in a future major version.\n */\nexport const ApiCapabilitiesSchema = z.object({\n graphql: z.boolean().default(false),\n search: z.boolean().default(false),\n websockets: z.boolean().default(false),\n files: z.boolean().default(true),\n analytics: z.boolean().default(false).describe('Is the Analytics/BI engine enabled?'),\n ai: z.boolean().default(false).describe('Is the AI engine enabled?'),\n workflow: z.boolean().default(false).describe('Is the Workflow engine enabled?'),\n notifications: z.boolean().default(false).describe('Is the Notification service enabled?'),\n i18n: z.boolean().default(false).describe('Is the i18n service enabled?'),\n});\n\n/**\n * Service Status in Discovery Response\n * Reports per-service availability so clients can adapt their UI accordingly.\n */\nexport const ServiceInfoSchema = z.object({\n /** Whether the service is enabled and available */\n enabled: z.boolean(),\n /** Current operational status */\n status: z.enum(['available', 'unavailable', 'degraded', 'stub']).describe(\n 'available = fully operational, unavailable = not installed, degraded = partial, stub = placeholder that throws'\n ),\n /** Route path (only present if enabled) */\n route: z.string().optional().describe('e.g. /api/v1/analytics'),\n /** Implementation provider name */\n provider: z.string().optional().describe('e.g. \"objectql\", \"plugin-redis\", \"driver-memory\"'),\n /** Human-readable reason if unavailable */\n message: z.string().optional().describe('e.g. \"Install plugin-workflow to enable\"'),\n});\n\n/**\n * API Routes Schema\n * The \"Map\" for the frontend to know where to send requests.\n * This decouples the frontend from hardcoded URL paths.\n */\nexport const ApiRoutesSchema = z.object({\n /** Base URL for Object CRUD (Data Protocol) */\n data: z.string().describe('e.g. /api/v1/data'),\n \n /** Base URL for Schema Definitions (Metadata Protocol) */\n metadata: z.string().describe('e.g. /api/v1/meta'),\n\n /** Base URL for UI Configurations (Views, Menus) */\n ui: z.string().optional().describe('e.g. /api/v1/ui'),\n \n /** Base URL for Authentication (plugin-provided) */\n auth: z.string().optional().describe('e.g. /api/v1/auth'),\n \n /** Base URL for Automation (Flows/Scripts) */\n automation: z.string().optional().describe('e.g. /api/v1/automation'),\n \n /** Base URL for File/Storage operations */\n storage: z.string().optional().describe('e.g. /api/v1/storage'),\n \n /** Base URL for Analytics/BI operations */\n analytics: z.string().optional().describe('e.g. /api/v1/analytics'),\n \n /** GraphQL Endpoint (if enabled) */\n graphql: z.string().optional().describe('e.g. /graphql'),\n\n /** Base URL for Package Management */\n packages: z.string().optional().describe('e.g. /api/v1/packages'),\n\n /** Base URL for Workflow Engine */\n workflow: z.string().optional().describe('e.g. /api/v1/workflow'),\n\n /** Base URL for Realtime (WebSocket/SSE) */\n realtime: z.string().optional().describe('e.g. /api/v1/realtime'),\n\n /** Base URL for Notification Service */\n notifications: z.string().optional().describe('e.g. /api/v1/notifications'),\n\n /** Base URL for AI Engine (NLQ, Chat, Suggest) */\n ai: z.string().optional().describe('e.g. /api/v1/ai'),\n\n /** Base URL for Internationalization */\n i18n: z.string().optional().describe('e.g. /api/v1/i18n'),\n});\n\n/**\n * Discovery Response Schema\n * The root object returned by the Metadata Discovery Endpoint.\n * \n * Design rationale:\n * - `services` is the single source of truth for service availability.\n * Each service entry includes `enabled`, `status`, `route`, and `provider`.\n * - `routes` is a convenience shortcut: a flat map of service-name → route-path\n * so that clients can resolve endpoints without iterating the services map.\n * - `capabilities`/`features` was removed because it was fully derivable\n * from `services[x].enabled`. Use `services` to determine feature availability.\n */\nexport const DiscoverySchema = z.object({\n /** System Identity */\n name: z.string(),\n version: z.string(),\n environment: z.enum(['production', 'sandbox', 'development']),\n \n /** Dynamic Routing — convenience shortcut for client routing */\n routes: ApiRoutesSchema,\n \n /** Localization Info (helping frontend init i18n) */\n locale: z.object({\n default: z.string(),\n supported: z.array(z.string()),\n timezone: z.string(),\n }),\n \n /**\n * Per-service status map.\n * This is the **single source of truth** for service availability.\n * Clients use this to determine which features are available,\n * show/hide UI elements, and display appropriate messages.\n */\n services: z.record(z.string(), ServiceInfoSchema).describe(\n 'Per-service availability map keyed by CoreServiceName'\n ),\n\n /**\n * Custom metadata key-value pairs for extensibility\n */\n metadata: z.record(z.string(), z.unknown()).optional().describe('Custom metadata key-value pairs for extensibility'),\n});\n\nexport type DiscoveryResponse = z.infer<typeof DiscoverySchema>;\nexport type ApiRoutes = z.infer<typeof ApiRoutesSchema>;\nexport type ApiCapabilities = z.infer<typeof ApiCapabilitiesSchema>;\nexport type ServiceInfo = z.infer<typeof ServiceInfoSchema>;\n","// Copyright (c) 2025 ObjectStack. Licensed under the Apache-2.0 license.\n\nimport { z } from 'zod';\n\n/**\n * Realtime Shared Protocol\n * \n * Shared schemas and types for real-time communication protocols.\n * This module consolidates overlapping definitions between the transport-level\n * realtime protocol (SSE/Polling/WebSocket) and the WebSocket collaboration protocol.\n * \n * **Architecture:**\n * - `realtime-shared.zod.ts` — Shared base schemas (Presence, Event types)\n * - `realtime.zod.ts` — Transport-layer protocol (Channel, Subscription, Transport selection)\n * - `websocket.zod.ts` — Collaboration protocol (Cursor, OT editing, Advanced presence)\n * \n * @see realtime.zod.ts for transport-layer configuration\n * @see websocket.zod.ts for collaborative editing protocol\n */\n\n// ==========================================\n// Shared Presence Status\n// ==========================================\n\n/**\n * Presence Status Enum (Unified)\n * \n * Canonical user presence status shared across all realtime protocols.\n * Used by both transport-level presence tracking (realtime.zod.ts)\n * and WebSocket collaboration presence (websocket.zod.ts).\n * \n * @example\n * ```typescript\n * import { PresenceStatus } from './realtime-shared.zod';\n * const status = PresenceStatus.parse('online'); // ✅\n * ```\n */\nexport const PresenceStatus = z.enum([\n 'online', // User is actively connected\n 'away', // User is idle/inactive\n 'busy', // User is busy (do not disturb)\n 'offline', // User is disconnected\n]);\n\nexport type PresenceStatus = z.infer<typeof PresenceStatus>;\n\n// ==========================================\n// Shared Realtime Actions\n// ==========================================\n\n/**\n * Realtime Record Action Enum (Unified)\n * \n * Canonical action types for real-time record change events.\n * Shared between transport-level events and WebSocket event messages.\n */\nexport const RealtimeRecordAction = z.enum([\n 'created',\n 'updated',\n 'deleted',\n]);\n\nexport type RealtimeRecordAction = z.infer<typeof RealtimeRecordAction>;\n\n// ==========================================\n// Shared Base Presence Schema\n// ==========================================\n\n/**\n * Base Presence Schema (Unified)\n * \n * Core presence fields shared across all realtime protocols.\n * Transport-level (realtime.zod.ts) and collaboration-level (websocket.zod.ts)\n * presence schemas extend this base with protocol-specific fields.\n * \n * @example\n * ```typescript\n * const presence = BasePresenceSchema.parse({\n * userId: 'user-123',\n * status: 'online',\n * lastSeen: '2024-01-15T10:30:00Z',\n * });\n * ```\n */\nexport const BasePresenceSchema = z.object({\n /** User identifier */\n userId: z.string().describe('User identifier'),\n\n /** Current presence status */\n status: PresenceStatus.describe('Current presence status'),\n\n /** Last activity timestamp */\n lastSeen: z.string().datetime().describe('ISO 8601 datetime of last activity'),\n\n /** Custom metadata */\n metadata: z.record(z.string(), z.unknown()).optional().describe('Custom presence data (e.g., current page, custom status)'),\n});\n\nexport type BasePresence = z.infer<typeof BasePresenceSchema>;\n","// Copyright (c) 2025 ObjectStack. Licensed under the Apache-2.0 license.\n\nimport { z } from 'zod';\nimport { PresenceStatus, RealtimeRecordAction, BasePresenceSchema } from './realtime-shared.zod';\n\n// Re-export shared types for backward compatibility\nexport { PresenceStatus, RealtimeRecordAction, BasePresenceSchema } from './realtime-shared.zod';\nexport type { BasePresence } from './realtime-shared.zod';\n\n/**\n * Transport Protocol Enum\n * Defines the communication protocol for realtime data synchronization\n */\nexport const TransportProtocol = z.enum([\n 'websocket', // Full-duplex, low latency communication\n 'sse', // Server-Sent Events, unidirectional push\n 'polling', // Short polling, best compatibility\n]);\n\nexport type TransportProtocol = z.infer<typeof TransportProtocol>;\n\n/**\n * Event Type Enum\n * Types of realtime events that can be subscribed to\n */\nexport const RealtimeEventType = z.enum([\n 'record.created',\n 'record.updated',\n 'record.deleted',\n 'field.changed',\n]);\n\nexport type RealtimeEventType = z.infer<typeof RealtimeEventType>;\n\n/**\n * Subscription Event Configuration\n * Defines what events to subscribe to with optional filtering\n */\nexport const SubscriptionEventSchema = z.object({\n type: RealtimeEventType.describe('Type of event to subscribe to'),\n object: z.string().optional().describe('Object name to subscribe to'),\n filters: z.unknown().optional().describe('Filter conditions'),\n});\n\n/**\n * Subscription Schema\n * Configuration for subscribing to realtime events\n */\nexport const SubscriptionSchema = z.object({\n id: z.string().uuid().describe('Unique subscription identifier'),\n events: z.array(SubscriptionEventSchema).describe('Array of events to subscribe to'),\n transport: TransportProtocol.describe('Transport protocol to use'),\n channel: z.string().optional().describe('Optional channel name for grouping subscriptions'),\n});\n\nexport type Subscription = z.infer<typeof SubscriptionSchema>;\n\n/**\n * Presence Status Enum\n * @deprecated Use `PresenceStatus` from `realtime-shared.zod.ts` instead.\n * Kept for backward compatibility.\n */\nexport const RealtimePresenceStatus = PresenceStatus;\n\nexport type RealtimePresenceStatus = z.infer<typeof RealtimePresenceStatus>;\n\n/**\n * Presence Schema\n * Tracks user online status and metadata.\n * Extends the shared BasePresenceSchema for transport-level presence tracking.\n */\nexport const RealtimePresenceSchema = BasePresenceSchema;\n\nexport type RealtimePresence = z.infer<typeof RealtimePresenceSchema>;\n\n/**\n * Realtime Action Enum\n * @deprecated Use `RealtimeRecordAction` from `realtime-shared.zod.ts` instead.\n * Kept for backward compatibility.\n */\nexport const RealtimeAction = RealtimeRecordAction;\n\nexport type RealtimeAction = z.infer<typeof RealtimeAction>;\n\n/**\n * Realtime Event Schema\n * Represents a realtime synchronization event\n */\nexport const RealtimeEventSchema = z.object({\n id: z.string().uuid().describe('Unique event identifier'),\n type: z.string().describe('Event type (e.g., record.created, record.updated)'),\n object: z.string().optional().describe('Object name the event relates to'),\n action: RealtimeAction.optional().describe('Action performed'),\n payload: z.record(z.string(), z.unknown()).describe('Event payload data'),\n timestamp: z.string().datetime().describe('ISO 8601 datetime when event occurred'),\n userId: z.string().optional().describe('User who triggered the event'),\n sessionId: z.string().optional().describe('Session identifier'),\n});\n\nexport type RealtimeEvent = z.infer<typeof RealtimeEventSchema>;\n\n/**\n * Realtime Configuration Schema\n * \n * Configuration for enabling realtime data synchronization.\n */\nexport const RealtimeConfigSchema = z.object({\n /** Enable realtime sync */\n enabled: z.boolean().default(true).describe('Enable realtime synchronization'),\n \n /** Transport protocol */\n transport: TransportProtocol.default('websocket').describe('Transport protocol'),\n \n /** Default subscriptions */\n subscriptions: z.array(SubscriptionSchema).optional().describe('Default subscriptions'),\n}).passthrough(); // Allow additional properties\n\nexport type RealtimeConfig = z.infer<typeof RealtimeConfigSchema>;\n","// Copyright (c) 2025 ObjectStack. Licensed under the Apache-2.0 license.\n\nimport { z } from 'zod';\nimport { EventNameSchema } from '../shared/identifiers.zod';\nimport { PresenceStatus } from './realtime-shared.zod';\n\n// Re-export shared PresenceStatus for backward compatibility\nexport { PresenceStatus } from './realtime-shared.zod';\n\n/**\n * WebSocket Event Protocol\n * \n * Defines the schema for WebSocket-based real-time communication in ObjectStack.\n * Supports event subscriptions, filtering, presence tracking, and collaborative editing.\n * \n * Industry alignment: Firebase Realtime Database, Socket.IO, Pusher\n */\n\n// ==========================================\n// Message Types\n// ==========================================\n\n/**\n * WebSocket Message Type Enum\n * Defines the types of messages that can be sent over WebSocket\n */\nexport const WebSocketMessageType = z.enum([\n 'subscribe', // Client subscribes to events\n 'unsubscribe', // Client unsubscribes from events\n 'event', // Server sends event to client\n 'ping', // Keepalive ping\n 'pong', // Keepalive pong response\n 'ack', // Acknowledgment of message receipt\n 'error', // Error message\n 'presence', // Presence update (user status)\n 'cursor', // Cursor position update (collaborative editing)\n 'edit', // Document edit operation (collaborative editing)\n]);\n\nexport type WebSocketMessageType = z.infer<typeof WebSocketMessageType>;\n\n// ==========================================\n// Event Subscription\n// ==========================================\n\n/**\n * Event Filter Operator Enum\n * SQL-like filter operators for event filtering\n */\nexport const FilterOperator = z.enum([\n 'eq', // Equal\n 'ne', // Not equal\n 'gt', // Greater than\n 'gte', // Greater than or equal\n 'lt', // Less than\n 'lte', // Less than or equal\n 'in', // In array\n 'nin', // Not in array\n 'contains', // String contains\n 'startsWith', // String starts with\n 'endsWith', // String ends with\n 'exists', // Field exists\n 'regex', // Regex match\n]);\n\nexport type FilterOperator = z.infer<typeof FilterOperator>;\n\n/**\n * Event Filter Condition\n * Defines a single filter condition for event filtering\n */\nexport const EventFilterCondition = z.object({\n field: z.string().describe('Field path to filter on (supports dot notation, e.g., \"user.email\")'),\n operator: FilterOperator.describe('Comparison operator'),\n value: z.unknown().optional().describe('Value to compare against (not needed for \"exists\" operator)'),\n});\n\nexport type EventFilterCondition = z.infer<typeof EventFilterCondition>;\n\n/**\n * Event Filter Schema\n * Logical combination of filter conditions\n */\nexport const EventFilterSchema: z.ZodType<{\n conditions?: EventFilterCondition[];\n and?: EventFilter[];\n or?: EventFilter[];\n not?: EventFilter;\n}> = z.object({\n conditions: z.array(EventFilterCondition).optional().describe('Array of filter conditions'),\n and: z.lazy(() => z.array(EventFilterSchema)).optional().describe('AND logical combination of filters'),\n or: z.lazy(() => z.array(EventFilterSchema)).optional().describe('OR logical combination of filters'),\n not: z.lazy(() => EventFilterSchema).optional().describe('NOT logical negation of filter'),\n});\n\nexport type EventFilter = z.infer<typeof EventFilterSchema>;\n\n/**\n * Event Pattern Schema\n * Event name pattern that supports wildcards for subscriptions\n */\nexport const EventPatternSchema = z\n .string()\n .min(1)\n .regex(/^[a-z*][a-z0-9_.*]*$/, {\n message: 'Event pattern must be lowercase and may contain letters, numbers, underscores, dots, or wildcards (e.g., \"record.*\", \"*.created\", \"user.login\")',\n })\n .describe('Event pattern (supports wildcards like \"record.*\" or \"*.created\")');\n\nexport type EventPattern = z.infer<typeof EventPatternSchema>;\n\n/**\n * Event Subscription Config\n * Configuration for subscribing to specific events\n */\nexport const EventSubscriptionSchema = z.object({\n subscriptionId: z.string().uuid().describe('Unique subscription identifier'),\n events: z.array(EventPatternSchema).describe('Event patterns to subscribe to (supports wildcards, e.g., \"record.*\", \"user.created\")'),\n objects: z.array(z.string()).optional().describe('Object names to filter events by (e.g., [\"account\", \"contact\"])'),\n filters: EventFilterSchema.optional().describe('Advanced filter conditions for event payloads'),\n channels: z.array(z.string()).optional().describe('Channel names for scoped subscriptions'),\n});\n\nexport type EventSubscription = z.infer<typeof EventSubscriptionSchema>;\n\n/**\n * Unsubscribe Request\n * Request to unsubscribe from events\n */\nexport const UnsubscribeRequestSchema = z.object({\n subscriptionId: z.string().uuid().describe('Subscription ID to unsubscribe from'),\n});\n\nexport type UnsubscribeRequest = z.infer<typeof UnsubscribeRequestSchema>;\n\n// ==========================================\n// Presence Tracking\n// ==========================================\n\n/**\n * Presence Status Enum\n * Re-exported from realtime-shared.zod.ts for backward compatibility\n */\nexport const WebSocketPresenceStatus = PresenceStatus;\n\nexport type WebSocketPresenceStatus = z.infer<typeof WebSocketPresenceStatus>;\n\n/**\n * Presence State Schema\n * Tracks real-time user presence and activity\n */\nexport const PresenceStateSchema = z.object({\n userId: z.string().describe('User identifier'),\n sessionId: z.string().uuid().describe('Unique session identifier'),\n status: WebSocketPresenceStatus.describe('Current presence status'),\n lastSeen: z.string().datetime().describe('ISO 8601 datetime of last activity'),\n currentLocation: z.string().optional().describe('Current page/route user is viewing'),\n device: z.enum(['desktop', 'mobile', 'tablet', 'other']).optional().describe('Device type'),\n customStatus: z.string().optional().describe('Custom user status message'),\n metadata: z.record(z.string(), z.unknown()).optional().describe('Additional custom presence data'),\n});\n\nexport type PresenceState = z.infer<typeof PresenceStateSchema>;\n\n/**\n * Presence Update Request\n * Client request to update presence status\n */\nexport const PresenceUpdateSchema = z.object({\n status: WebSocketPresenceStatus.optional().describe('Updated presence status'),\n currentLocation: z.string().optional().describe('Updated current location'),\n customStatus: z.string().optional().describe('Updated custom status message'),\n metadata: z.record(z.string(), z.unknown()).optional().describe('Updated metadata'),\n});\n\nexport type PresenceUpdate = z.infer<typeof PresenceUpdateSchema>;\n\n// ==========================================\n// Collaborative Editing Protocol\n// ==========================================\n\n/**\n * Cursor Position Schema\n * Represents a cursor position in a document\n */\nexport const CursorPositionSchema = z.object({\n userId: z.string().describe('User identifier'),\n sessionId: z.string().uuid().describe('Session identifier'),\n documentId: z.string().describe('Document identifier being edited'),\n position: z.object({\n line: z.number().int().nonnegative().describe('Line number (0-indexed)'),\n column: z.number().int().nonnegative().describe('Column number (0-indexed)'),\n }).optional().describe('Cursor position in document'),\n selection: z.object({\n start: z.object({\n line: z.number().int().nonnegative(),\n column: z.number().int().nonnegative(),\n }),\n end: z.object({\n line: z.number().int().nonnegative(),\n column: z.number().int().nonnegative(),\n }),\n }).optional().describe('Selection range (if text is selected)'),\n color: z.string().optional().describe('Cursor color for visual representation'),\n userName: z.string().optional().describe('Display name of user'),\n lastUpdate: z.string().datetime().describe('ISO 8601 datetime of last cursor update'),\n});\n\nexport type CursorPosition = z.infer<typeof CursorPositionSchema>;\n\n/**\n * Edit Operation Type Enum\n * Types of edit operations for collaborative editing\n */\nexport const EditOperationType = z.enum([\n 'insert', // Insert text at position\n 'delete', // Delete text from range\n 'replace', // Replace text in range\n]);\n\nexport type EditOperationType = z.infer<typeof EditOperationType>;\n\n/**\n * Edit Operation Schema\n * Represents a single edit operation on a document\n * Supports Operational Transformation (OT) for conflict resolution\n */\nexport const EditOperationSchema = z.object({\n operationId: z.string().uuid().describe('Unique operation identifier'),\n documentId: z.string().describe('Document identifier'),\n userId: z.string().describe('User who performed the edit'),\n sessionId: z.string().uuid().describe('Session identifier'),\n type: EditOperationType.describe('Type of edit operation'),\n position: z.object({\n line: z.number().int().nonnegative().describe('Line number (0-indexed)'),\n column: z.number().int().nonnegative().describe('Column number (0-indexed)'),\n }).describe('Starting position of the operation'),\n endPosition: z.object({\n line: z.number().int().nonnegative(),\n column: z.number().int().nonnegative(),\n }).optional().describe('Ending position (for delete/replace operations)'),\n content: z.string().optional().describe('Content to insert/replace'),\n version: z.number().int().nonnegative().describe('Document version before this operation'),\n timestamp: z.string().datetime().describe('ISO 8601 datetime when operation was created'),\n baseOperationId: z.string().uuid().optional().describe('Previous operation ID this builds upon (for OT)'),\n});\n\nexport type EditOperation = z.infer<typeof EditOperationSchema>;\n\n/**\n * Document State Schema\n * Represents the current state of a collaborative document\n */\nexport const DocumentStateSchema = z.object({\n documentId: z.string().describe('Document identifier'),\n version: z.number().int().nonnegative().describe('Current document version'),\n content: z.string().describe('Current document content'),\n lastModified: z.string().datetime().describe('ISO 8601 datetime of last modification'),\n activeSessions: z.array(z.string().uuid()).describe('Active editing session IDs'),\n checksum: z.string().optional().describe('Content checksum for integrity verification'),\n});\n\nexport type DocumentState = z.infer<typeof DocumentStateSchema>;\n\n// ==========================================\n// WebSocket Messages\n// ==========================================\n\n/**\n * Base WebSocket Message\n * All WebSocket messages extend this base structure\n */\nconst BaseWebSocketMessage = z.object({\n messageId: z.string().uuid().describe('Unique message identifier'),\n type: WebSocketMessageType.describe('Message type'),\n timestamp: z.string().datetime().describe('ISO 8601 datetime when message was sent'),\n});\n\n/**\n * Subscribe Message\n * Client sends this to subscribe to events\n */\nexport const SubscribeMessageSchema = BaseWebSocketMessage.extend({\n type: z.literal('subscribe'),\n subscription: EventSubscriptionSchema.describe('Subscription configuration'),\n});\n\nexport type SubscribeMessage = z.infer<typeof SubscribeMessageSchema>;\n\n/**\n * Unsubscribe Message\n * Client sends this to unsubscribe from events\n */\nexport const UnsubscribeMessageSchema = BaseWebSocketMessage.extend({\n type: z.literal('unsubscribe'),\n request: UnsubscribeRequestSchema.describe('Unsubscribe request'),\n});\n\nexport type UnsubscribeMessage = z.infer<typeof UnsubscribeMessageSchema>;\n\n/**\n * Event Message\n * Server sends this when a subscribed event occurs\n */\nexport const EventMessageSchema = BaseWebSocketMessage.extend({\n type: z.literal('event'),\n subscriptionId: z.string().uuid().describe('Subscription ID this event belongs to'),\n eventName: EventNameSchema.describe('Event name'),\n object: z.string().optional().describe('Object name the event relates to'),\n payload: z.unknown().describe('Event payload data'),\n userId: z.string().optional().describe('User who triggered the event'),\n});\n\nexport type EventMessage = z.infer<typeof EventMessageSchema>;\n\n/**\n * Presence Message\n * Presence update message\n */\nexport const PresenceMessageSchema = BaseWebSocketMessage.extend({\n type: z.literal('presence'),\n presence: PresenceStateSchema.describe('Presence state'),\n});\n\nexport type PresenceMessage = z.infer<typeof PresenceMessageSchema>;\n\n/**\n * Cursor Message\n * Cursor position update for collaborative editing\n */\nexport const CursorMessageSchema = BaseWebSocketMessage.extend({\n type: z.literal('cursor'),\n cursor: CursorPositionSchema.describe('Cursor position'),\n});\n\nexport type CursorMessage = z.infer<typeof CursorMessageSchema>;\n\n/**\n * Edit Message\n * Document edit operation for collaborative editing\n */\nexport const EditMessageSchema = BaseWebSocketMessage.extend({\n type: z.literal('edit'),\n operation: EditOperationSchema.describe('Edit operation'),\n});\n\nexport type EditMessage = z.infer<typeof EditMessageSchema>;\n\n/**\n * Acknowledgment Message\n * Server acknowledges receipt of a message\n */\nexport const AckMessageSchema = BaseWebSocketMessage.extend({\n type: z.literal('ack'),\n ackMessageId: z.string().uuid().describe('ID of the message being acknowledged'),\n success: z.boolean().describe('Whether the operation was successful'),\n error: z.string().optional().describe('Error message if operation failed'),\n});\n\nexport type AckMessage = z.infer<typeof AckMessageSchema>;\n\n/**\n * Error Message\n * Server sends error information\n */\nexport const ErrorMessageSchema = BaseWebSocketMessage.extend({\n type: z.literal('error'),\n code: z.string().describe('Error code'),\n message: z.string().describe('Error message'),\n details: z.unknown().optional().describe('Additional error details'),\n});\n\nexport type ErrorMessage = z.infer<typeof ErrorMessageSchema>;\n\n/**\n * Ping Message\n * Keepalive ping from client or server\n */\nexport const PingMessageSchema = BaseWebSocketMessage.extend({\n type: z.literal('ping'),\n});\n\nexport type PingMessage = z.infer<typeof PingMessageSchema>;\n\n/**\n * Pong Message\n * Keepalive pong response\n */\nexport const PongMessageSchema = BaseWebSocketMessage.extend({\n type: z.literal('pong'),\n pingMessageId: z.string().uuid().optional().describe('ID of ping message being responded to'),\n});\n\nexport type PongMessage = z.infer<typeof PongMessageSchema>;\n\n/**\n * WebSocket Message Union\n * Discriminated union of all WebSocket message types\n */\nexport const WebSocketMessageSchema = z.discriminatedUnion('type', [\n SubscribeMessageSchema,\n UnsubscribeMessageSchema,\n EventMessageSchema,\n PresenceMessageSchema,\n CursorMessageSchema,\n EditMessageSchema,\n AckMessageSchema,\n ErrorMessageSchema,\n PingMessageSchema,\n PongMessageSchema,\n]);\n\nexport type WebSocketMessage = z.infer<typeof WebSocketMessageSchema>;\n\n// ==========================================\n// Connection Configuration\n// ==========================================\n\n/**\n * WebSocket Connection Config\n * Configuration for WebSocket connections\n */\nexport const WebSocketConfigSchema = z.object({\n url: z.string().url().describe('WebSocket server URL'),\n protocols: z.array(z.string()).optional().describe('WebSocket sub-protocols'),\n reconnect: z.boolean().optional().default(true).describe('Enable automatic reconnection'),\n reconnectInterval: z.number().int().positive().optional().default(1000).describe('Reconnection interval in milliseconds'),\n maxReconnectAttempts: z.number().int().positive().optional().default(5).describe('Maximum reconnection attempts'),\n pingInterval: z.number().int().positive().optional().default(30000).describe('Ping interval in milliseconds'),\n timeout: z.number().int().positive().optional().default(5000).describe('Message timeout in milliseconds'),\n headers: z.record(z.string(), z.string()).optional().describe('Custom headers for WebSocket handshake'),\n});\n\nexport type WebSocketConfig = z.infer<typeof WebSocketConfigSchema>;\n\n// ==========================================\n// Simplified Collaboration API\n// ==========================================\n\n/**\n * Simplified WebSocket Event Schema\n * \n * A simplified event schema for basic WebSocket communication.\n * Complements the comprehensive WebSocketMessageSchema above for simpler use cases.\n * \n * @example Subscribe to channel\n * ```typescript\n * {\n * type: 'subscribe',\n * channel: 'record.account.123',\n * payload: { events: ['created', 'updated'] },\n * timestamp: Date.now()\n * }\n * ```\n * \n * @example Data change notification\n * ```typescript\n * {\n * type: 'data-change',\n * channel: 'record.account.123',\n * payload: { id: '123', action: 'updated', data: {...} },\n * timestamp: Date.now()\n * }\n * ```\n */\nexport const WebSocketEventSchema = z.object({\n type: z.enum([\n 'subscribe', // Client subscribes to channel\n 'unsubscribe', // Client unsubscribes from channel\n 'data-change', // Data modification event\n 'presence-update', // User presence change\n 'cursor-update', // Cursor position change (collaborative editing)\n 'error', // Error message\n ]).describe('Event type'),\n channel: z.string().describe('Channel identifier (e.g., \"record.account.123\", \"user.456\")'),\n payload: z.unknown().describe('Event payload data'),\n timestamp: z.number().describe('Unix timestamp in milliseconds'),\n});\n\nexport type WebSocketEvent = z.infer<typeof WebSocketEventSchema>;\n\n/**\n * Simplified Presence State Schema\n * \n * A simplified presence schema for basic user presence tracking.\n * Complements the comprehensive PresenceStateSchema for simpler integrations.\n * \n * Use this for basic presence features. For advanced features like device tracking,\n * custom status, and session management, use the comprehensive PresenceStateSchema above.\n * \n * @example User online\n * ```typescript\n * {\n * userId: 'user123',\n * userName: 'John Doe',\n * status: 'online',\n * lastSeen: Date.now(),\n * metadata: { currentPage: '/dashboard' }\n * }\n * ```\n */\nexport const SimplePresenceStateSchema = z.object({\n userId: z.string().describe('User identifier'),\n userName: z.string().describe('User display name'),\n status: z.enum(['online', 'away', 'offline']).describe('User presence status'),\n lastSeen: z.number().describe('Unix timestamp of last activity in milliseconds'),\n metadata: z.record(z.string(), z.unknown()).optional().describe('Additional presence metadata (e.g., current page, custom status)'),\n});\n\nexport type SimplePresenceState = z.infer<typeof SimplePresenceStateSchema>;\n\n/**\n * Simplified Cursor Position Schema\n * \n * A simplified cursor position schema for basic collaborative editing.\n * Complements the comprehensive CursorPositionSchema for simpler use cases.\n * \n * Use this for basic cursor sharing. For advanced features like selections,\n * color coding, and document versioning, use the comprehensive CursorPositionSchema above.\n * \n * @example Cursor in text field\n * ```typescript\n * {\n * userId: 'user123',\n * recordId: 'account_456',\n * fieldName: 'description',\n * position: 42,\n * selection: { start: 42, end: 57 }\n * }\n * ```\n */\nexport const SimpleCursorPositionSchema = z.object({\n userId: z.string().describe('User identifier'),\n recordId: z.string().describe('Record identifier being edited'),\n fieldName: z.string().describe('Field name being edited'),\n position: z.number().describe('Cursor position (character offset from start)'),\n selection: z.object({\n start: z.number().describe('Selection start position'),\n end: z.number().describe('Selection end position'),\n }).optional().describe('Text selection range (if text is selected)'),\n});\n\nexport type SimpleCursorPosition = z.infer<typeof SimpleCursorPositionSchema>;\n\n/**\n * WebSocket Server Configuration Schema\n * \n * Server-side configuration for WebSocket services.\n * Controls features like presence tracking, cursor sharing, and connection management.\n * \n * @example Production configuration\n * ```typescript\n * {\n * enabled: true,\n * path: '/ws',\n * heartbeatInterval: 30000,\n * reconnectAttempts: 5,\n * presence: true,\n * cursorSharing: true\n * }\n * ```\n */\nexport const WebSocketServerConfigSchema = z.object({\n enabled: z.boolean().default(false).describe('Enable WebSocket server'),\n path: z.string().default('/ws').describe('WebSocket endpoint path'),\n heartbeatInterval: z.number().default(30000).describe('Heartbeat interval in milliseconds'),\n reconnectAttempts: z.number().default(5).describe('Maximum reconnection attempts for clients'),\n presence: z.boolean().default(false).describe('Enable presence tracking'),\n cursorSharing: z.boolean().default(false).describe('Enable collaborative cursor sharing'),\n});\n\nexport type WebSocketServerConfig = z.infer<typeof WebSocketServerConfigSchema>;\n","// Copyright (c) 2025 ObjectStack. Licensed under the Apache-2.0 license.\n\nimport { z } from 'zod';\n\n/**\n * System Identifier Schema\n * \n * Universal naming convention for all machine identifiers (API Names) in ObjectStack.\n * Enforces lowercase with underscores or dots to ensure:\n * - Cross-platform compatibility (case-insensitive filesystems)\n * - URL-friendliness (no encoding needed)\n * - Database consistency (no collation issues)\n * - Security (no case-sensitivity bugs in permission checks)\n * \n * **Applies to all metadata that acts as a machine identifier:**\n * - Object names (tables/collections)\n * - Field names\n * - Role names\n * - Permission set names\n * - Action/trigger names\n * - Event keys\n * - App IDs\n * - Menu/page IDs\n * - Select option values\n * - Workflow names\n * - Webhook names\n * \n * **Naming Convention Summary:**\n * | Type | Pattern | Example |\n * |------|---------|---------|\n * | Machine ID | snake_case | `crm_account`, `btn_submit`, `role_admin` |\n * | Event keys | dot.notation | `user.login`, `order.created` |\n * | Labels | Any case | `Client Account`, `Submit Form` |\n * \n * @example Valid identifiers\n * - 'account'\n * - 'crm_account'\n * - 'user_profile'\n * - 'order.created' (for events)\n * - 'api_v2_endpoint'\n * \n * @example Invalid identifiers (will be rejected)\n * - 'Account' (uppercase)\n * - 'CrmAccount' (camelCase)\n * - 'crm-account' (kebab-case - use underscore instead)\n * - 'user profile' (spaces)\n */\nexport const SystemIdentifierSchema = z\n .string()\n .min(2, { message: 'System identifier must be at least 2 characters' })\n .regex(/^[a-z][a-z0-9_.]*$/, {\n message:\n 'System identifier must be lowercase, starting with a letter, and may contain letters, numbers, underscores, or dots (e.g., \"user_profile\" or \"order.created\")',\n })\n .describe('System identifier (lowercase with underscores or dots)');\n\n/**\n * Strict Snake Case Identifier\n * \n * More restrictive than SystemIdentifierSchema - only allows underscores (no dots).\n * Use this for identifiers that should NOT contain dots (e.g., database table/column names).\n * \n * @example Valid\n * - 'account'\n * - 'crm_account'\n * - 'user_profile'\n * \n * @example Invalid\n * - 'user.profile' (dots not allowed)\n * - 'UserProfile' (uppercase)\n */\nexport const SnakeCaseIdentifierSchema = z\n .string()\n .min(2, { message: 'Identifier must be at least 2 characters' })\n .regex(/^[a-z][a-z0-9_]*$/, {\n message:\n 'Identifier must be lowercase snake_case, starting with a letter, and may contain only letters, numbers, and underscores (e.g., \"user_profile\")',\n })\n .describe('Snake case identifier (lowercase with underscores only)');\n\n/**\n * Event Name Identifier\n * \n * Specialized identifier for event names that encourages dot notation.\n * Used in event-driven systems, message queues, and webhooks.\n * \n * Pattern: `namespace.action` or `entity.event_type`\n * \n * @example Valid\n * - 'user.created'\n * - 'order.paid'\n * - 'user.login_success'\n * - 'alarm.high_cpu'\n * \n * @example Invalid\n * - 'UserCreated' (camelCase)\n * - 'user_created' (should use dots for namespacing)\n */\nexport const EventNameSchema = z\n .string()\n .min(3, { message: 'Event name must be at least 3 characters' })\n .regex(/^[a-z][a-z0-9_.]*$/, {\n message:\n 'Event name must be lowercase with dots for namespacing (e.g., \"user.created\", \"order.paid\")',\n })\n .describe('Event name (lowercase with dot notation for namespacing)');\n\n/**\n * Type Exports\n */\nexport type SystemIdentifier = z.infer<typeof SystemIdentifierSchema>;\nexport type SnakeCaseIdentifier = z.infer<typeof SnakeCaseIdentifierSchema>;\nexport type EventName = z.infer<typeof EventNameSchema>;\n","// Copyright (c) 2025 ObjectStack. Licensed under the Apache-2.0 license.\n\nimport { z } from 'zod';\nimport { CorsConfigSchema, StaticMountSchema, HttpMethod } from '../shared/http.zod';\n\n// Re-export HttpMethod for convenience\nexport { HttpMethod };\n\n/**\n * Route Category Enum\n * Classifies routes for middleware application and security policies.\n */\nexport const RouteCategory = z.enum([\n 'system', // Health, Metrics, Info (No Auth usually)\n 'api', // Business Logic API (Auth required)\n 'auth', // Login/Callback endpoints\n 'static', // Asset serving\n 'webhook', // External callbacks\n 'plugin' // Plugin extensions\n]);\n\nexport type RouteCategory = z.infer<typeof RouteCategory>;\n\n/**\n * Route Definition Schema\n * Describes a single routable endpoint in the Kernel.\n */\nexport const RouteDefinitionSchema = z.object({\n /**\n * HTTP Method\n */\n method: HttpMethod,\n \n /**\n * URL Path Pattern (supports parameters like /user/:id)\n */\n path: z.string().describe('URL Path pattern'),\n \n /**\n * Route Type/Category\n */\n category: RouteCategory.default('api'),\n \n /**\n * Handler Identifier\n * References an internal function or plugin action ID.\n */\n handler: z.string().describe('Unique handler identifier'),\n \n /**\n * Route specific metadata\n */\n summary: z.string().optional().describe('OpenAPI summary'),\n description: z.string().optional().describe('OpenAPI description'),\n \n /**\n * Security constraints\n */\n public: z.boolean().default(false).describe('Is publicly accessible'),\n permissions: z.array(z.string()).optional().describe('Required permissions'),\n \n /**\n * Performance hints\n */\n timeout: z.number().int().optional().describe('Execution timeout in ms'),\n rateLimit: z.string().optional().describe('Rate limit policy name'),\n});\n\nexport type RouteDefinition = z.infer<typeof RouteDefinitionSchema>;\n\n/**\n * Router Configuration Schema\n * Global routing table configuration.\n */\nexport const RouterConfigSchema = z.object({\n /**\n * URL Prefix for all kernel routes\n */\n basePath: z.string().default('/api').describe('Global API prefix'),\n \n /**\n * Standard Protocol Mounts (Relative to basePath)\n */\n mounts: z.object({\n data: z.string().default('/data').describe('Data Protocol (CRUD)'),\n metadata: z.string().default('/meta').describe('Metadata Protocol (Schemas)'),\n auth: z.string().default('/auth').describe('Auth Protocol'),\n automation: z.string().default('/automation').describe('Automation Protocol'),\n storage: z.string().default('/storage').describe('Storage Protocol'),\n analytics: z.string().default('/analytics').describe('Analytics Protocol'),\n graphql: z.string().default('/graphql').describe('GraphQL Endpoint'),\n ui: z.string().default('/ui').describe('UI Metadata Protocol (Views, Layouts)'),\n workflow: z.string().default('/workflow').describe('Workflow Engine Protocol'),\n realtime: z.string().default('/realtime').describe('Realtime/WebSocket Protocol'),\n notifications: z.string().default('/notifications').describe('Notification Protocol'),\n ai: z.string().default('/ai').describe('AI Engine Protocol (NLQ, Chat, Suggest)'),\n i18n: z.string().default('/i18n').describe('Internationalization Protocol'),\n packages: z.string().default('/packages').describe('Package Management Protocol'),\n }).default({\n data: '/data',\n metadata: '/meta',\n auth: '/auth',\n automation: '/automation',\n storage: '/storage',\n analytics: '/analytics',\n graphql: '/graphql',\n ui: '/ui',\n workflow: '/workflow',\n realtime: '/realtime',\n notifications: '/notifications',\n ai: '/ai',\n i18n: '/i18n',\n packages: '/packages',\n }), // Defaults match standardized spec\n\n /**\n * Cross-Origin Resource Sharing\n */\n cors: CorsConfigSchema.optional(),\n \n /**\n * Static asset mounts\n */\n staticMounts: z.array(StaticMountSchema).optional(),\n});\n\nexport type RouterConfig = z.infer<typeof RouterConfigSchema>;\n","// Copyright (c) 2025 ObjectStack. Licensed under the Apache-2.0 license.\n\nimport { z } from 'zod';\n\n/**\n * OData v4 Protocol Support\n * \n * Open Data Protocol (OData) v4 is an industry-standard protocol for building\n * and consuming RESTful APIs. It provides a uniform way to expose, structure,\n * query, and manipulate data.\n * \n * ## Overview\n * \n * OData v4 provides standardized URL conventions for querying data including:\n * - $select: Choose which fields to return\n * - $filter: Filter results with complex expressions\n * - $orderby: Sort results\n * - $top/$skip: Pagination\n * - $expand: Include related entities\n * - $count: Get total count\n * \n * ## Use Cases\n * \n * 1. **Enterprise Integration**\n * - Integrate with Microsoft Dynamics 365\n * - Connect to SharePoint Online\n * - SAP OData services\n * \n * 2. **API Standardization**\n * - Provide consistent query interface\n * - Standard pagination and filtering\n * - Industry-recognized protocol\n * \n * 3. **External Data Sources**\n * - Connect to OData-compliant systems\n * - Federated queries\n * - Data virtualization\n * \n * @see https://www.odata.org/documentation/\n * @see https://docs.oasis-open.org/odata/odata/v4.01/odata-v4.01-part2-url-conventions.html\n * \n * @example OData Query\n * ```\n * GET /api/odata/customers?\n * $select=name,email&\n * $filter=country eq 'US' and revenue gt 100000&\n * $orderby=revenue desc&\n * $top=10&\n * $skip=20&\n * $expand=orders&\n * $count=true\n * ```\n * \n * @example Programmatic Use\n * ```typescript\n * const query: ODataQuery = {\n * select: ['name', 'email'],\n * filter: \"country eq 'US' and revenue gt 100000\",\n * orderby: 'revenue desc',\n * top: 10,\n * skip: 20,\n * expand: ['orders'],\n * count: true\n * }\n * ```\n */\n\n/**\n * OData Query Options Schema\n * \n * System query options defined by OData v4 specification.\n * These are URL query parameters that control the query execution.\n * \n * @see https://docs.oasis-open.org/odata/odata/v4.01/odata-v4.01-part2-url-conventions.html#sec_SystemQueryOptions\n */\nexport const ODataQuerySchema = z.object({\n /**\n * $select - Select specific fields to return\n * \n * Comma-separated list of field names to include in the response.\n * Reduces payload size and improves performance.\n * \n * @example \"name,email,phone\"\n * @example \"id,customer/name\" - With navigation path\n */\n $select: z.union([\n z.string(), // \"name,email\"\n z.array(z.string()), // [\"name\", \"email\"]\n ]).optional().describe('Fields to select'),\n\n /**\n * $filter - Filter results with conditions\n * \n * OData filter expression using comparison operators, logical operators,\n * and functions.\n * \n * Comparison: eq, ne, lt, le, gt, ge\n * Logical: and, or, not\n * Functions: contains, startswith, endswith, length, indexof, substring, etc.\n * \n * @example \"age gt 18\"\n * @example \"country eq 'US' and revenue gt 100000\"\n * @example \"contains(name, 'Smith')\"\n * @example \"startswith(email, 'admin') and isActive eq true\"\n */\n $filter: z.string().optional().describe('Filter expression (OData filter syntax)'),\n\n /**\n * $orderby - Sort results\n * \n * Comma-separated list of fields with optional asc/desc.\n * Default is ascending.\n * \n * @example \"name\"\n * @example \"revenue desc\"\n * @example \"country asc, revenue desc\"\n */\n $orderby: z.union([\n z.string(), // \"name desc\"\n z.array(z.string()), // [\"name desc\", \"email asc\"]\n ]).optional().describe('Sort order'),\n\n /**\n * $top - Limit number of results\n * \n * Maximum number of results to return.\n * Equivalent to SQL LIMIT or FETCH FIRST.\n * \n * @example 10\n * @example 100\n */\n $top: z.number().int().min(0).optional().describe('Max results to return'),\n\n /**\n * $skip - Skip results for pagination\n * \n * Number of results to skip before returning results.\n * Equivalent to SQL OFFSET.\n * \n * @example 20\n * @example 100\n */\n $skip: z.number().int().min(0).optional().describe('Results to skip'),\n\n /**\n * $expand - Include related entities\n * \n * Comma-separated list of navigation properties to expand.\n * Loads related data in the same request.\n * \n * @example \"orders\"\n * @example \"customer,products\"\n * @example \"orders($select=id,total)\" - With nested query options\n */\n $expand: z.union([\n z.string(), // \"orders\"\n z.array(z.string()), // [\"orders\", \"customer\"]\n ]).optional().describe('Navigation properties to expand'),\n\n /**\n * $count - Include total count\n * \n * When true, includes totalResults count in response.\n * Useful for pagination UI.\n * \n * @example true\n */\n $count: z.boolean().optional().describe('Include total count'),\n\n /**\n * $search - Full-text search\n * \n * Free-text search expression.\n * Search implementation is service-specific.\n * \n * @example \"John Smith\"\n * @example \"urgent AND support\"\n */\n $search: z.string().optional().describe('Search expression'),\n\n /**\n * $format - Response format\n * \n * Preferred response format.\n * \n * @example \"json\"\n * @example \"xml\"\n */\n $format: z.enum(['json', 'xml', 'atom']).optional().describe('Response format'),\n\n /**\n * $apply - Data aggregation\n * \n * Aggregation transformations (groupby, aggregate, etc.)\n * Part of OData aggregation extension.\n * \n * @example \"groupby((country),aggregate(revenue with sum as totalRevenue))\"\n */\n $apply: z.string().optional().describe('Aggregation expression'),\n});\n\nexport type ODataQuery = z.infer<typeof ODataQuerySchema>;\n\n/**\n * OData Filter Operator\n * \n * Standard comparison and logical operators in OData filter expressions.\n */\nexport const ODataFilterOperatorSchema = z.enum([\n // Comparison Operators\n 'eq', // Equal to\n 'ne', // Not equal to\n 'lt', // Less than\n 'le', // Less than or equal to\n 'gt', // Greater than\n 'ge', // Greater than or equal to\n\n // Logical Operators\n 'and', // Logical AND\n 'or', // Logical OR\n 'not', // Logical NOT\n\n // Grouping\n '(', // Left parenthesis\n ')', // Right parenthesis\n\n // Other\n 'in', // Value in list\n 'has', // Has flag (for enum flags)\n]);\n\nexport type ODataFilterOperator = z.infer<typeof ODataFilterOperatorSchema>;\n\n/**\n * OData Filter Function\n * \n * Standard functions available in OData filter expressions.\n */\nexport const ODataFilterFunctionSchema = z.enum([\n // String Functions\n 'contains', // contains(field, 'value')\n 'startswith', // startswith(field, 'value')\n 'endswith', // endswith(field, 'value')\n 'length', // length(field)\n 'indexof', // indexof(field, 'substring')\n 'substring', // substring(field, start, length)\n 'tolower', // tolower(field)\n 'toupper', // toupper(field)\n 'trim', // trim(field)\n 'concat', // concat(field1, field2)\n\n // Date/Time Functions\n 'year', // year(dateField)\n 'month', // month(dateField)\n 'day', // day(dateField)\n 'hour', // hour(datetimeField)\n 'minute', // minute(datetimeField)\n 'second', // second(datetimeField)\n 'date', // date(datetimeField)\n 'time', // time(datetimeField)\n 'now', // now()\n 'maxdatetime', // maxdatetime()\n 'mindatetime', // mindatetime()\n\n // Math Functions\n 'round', // round(numField)\n 'floor', // floor(numField)\n 'ceiling', // ceiling(numField)\n\n // Type Functions\n 'cast', // cast(field, 'Edm.String')\n 'isof', // isof(field, 'Type')\n\n // Collection Functions\n 'any', // collection/any(d:d/prop eq value)\n 'all', // collection/all(d:d/prop eq value)\n]);\n\nexport type ODataFilterFunction = z.infer<typeof ODataFilterFunctionSchema>;\n\n/**\n * OData Response Schema\n * \n * Standard OData JSON response format.\n */\nexport const ODataResponseSchema = z.object({\n /**\n * OData context URL\n * Describes the payload structure\n */\n '@odata.context': z.string().url().optional().describe('Metadata context URL'),\n\n /**\n * Total count (when $count=true)\n */\n '@odata.count': z.number().int().optional().describe('Total results count'),\n\n /**\n * Next link for pagination\n */\n '@odata.nextLink': z.string().url().optional().describe('Next page URL'),\n\n /**\n * Result array\n */\n value: z.array(z.record(z.string(), z.unknown())).describe('Results array'),\n});\n\nexport type ODataResponse = z.infer<typeof ODataResponseSchema>;\n\n/**\n * OData Error Response Schema\n * \n * Standard OData error format.\n */\nexport const ODataErrorSchema = z.object({\n error: z.object({\n /**\n * Error code\n */\n code: z.string().describe('Error code'),\n\n /**\n * Error message\n */\n message: z.string().describe('Error message'),\n\n /**\n * Target of the error (field name, etc.)\n */\n target: z.string().optional().describe('Error target'),\n\n /**\n * Additional error details\n */\n details: z.array(z.object({\n code: z.string(),\n message: z.string(),\n target: z.string().optional(),\n })).optional().describe('Error details'),\n\n /**\n * Inner error for debugging\n */\n innererror: z.record(z.string(), z.unknown()).optional().describe('Inner error details'),\n }),\n});\n\nexport type ODataError = z.infer<typeof ODataErrorSchema>;\n\n/**\n * OData Metadata Configuration\n * \n * Configuration for OData metadata endpoint ($metadata).\n */\nexport const ODataMetadataSchema = z.object({\n /**\n * Service namespace\n */\n namespace: z.string().describe('Service namespace'),\n\n /**\n * Entity types to expose\n */\n entityTypes: z.array(z.object({\n name: z.string().describe('Entity type name'),\n key: z.array(z.string()).describe('Key fields'),\n properties: z.array(z.object({\n name: z.string(),\n type: z.string().describe('OData type (Edm.String, Edm.Int32, etc.)'),\n nullable: z.boolean().default(true),\n })),\n navigationProperties: z.array(z.object({\n name: z.string(),\n type: z.string(),\n partner: z.string().optional(),\n })).optional(),\n })).describe('Entity types'),\n\n /**\n * Entity sets\n */\n entitySets: z.array(z.object({\n name: z.string().describe('Entity set name'),\n entityType: z.string().describe('Entity type'),\n })).describe('Entity sets'),\n});\n\nexport type ODataMetadata = z.infer<typeof ODataMetadataSchema>;\n\n/**\n * Helper functions for OData operations\n */\nexport const OData = {\n /**\n * Build OData query URL\n */\n buildUrl: (baseUrl: string, query: ODataQuery): string => {\n const params = new URLSearchParams();\n\n if (query.$select) {\n params.append('$select', Array.isArray(query.$select) ? query.$select.join(',') : query.$select);\n }\n if (query.$filter) {\n params.append('$filter', query.$filter);\n }\n if (query.$orderby) {\n params.append('$orderby', Array.isArray(query.$orderby) ? query.$orderby.join(',') : query.$orderby);\n }\n if (query.$top !== undefined) {\n params.append('$top', query.$top.toString());\n }\n if (query.$skip !== undefined) {\n params.append('$skip', query.$skip.toString());\n }\n if (query.$expand) {\n params.append('$expand', Array.isArray(query.$expand) ? query.$expand.join(',') : query.$expand);\n }\n if (query.$count !== undefined) {\n params.append('$count', query.$count.toString());\n }\n if (query.$search) {\n params.append('$search', query.$search);\n }\n if (query.$format) {\n params.append('$format', query.$format);\n }\n if (query.$apply) {\n params.append('$apply', query.$apply);\n }\n\n const queryString = params.toString();\n return queryString ? `${baseUrl}?${queryString}` : baseUrl;\n },\n\n /**\n * Create a simple filter expression\n */\n filter: {\n eq: (field: string, value: string | number | boolean) => \n `${field} eq ${typeof value === 'string' ? `'${value}'` : value}`,\n ne: (field: string, value: string | number | boolean) => \n `${field} ne ${typeof value === 'string' ? `'${value}'` : value}`,\n gt: (field: string, value: number) => `${field} gt ${value}`,\n lt: (field: string, value: number) => `${field} lt ${value}`,\n contains: (field: string, value: string) => `contains(${field}, '${value}')`,\n and: (...expressions: string[]) => expressions.join(' and '),\n or: (...expressions: string[]) => expressions.join(' or '),\n },\n} as const;\n\n/**\n * OData Configuration Schema\n * \n * Configuration for enabling OData v4 API endpoint.\n */\nexport const ODataConfigSchema = z.object({\n /** Enable OData endpoint */\n enabled: z.boolean().default(true).describe('Enable OData API'),\n \n /** OData endpoint path */\n path: z.string().default('/odata').describe('OData endpoint path'),\n \n /** Metadata configuration */\n metadata: ODataMetadataSchema.optional().describe('OData metadata configuration'),\n}).passthrough(); // Allow additional properties for flexibility\n\nexport type ODataConfig = z.infer<typeof ODataConfigSchema>;\n","// Copyright (c) 2025 ObjectStack. Licensed under the Apache-2.0 license.\n\nimport { z } from 'zod';\nimport { FieldType } from '../data/field.zod';\n\n/**\n * GraphQL Protocol Support\n * \n * GraphQL is a query language for APIs and a runtime for executing those queries.\n * It provides a complete and understandable description of the data in your API,\n * gives clients the power to ask for exactly what they need, and enables powerful\n * developer tools.\n * \n * ## Overview\n * \n * GraphQL provides:\n * - Type-safe schema definition\n * - Precise data fetching (no over/under-fetching)\n * - Introspection and documentation\n * - Real-time subscriptions\n * - Batched queries with DataLoader\n * \n * ## Use Cases\n * \n * 1. **Modern API Development**\n * - Mobile and web applications\n * - Microservices federation\n * - Real-time dashboards\n * \n * 2. **Data Aggregation**\n * - Multi-source data integration\n * - Complex nested queries\n * - Efficient data loading\n * \n * 3. **Developer Experience**\n * - Self-documenting API\n * - Type safety and validation\n * - GraphQL playground\n * \n * @see https://graphql.org/\n * @see https://spec.graphql.org/\n * \n * @example GraphQL Query\n * ```graphql\n * query GetCustomer($id: ID!) {\n * customer(id: $id) {\n * id\n * name\n * email\n * orders(limit: 10, status: \"active\") {\n * id\n * total\n * items {\n * product {\n * name\n * price\n * }\n * }\n * }\n * }\n * }\n * ```\n * \n * @example GraphQL Mutation\n * ```graphql\n * mutation CreateOrder($input: CreateOrderInput!) {\n * createOrder(input: $input) {\n * id\n * orderNumber\n * status\n * }\n * }\n * ```\n */\n\n// ==========================================\n// 1. GraphQL Type System\n// ==========================================\n\n/**\n * GraphQL Scalar Types\n * \n * Built-in scalar types in GraphQL plus custom scalars.\n */\nexport const GraphQLScalarType = z.enum([\n // Built-in GraphQL Scalars\n 'ID',\n 'String',\n 'Int',\n 'Float',\n 'Boolean',\n \n // Extended Scalars (common custom types)\n 'DateTime',\n 'Date',\n 'Time',\n 'JSON',\n 'JSONObject',\n 'Upload',\n 'URL',\n 'Email',\n 'PhoneNumber',\n 'Currency',\n 'Decimal',\n 'BigInt',\n 'Long',\n 'UUID',\n 'Base64',\n 'Void',\n]);\n\nexport type GraphQLScalarType = z.infer<typeof GraphQLScalarType>;\n\n/**\n * GraphQL Type Configuration\n * \n * Configuration for generating GraphQL types from Object definitions.\n */\nexport const GraphQLTypeConfigSchema = z.object({\n /** Type name in GraphQL schema */\n name: z.string().describe('GraphQL type name (PascalCase recommended)'),\n \n /** Source Object name */\n object: z.string().describe('Source ObjectQL object name'),\n \n /** Description for GraphQL schema documentation */\n description: z.string().optional().describe('Type description'),\n \n /** Fields to include/exclude */\n fields: z.object({\n /** Include only these fields (allow list) */\n include: z.array(z.string()).optional().describe('Fields to include'),\n \n /** Exclude these fields (deny list) */\n exclude: z.array(z.string()).optional().describe('Fields to exclude (e.g., sensitive fields)'),\n \n /** Custom field mappings */\n mappings: z.record(z.string(), z.object({\n graphqlName: z.string().optional().describe('Custom GraphQL field name'),\n graphqlType: z.string().optional().describe('Override GraphQL type'),\n description: z.string().optional().describe('Field description'),\n deprecationReason: z.string().optional().describe('Why field is deprecated'),\n nullable: z.boolean().optional().describe('Override nullable'),\n })).optional().describe('Field-level customizations'),\n }).optional().describe('Field configuration'),\n \n /** Interfaces this type implements */\n interfaces: z.array(z.string()).optional().describe('GraphQL interface names'),\n \n /** Whether this is an interface definition */\n isInterface: z.boolean().optional().default(false).describe('Define as GraphQL interface'),\n \n /** Custom directives */\n directives: z.array(z.object({\n name: z.string().describe('Directive name'),\n args: z.record(z.string(), z.unknown()).optional().describe('Directive arguments'),\n })).optional().describe('GraphQL directives'),\n});\n\nexport type GraphQLTypeConfig = z.infer<typeof GraphQLTypeConfigSchema>;\nexport type GraphQLTypeConfigInput = z.input<typeof GraphQLTypeConfigSchema>;\n\n// ==========================================\n// 2. Query Generation Configuration\n// ==========================================\n\n/**\n * GraphQL Query Configuration\n * \n * Configuration for auto-generating query fields from Objects.\n */\nexport const GraphQLQueryConfigSchema = z.object({\n /** Query name */\n name: z.string().describe('Query field name (camelCase recommended)'),\n \n /** Source Object */\n object: z.string().describe('Source ObjectQL object name'),\n \n /** Query type: single record or list */\n type: z.enum(['get', 'list', 'search']).describe('Query type'),\n \n /** Description */\n description: z.string().optional().describe('Query description'),\n \n /** Input arguments */\n args: z.record(z.string(), z.object({\n type: z.string().describe('GraphQL type (e.g., \"ID!\", \"String\", \"Int\")'),\n description: z.string().optional().describe('Argument description'),\n defaultValue: z.unknown().optional().describe('Default value'),\n })).optional().describe('Query arguments'),\n \n /** Filtering configuration */\n filtering: z.object({\n enabled: z.boolean().default(true).describe('Allow filtering'),\n fields: z.array(z.string()).optional().describe('Filterable fields'),\n operators: z.array(z.enum([\n 'eq', 'ne', 'gt', 'gte', 'lt', 'lte',\n 'in', 'notIn', 'contains', 'startsWith', 'endsWith',\n 'isNull', 'isNotNull',\n ])).optional().describe('Allowed filter operators'),\n }).optional().describe('Filtering capabilities'),\n \n /** Sorting configuration */\n sorting: z.object({\n enabled: z.boolean().default(true).describe('Allow sorting'),\n fields: z.array(z.string()).optional().describe('Sortable fields'),\n defaultSort: z.object({\n field: z.string(),\n direction: z.enum(['ASC', 'DESC']),\n }).optional().describe('Default sort order'),\n }).optional().describe('Sorting capabilities'),\n \n /** Pagination configuration */\n pagination: z.object({\n enabled: z.boolean().default(true).describe('Enable pagination'),\n type: z.enum(['offset', 'cursor', 'relay']).default('offset').describe('Pagination style'),\n defaultLimit: z.number().int().min(1).default(20).describe('Default page size'),\n maxLimit: z.number().int().min(1).default(100).describe('Maximum page size'),\n cursors: z.object({\n field: z.string().default('id').describe('Field to use for cursor pagination'),\n }).optional(),\n }).optional().describe('Pagination configuration'),\n \n /** Field selection */\n fields: z.object({\n /** Always include these fields */\n required: z.array(z.string()).optional().describe('Required fields (always returned)'),\n \n /** Allow selecting these fields */\n selectable: z.array(z.string()).optional().describe('Selectable fields'),\n }).optional().describe('Field selection configuration'),\n \n /** Authorization */\n authRequired: z.boolean().default(true).describe('Require authentication'),\n permissions: z.array(z.string()).optional().describe('Required permissions'),\n \n /** Caching */\n cache: z.object({\n enabled: z.boolean().default(false).describe('Enable caching'),\n ttl: z.number().int().min(0).optional().describe('Cache TTL in seconds'),\n key: z.string().optional().describe('Cache key template'),\n }).optional().describe('Query caching'),\n});\n\nexport type GraphQLQueryConfig = z.infer<typeof GraphQLQueryConfigSchema>;\nexport type GraphQLQueryConfigInput = z.input<typeof GraphQLQueryConfigSchema>;\n\n// ==========================================\n// 3. Mutation Generation Configuration\n// ==========================================\n\n/**\n * GraphQL Mutation Configuration\n * \n * Configuration for auto-generating mutation fields from Objects.\n */\nexport const GraphQLMutationConfigSchema = z.object({\n /** Mutation name */\n name: z.string().describe('Mutation field name (camelCase recommended)'),\n \n /** Source Object */\n object: z.string().describe('Source ObjectQL object name'),\n \n /** Mutation type */\n type: z.enum(['create', 'update', 'delete', 'upsert', 'custom']).describe('Mutation type'),\n \n /** Description */\n description: z.string().optional().describe('Mutation description'),\n \n /** Input type configuration */\n input: z.object({\n /** Input type name */\n typeName: z.string().optional().describe('Custom input type name'),\n \n /** Fields to include in input */\n fields: z.object({\n include: z.array(z.string()).optional().describe('Fields to include'),\n exclude: z.array(z.string()).optional().describe('Fields to exclude'),\n required: z.array(z.string()).optional().describe('Required input fields'),\n }).optional().describe('Input field configuration'),\n \n /** Validation */\n validation: z.object({\n enabled: z.boolean().default(true).describe('Enable input validation'),\n rules: z.array(z.string()).optional().describe('Custom validation rules'),\n }).optional().describe('Input validation'),\n }).optional().describe('Input configuration'),\n \n /** Return type configuration */\n output: z.object({\n /** Type of output */\n type: z.enum(['object', 'payload', 'boolean', 'custom']).default('object').describe('Output type'),\n \n /** Include success/error envelope */\n includeEnvelope: z.boolean().optional().default(false).describe('Wrap in success/error payload'),\n \n /** Custom output type */\n customType: z.string().optional().describe('Custom output type name'),\n }).optional().describe('Output configuration'),\n \n /** Transaction handling */\n transaction: z.object({\n enabled: z.boolean().default(true).describe('Use database transaction'),\n isolationLevel: z.enum(['read_uncommitted', 'read_committed', 'repeatable_read', 'serializable']).optional().describe('Transaction isolation level'),\n }).optional().describe('Transaction configuration'),\n \n /** Authorization */\n authRequired: z.boolean().default(true).describe('Require authentication'),\n permissions: z.array(z.string()).optional().describe('Required permissions'),\n \n /** Hooks */\n hooks: z.object({\n before: z.array(z.string()).optional().describe('Pre-mutation hooks'),\n after: z.array(z.string()).optional().describe('Post-mutation hooks'),\n }).optional().describe('Lifecycle hooks'),\n});\n\nexport type GraphQLMutationConfig = z.infer<typeof GraphQLMutationConfigSchema>;\nexport type GraphQLMutationConfigInput = z.input<typeof GraphQLMutationConfigSchema>;\n\n// ==========================================\n// 4. Subscription Configuration\n// ==========================================\n\n/**\n * GraphQL Subscription Configuration\n * \n * Configuration for real-time GraphQL subscriptions.\n */\nexport const GraphQLSubscriptionConfigSchema = z.object({\n /** Subscription name */\n name: z.string().describe('Subscription field name (camelCase recommended)'),\n \n /** Source Object */\n object: z.string().describe('Source ObjectQL object name'),\n \n /** Subscription trigger events */\n events: z.array(z.enum(['created', 'updated', 'deleted', 'custom'])).describe('Events to subscribe to'),\n \n /** Description */\n description: z.string().optional().describe('Subscription description'),\n \n /** Filtering */\n filter: z.object({\n enabled: z.boolean().default(true).describe('Allow filtering subscriptions'),\n fields: z.array(z.string()).optional().describe('Filterable fields'),\n }).optional().describe('Subscription filtering'),\n \n /** Payload configuration */\n payload: z.object({\n /** Include the modified entity */\n includeEntity: z.boolean().default(true).describe('Include entity in payload'),\n \n /** Include previous values (for updates) */\n includePreviousValues: z.boolean().optional().default(false).describe('Include previous field values'),\n \n /** Include mutation metadata */\n includeMeta: z.boolean().optional().default(true).describe('Include metadata (timestamp, user, etc.)'),\n }).optional().describe('Payload configuration'),\n \n /** Authorization */\n authRequired: z.boolean().default(true).describe('Require authentication'),\n permissions: z.array(z.string()).optional().describe('Required permissions'),\n \n /** Rate limiting for subscriptions */\n rateLimit: z.object({\n enabled: z.boolean().default(true).describe('Enable rate limiting'),\n maxSubscriptionsPerUser: z.number().int().min(1).default(10).describe('Max concurrent subscriptions per user'),\n throttleMs: z.number().int().min(0).optional().describe('Throttle interval in milliseconds'),\n }).optional().describe('Subscription rate limiting'),\n});\n\nexport type GraphQLSubscriptionConfig = z.infer<typeof GraphQLSubscriptionConfigSchema>;\nexport type GraphQLSubscriptionConfigInput = z.input<typeof GraphQLSubscriptionConfigSchema>;\n\n// ==========================================\n// 5. Resolver Configuration\n// ==========================================\n\n/**\n * GraphQL Resolver Configuration\n * \n * Configuration for custom resolver logic.\n */\nexport const GraphQLResolverConfigSchema = z.object({\n /** Field path (e.g., \"Query.users\", \"Mutation.createUser\") */\n path: z.string().describe('Resolver path (Type.field)'),\n \n /** Resolver implementation type */\n type: z.enum(['datasource', 'computed', 'script', 'proxy']).describe('Resolver implementation type'),\n \n /** Implementation details */\n implementation: z.object({\n /** For datasource type */\n datasource: z.string().optional().describe('Datasource ID'),\n query: z.string().optional().describe('Query/SQL to execute'),\n \n /** For computed type */\n expression: z.string().optional().describe('Computation expression'),\n dependencies: z.array(z.string()).optional().describe('Dependent fields'),\n \n /** For script type */\n script: z.string().optional().describe('Script ID or inline code'),\n \n /** For proxy type */\n url: z.string().optional().describe('Proxy URL'),\n method: z.enum(['GET', 'POST', 'PUT', 'DELETE']).optional().describe('HTTP method'),\n }).optional().describe('Implementation configuration'),\n \n /** Caching */\n cache: z.object({\n enabled: z.boolean().default(false).describe('Enable resolver caching'),\n ttl: z.number().int().min(0).optional().describe('Cache TTL in seconds'),\n keyArgs: z.array(z.string()).optional().describe('Arguments to include in cache key'),\n }).optional().describe('Resolver caching'),\n});\n\nexport type GraphQLResolverConfig = z.infer<typeof GraphQLResolverConfigSchema>;\nexport type GraphQLResolverConfigInput = z.input<typeof GraphQLResolverConfigSchema>;\n\n// ==========================================\n// 6. DataLoader Configuration\n// ==========================================\n\n/**\n * GraphQL DataLoader Configuration\n * \n * Configuration for batching and caching with DataLoader pattern.\n * Prevents N+1 query problems in GraphQL.\n */\nexport const GraphQLDataLoaderConfigSchema = z.object({\n /** Loader name */\n name: z.string().describe('DataLoader name'),\n \n /** Source Object or datasource */\n source: z.string().describe('Source object or datasource'),\n \n /** Batch function configuration */\n batchFunction: z.object({\n /** Type of batch operation */\n type: z.enum(['findByIds', 'query', 'script', 'custom']).describe('Batch function type'),\n \n /** For findByIds */\n keyField: z.string().optional().describe('Field to batch on (e.g., \"id\")'),\n \n /** For query */\n query: z.string().optional().describe('Query template'),\n \n /** For script */\n script: z.string().optional().describe('Script ID'),\n \n /** Maximum batch size */\n maxBatchSize: z.number().int().min(1).optional().default(100).describe('Maximum batch size'),\n }).describe('Batch function configuration'),\n \n /** Caching */\n cache: z.object({\n enabled: z.boolean().default(true).describe('Enable per-request caching'),\n \n /** Cache key function */\n keyFn: z.string().optional().describe('Custom cache key function'),\n }).optional().describe('DataLoader caching'),\n \n /** Options */\n options: z.object({\n /** Batch multiple requests in single tick */\n batch: z.boolean().default(true).describe('Enable batching'),\n \n /** Cache loaded values */\n cache: z.boolean().default(true).describe('Enable caching'),\n \n /** Maximum cache size */\n maxCacheSize: z.number().int().min(0).optional().describe('Max cache entries'),\n }).optional().describe('DataLoader options'),\n});\n\nexport type GraphQLDataLoaderConfig = z.infer<typeof GraphQLDataLoaderConfigSchema>;\nexport type GraphQLDataLoaderConfigInput = z.input<typeof GraphQLDataLoaderConfigSchema>;\n\n// ==========================================\n// 7. GraphQL Directive Schema\n// ==========================================\n\n/**\n * GraphQL Directive Location\n * \n * Where a directive can be used in the schema.\n */\nexport const GraphQLDirectiveLocation = z.enum([\n // Executable Directive Locations\n 'QUERY',\n 'MUTATION',\n 'SUBSCRIPTION',\n 'FIELD',\n 'FRAGMENT_DEFINITION',\n 'FRAGMENT_SPREAD',\n 'INLINE_FRAGMENT',\n 'VARIABLE_DEFINITION',\n \n // Type System Directive Locations\n 'SCHEMA',\n 'SCALAR',\n 'OBJECT',\n 'FIELD_DEFINITION',\n 'ARGUMENT_DEFINITION',\n 'INTERFACE',\n 'UNION',\n 'ENUM',\n 'ENUM_VALUE',\n 'INPUT_OBJECT',\n 'INPUT_FIELD_DEFINITION',\n]);\n\nexport type GraphQLDirectiveLocation = z.infer<typeof GraphQLDirectiveLocation>;\n\n/**\n * GraphQL Directive Configuration\n * \n * Custom directives for schema metadata and behavior.\n */\nexport const GraphQLDirectiveConfigSchema = z.object({\n /** Directive name */\n name: z.string().regex(/^[a-z][a-zA-Z0-9]*$/).describe('Directive name (camelCase)'),\n \n /** Description */\n description: z.string().optional().describe('Directive description'),\n \n /** Where directive can be used */\n locations: z.array(GraphQLDirectiveLocation).describe('Directive locations'),\n \n /** Arguments */\n args: z.record(z.string(), z.object({\n type: z.string().describe('Argument type'),\n description: z.string().optional().describe('Argument description'),\n defaultValue: z.unknown().optional().describe('Default value'),\n })).optional().describe('Directive arguments'),\n \n /** Is repeatable */\n repeatable: z.boolean().optional().default(false).describe('Can be applied multiple times'),\n \n /** Implementation */\n implementation: z.object({\n /** Directive behavior type */\n type: z.enum(['auth', 'validation', 'transform', 'cache', 'deprecation', 'custom']).describe('Directive type'),\n \n /** Handler function */\n handler: z.string().optional().describe('Handler function name or script'),\n }).optional().describe('Directive implementation'),\n});\n\nexport type GraphQLDirectiveConfig = z.infer<typeof GraphQLDirectiveConfigSchema>;\nexport type GraphQLDirectiveConfigInput = z.input<typeof GraphQLDirectiveConfigSchema>;\n\n// ==========================================\n// 8. GraphQL Security - Query Depth Limiting\n// ==========================================\n\n/**\n * Query Depth Limiting Configuration\n * \n * Prevents deeply nested queries that could cause performance issues.\n */\nexport const GraphQLQueryDepthLimitSchema = z.object({\n /** Enable depth limiting */\n enabled: z.boolean().default(true).describe('Enable query depth limiting'),\n \n /** Maximum allowed depth */\n maxDepth: z.number().int().min(1).default(10).describe('Maximum query depth'),\n \n /** Fields to ignore in depth calculation */\n ignoreFields: z.array(z.string()).optional().describe('Fields excluded from depth calculation'),\n \n /** Callback on depth exceeded */\n onDepthExceeded: z.enum(['reject', 'log', 'warn']).default('reject').describe('Action when depth exceeded'),\n \n /** Custom error message */\n errorMessage: z.string().optional().describe('Custom error message for depth violations'),\n});\n\nexport type GraphQLQueryDepthLimit = z.infer<typeof GraphQLQueryDepthLimitSchema>;\nexport type GraphQLQueryDepthLimitInput = z.input<typeof GraphQLQueryDepthLimitSchema>;\n\n// ==========================================\n// 9. GraphQL Security - Query Complexity\n// ==========================================\n\n/**\n * Query Complexity Calculation Configuration\n * \n * Assigns complexity scores to fields and limits total query complexity.\n * Prevents expensive queries from overloading the server.\n */\nexport const GraphQLQueryComplexitySchema = z.object({\n /** Enable complexity limiting */\n enabled: z.boolean().default(true).describe('Enable query complexity limiting'),\n \n /** Maximum allowed complexity score */\n maxComplexity: z.number().int().min(1).default(1000).describe('Maximum query complexity'),\n \n /** Default field complexity */\n defaultFieldComplexity: z.number().int().min(0).default(1).describe('Default complexity per field'),\n \n /** Field-specific complexity scores */\n fieldComplexity: z.record(z.string(), z.union([\n z.number().int().min(0),\n z.object({\n /** Base complexity */\n base: z.number().int().min(0).describe('Base complexity'),\n \n /** Multiplier based on arguments */\n multiplier: z.string().optional().describe('Argument multiplier (e.g., \"limit\")'),\n \n /** Custom complexity calculation */\n calculator: z.string().optional().describe('Custom calculator function'),\n }),\n ])).optional().describe('Per-field complexity configuration'),\n \n /** List multiplier */\n listMultiplier: z.number().min(0).default(10).describe('Multiplier for list fields'),\n \n /** Callback on complexity exceeded */\n onComplexityExceeded: z.enum(['reject', 'log', 'warn']).default('reject').describe('Action when complexity exceeded'),\n \n /** Custom error message */\n errorMessage: z.string().optional().describe('Custom error message for complexity violations'),\n});\n\nexport type GraphQLQueryComplexity = z.infer<typeof GraphQLQueryComplexitySchema>;\nexport type GraphQLQueryComplexityInput = z.input<typeof GraphQLQueryComplexitySchema>;\n\n// ==========================================\n// 10. GraphQL Security - Rate Limiting\n// ==========================================\n\n/**\n * GraphQL Rate Limiting Configuration\n * \n * Rate limiting for GraphQL operations.\n */\nexport const GraphQLRateLimitSchema = z.object({\n /** Enable rate limiting */\n enabled: z.boolean().default(true).describe('Enable rate limiting'),\n \n /** Rate limit strategy */\n strategy: z.enum(['token_bucket', 'fixed_window', 'sliding_window', 'cost_based']).default('token_bucket').describe('Rate limiting strategy'),\n \n /** Global rate limits */\n global: z.object({\n /** Requests per time window */\n maxRequests: z.number().int().min(1).default(1000).describe('Maximum requests per window'),\n \n /** Time window in milliseconds */\n windowMs: z.number().int().min(1000).default(60000).describe('Time window in milliseconds'),\n }).optional().describe('Global rate limits'),\n \n /** Per-user rate limits */\n perUser: z.object({\n /** Requests per time window */\n maxRequests: z.number().int().min(1).default(100).describe('Maximum requests per user per window'),\n \n /** Time window in milliseconds */\n windowMs: z.number().int().min(1000).default(60000).describe('Time window in milliseconds'),\n }).optional().describe('Per-user rate limits'),\n \n /** Cost-based rate limiting */\n costBased: z.object({\n /** Enable cost-based limiting */\n enabled: z.boolean().default(false).describe('Enable cost-based rate limiting'),\n \n /** Maximum cost per time window */\n maxCost: z.number().int().min(1).default(10000).describe('Maximum cost per window'),\n \n /** Time window in milliseconds */\n windowMs: z.number().int().min(1000).default(60000).describe('Time window in milliseconds'),\n \n /** Use complexity as cost */\n useComplexityAsCost: z.boolean().default(true).describe('Use query complexity as cost'),\n }).optional().describe('Cost-based rate limiting'),\n \n /** Operation-specific limits */\n operations: z.record(z.string(), z.object({\n maxRequests: z.number().int().min(1).describe('Max requests for this operation'),\n windowMs: z.number().int().min(1000).describe('Time window'),\n })).optional().describe('Per-operation rate limits'),\n \n /** Callback on limit exceeded */\n onLimitExceeded: z.enum(['reject', 'queue', 'log']).default('reject').describe('Action when rate limit exceeded'),\n \n /** Custom error message */\n errorMessage: z.string().optional().describe('Custom error message for rate limit violations'),\n \n /** Headers to include in response */\n includeHeaders: z.boolean().default(true).describe('Include rate limit headers in response'),\n});\n\nexport type GraphQLRateLimit = z.infer<typeof GraphQLRateLimitSchema>;\nexport type GraphQLRateLimitInput = z.input<typeof GraphQLRateLimitSchema>;\n\n// ==========================================\n// 11. GraphQL Security - Persisted Queries\n// ==========================================\n\n/**\n * Persisted Queries Configuration\n * \n * Only allow pre-registered queries to execute (allow list approach).\n * Improves security and performance.\n */\nexport const GraphQLPersistedQuerySchema = z.object({\n /** Enable persisted queries */\n enabled: z.boolean().default(false).describe('Enable persisted queries'),\n \n /** Enforcement mode */\n mode: z.enum(['optional', 'required']).default('optional').describe('Persisted query mode (optional: allow both, required: only persisted)'),\n \n /** Query store configuration */\n store: z.object({\n /** Store type */\n type: z.enum(['memory', 'redis', 'database', 'file']).default('memory').describe('Query store type'),\n \n /** Store connection string */\n connection: z.string().optional().describe('Store connection string or path'),\n \n /** TTL for cached queries */\n ttl: z.number().int().min(0).optional().describe('TTL in seconds for stored queries'),\n }).optional().describe('Query store configuration'),\n \n /** Automatic Persisted Queries (APQ) */\n apq: z.object({\n /** Enable APQ */\n enabled: z.boolean().default(true).describe('Enable Automatic Persisted Queries'),\n \n /** Hash algorithm */\n hashAlgorithm: z.enum(['sha256', 'sha1', 'md5']).default('sha256').describe('Hash algorithm for query IDs'),\n \n /** Cache control */\n cache: z.object({\n /** Cache TTL */\n ttl: z.number().int().min(0).default(3600).describe('Cache TTL in seconds'),\n \n /** Max cache size */\n maxSize: z.number().int().min(1).optional().describe('Maximum number of cached queries'),\n }).optional().describe('APQ cache configuration'),\n }).optional().describe('Automatic Persisted Queries configuration'),\n \n /** Query allow list */\n allowlist: z.object({\n /** Enable allow list mode */\n enabled: z.boolean().default(false).describe('Enable query allow list (reject queries not in list)'),\n \n /** Allowed query IDs */\n queries: z.array(z.object({\n id: z.string().describe('Query ID or hash'),\n operation: z.string().optional().describe('Operation name'),\n query: z.string().optional().describe('Query string'),\n })).optional().describe('Allowed queries'),\n \n /** External allow list source */\n source: z.string().optional().describe('External allow list source (file path or URL)'),\n }).optional().describe('Query allow list configuration'),\n \n /** Security */\n security: z.object({\n /** Maximum query size */\n maxQuerySize: z.number().int().min(1).optional().describe('Maximum query string size in bytes'),\n \n /** Reject introspection in production */\n rejectIntrospection: z.boolean().default(false).describe('Reject introspection queries'),\n }).optional().describe('Security configuration'),\n});\n\nexport type GraphQLPersistedQuery = z.infer<typeof GraphQLPersistedQuerySchema>;\nexport type GraphQLPersistedQueryInput = z.input<typeof GraphQLPersistedQuerySchema>;\n\n// ==========================================\n// 12. GraphQL Federation\n// ==========================================\n\n/**\n * Federation Entity Key Definition\n * \n * Defines how entities are uniquely identified across subgraphs.\n * Corresponds to the `@key` directive in Apollo Federation.\n * \n * @see https://www.apollographql.com/docs/federation/entities\n */\nexport const FederationEntityKeySchema = z.object({\n /** Fields composing the key (e.g., \"id\" or \"sku packageId\") */\n fields: z.string().describe('Selection set of fields composing the entity key'),\n\n /** Whether this key can be used for resolution across subgraphs */\n resolvable: z.boolean().optional().default(true).describe('Whether entities can be resolved from this subgraph'),\n});\n\nexport type FederationEntityKey = z.infer<typeof FederationEntityKeySchema>;\n\n/**\n * Federation External Field\n * \n * Marks a field as owned by another subgraph (`@external`).\n */\nexport const FederationExternalFieldSchema = z.object({\n /** Field name */\n field: z.string().describe('Field name marked as external'),\n\n /** The subgraph that owns this field */\n ownerSubgraph: z.string().optional().describe('Subgraph that owns this field'),\n});\n\nexport type FederationExternalField = z.infer<typeof FederationExternalFieldSchema>;\n\n/**\n * Federation Requires Directive\n * \n * Specifies fields that must be fetched from other subgraphs\n * before resolving a computed field.\n * Corresponds to the `@requires` directive in Apollo Federation.\n */\nexport const FederationRequiresSchema = z.object({\n /** The field that has this requirement */\n field: z.string().describe('Field with the requirement'),\n\n /** Selection set of external fields required for resolution */\n fields: z.string().describe('Selection set of required fields (e.g., \"price weight\")'),\n});\n\nexport type FederationRequires = z.infer<typeof FederationRequiresSchema>;\n\n/**\n * Federation Provides Directive\n * \n * Indicates that a field resolution provides additional fields\n * of a returned entity type.\n * Corresponds to the `@provides` directive in Apollo Federation.\n */\nexport const FederationProvidesSchema = z.object({\n /** The field that provides additional data */\n field: z.string().describe('Field that provides additional entity fields'),\n\n /** Selection set of fields provided during resolution */\n fields: z.string().describe('Selection set of provided fields (e.g., \"name price\")'),\n});\n\nexport type FederationProvides = z.infer<typeof FederationProvidesSchema>;\n\n/**\n * Federation Entity Configuration\n * \n * Configures a type as a federated entity that can be referenced\n * and extended across multiple subgraphs.\n */\nexport const FederationEntitySchema = z.object({\n /** Type/Object name */\n typeName: z.string().describe('GraphQL type name for this entity'),\n\n /** Entity keys (`@key` directive) */\n keys: z.array(FederationEntityKeySchema).min(1).describe('Entity key definitions'),\n\n /** External fields (`@external`) */\n externalFields: z.array(FederationExternalFieldSchema).optional().describe('Fields owned by other subgraphs'),\n\n /** Requires directives (`@requires`) */\n requires: z.array(FederationRequiresSchema).optional().describe('Required external fields for computed fields'),\n\n /** Provides directives (`@provides`) */\n provides: z.array(FederationProvidesSchema).optional().describe('Fields provided during resolution'),\n\n /** Whether this subgraph owns this entity */\n owner: z.boolean().optional().default(false).describe('Whether this subgraph is the owner of this entity'),\n});\n\nexport type FederationEntity = z.infer<typeof FederationEntitySchema>;\n\n/**\n * Subgraph Configuration\n * \n * Configuration for an individual subgraph in a federated architecture.\n */\nexport const SubgraphConfigSchema = z.object({\n /** Subgraph name */\n name: z.string().describe('Unique subgraph identifier'),\n\n /** Subgraph URL */\n url: z.string().describe('Subgraph endpoint URL'),\n\n /** Schema source */\n schemaSource: z.enum(['introspection', 'file', 'registry']).default('introspection').describe('How to obtain the subgraph schema'),\n\n /** Schema file path (when schemaSource is \"file\") */\n schemaPath: z.string().optional().describe('Path to schema file (SDL format)'),\n\n /** Federated entities defined by this subgraph */\n entities: z.array(FederationEntitySchema).optional().describe('Entity definitions for this subgraph'),\n\n /** Health check endpoint */\n healthCheck: z.object({\n enabled: z.boolean().default(true).describe('Enable health checking'),\n path: z.string().default('/health').describe('Health check endpoint path'),\n intervalMs: z.number().int().min(1000).default(30000).describe('Health check interval in milliseconds'),\n }).optional().describe('Subgraph health check configuration'),\n\n /** Request headers to forward */\n forwardHeaders: z.array(z.string()).optional().describe('HTTP headers to forward to this subgraph'),\n});\n\nexport type SubgraphConfig = z.infer<typeof SubgraphConfigSchema>;\nexport type SubgraphConfigInput = z.input<typeof SubgraphConfigSchema>;\n\n/**\n * Federation Gateway Configuration\n * \n * Root-level gateway configuration for Apollo Federation or similar.\n * Manages query planning, routing, and composition across subgraphs.\n */\nexport const FederationGatewaySchema = z.object({\n /** Enable federation mode */\n enabled: z.boolean().default(false).describe('Enable GraphQL Federation gateway mode'),\n\n /** Federation specification version */\n version: z.enum(['v1', 'v2']).default('v2').describe('Federation specification version'),\n\n /** Registered subgraphs */\n subgraphs: z.array(SubgraphConfigSchema).describe('Subgraph configurations'),\n\n /** Service discovery */\n serviceDiscovery: z.object({\n /** Discovery mode */\n type: z.enum(['static', 'dns', 'consul', 'kubernetes']).default('static').describe('Service discovery method'),\n\n /** Poll interval for dynamic discovery */\n pollIntervalMs: z.number().int().min(1000).optional().describe('Discovery poll interval in milliseconds'),\n\n /** Kubernetes namespace (when type is \"kubernetes\") */\n namespace: z.string().optional().describe('Kubernetes namespace for subgraph discovery'),\n }).optional().describe('Service discovery configuration'),\n\n /** Query planning */\n queryPlanning: z.object({\n /** Execution strategy */\n strategy: z.enum(['parallel', 'sequential', 'adaptive']).default('parallel').describe('Query execution strategy across subgraphs'),\n\n /** Maximum query depth across subgraphs */\n maxDepth: z.number().int().min(1).optional().describe('Max query depth in federated execution'),\n\n /** Dry-run mode for debugging query plans */\n dryRun: z.boolean().optional().default(false).describe('Log query plans without executing'),\n }).optional().describe('Query planning configuration'),\n\n /** Schema composition settings */\n composition: z.object({\n /** How schema conflicts are resolved */\n conflictResolution: z.enum(['error', 'first_wins', 'last_wins']).default('error').describe('Strategy for resolving schema conflicts'),\n\n /** Whether to validate composed schema */\n validate: z.boolean().default(true).describe('Validate composed supergraph schema'),\n }).optional().describe('Schema composition configuration'),\n\n /** Gateway-level error handling */\n errorHandling: z.object({\n /** Whether to include subgraph names in errors */\n includeSubgraphName: z.boolean().default(false).describe('Include subgraph name in error responses'),\n\n /** Partial error behavior */\n partialErrors: z.enum(['propagate', 'nullify', 'reject']).default('propagate').describe('Behavior when a subgraph returns partial errors'),\n }).optional().describe('Error handling configuration'),\n});\n\nexport type FederationGateway = z.infer<typeof FederationGatewaySchema>;\nexport type FederationGatewayInput = z.input<typeof FederationGatewaySchema>;\n\n// ==========================================\n// 13. Complete GraphQL Configuration\n// ==========================================\n\n/**\n * Complete GraphQL Configuration\n * \n * Root configuration for GraphQL API generation and security.\n */\nexport const GraphQLConfigSchema = z.object({\n /** Enable GraphQL API */\n enabled: z.boolean().default(true).describe('Enable GraphQL API'),\n \n /** GraphQL endpoint path */\n path: z.string().default('/graphql').describe('GraphQL endpoint path'),\n \n /** GraphQL Playground */\n playground: z.object({\n enabled: z.boolean().default(true).describe('Enable GraphQL Playground'),\n path: z.string().default('/playground').describe('Playground path'),\n }).optional().describe('GraphQL Playground configuration'),\n \n /** Schema generation */\n schema: z.object({\n /** Auto-generate types from Objects */\n autoGenerateTypes: z.boolean().default(true).describe('Auto-generate types from Objects'),\n \n /** Type configurations */\n types: z.array(GraphQLTypeConfigSchema).optional().describe('Type configurations'),\n \n /** Query configurations */\n queries: z.array(GraphQLQueryConfigSchema).optional().describe('Query configurations'),\n \n /** Mutation configurations */\n mutations: z.array(GraphQLMutationConfigSchema).optional().describe('Mutation configurations'),\n \n /** Subscription configurations */\n subscriptions: z.array(GraphQLSubscriptionConfigSchema).optional().describe('Subscription configurations'),\n \n /** Custom resolvers */\n resolvers: z.array(GraphQLResolverConfigSchema).optional().describe('Custom resolver configurations'),\n \n /** Custom directives */\n directives: z.array(GraphQLDirectiveConfigSchema).optional().describe('Custom directive configurations'),\n }).optional().describe('Schema generation configuration'),\n \n /** DataLoader configurations */\n dataLoaders: z.array(GraphQLDataLoaderConfigSchema).optional().describe('DataLoader configurations'),\n \n /** Security configuration */\n security: z.object({\n /** Query depth limiting */\n depthLimit: GraphQLQueryDepthLimitSchema.optional().describe('Query depth limiting'),\n \n /** Query complexity */\n complexity: GraphQLQueryComplexitySchema.optional().describe('Query complexity calculation'),\n \n /** Rate limiting */\n rateLimit: GraphQLRateLimitSchema.optional().describe('Rate limiting'),\n \n /** Persisted queries */\n persistedQueries: GraphQLPersistedQuerySchema.optional().describe('Persisted queries'),\n }).optional().describe('Security configuration'),\n\n /** Federation configuration */\n federation: FederationGatewaySchema.optional().describe('GraphQL Federation gateway configuration'),\n});\n\nexport const GraphQLConfig = Object.assign(GraphQLConfigSchema, {\n create: <T extends z.input<typeof GraphQLConfigSchema>>(config: T) => config,\n});\n\nexport type GraphQLConfig = z.infer<typeof GraphQLConfigSchema>;\nexport type GraphQLConfigInput = z.input<typeof GraphQLConfigSchema>;\n\n// ==========================================\n// Helper Functions\n// ==========================================\n\n/**\n * Helper to map ObjectQL field type to GraphQL scalar type\n */\nexport const mapFieldTypeToGraphQL = (fieldType: z.infer<typeof FieldType>): string => {\n const mapping: Record<string, string> = {\n // Core Text\n 'text': 'String',\n 'textarea': 'String',\n 'email': 'Email',\n 'url': 'URL',\n 'phone': 'PhoneNumber',\n 'password': 'String',\n \n // Rich Content\n 'markdown': 'String',\n 'html': 'String',\n 'richtext': 'String',\n \n // Numbers\n 'number': 'Float',\n 'currency': 'Currency',\n 'percent': 'Float',\n \n // Date & Time\n 'date': 'Date',\n 'datetime': 'DateTime',\n 'time': 'Time',\n \n // Logic\n 'boolean': 'Boolean',\n 'toggle': 'Boolean',\n \n // Selection\n 'select': 'String',\n 'multiselect': '[String]',\n 'radio': 'String',\n 'checkboxes': '[String]',\n \n // Relational\n 'lookup': 'ID',\n 'master_detail': 'ID',\n 'tree': 'ID',\n \n // Media\n 'image': 'URL',\n 'file': 'URL',\n 'avatar': 'URL',\n 'video': 'URL',\n 'audio': 'URL',\n \n // Calculated\n 'formula': 'String',\n 'summary': 'Float',\n 'autonumber': 'String',\n \n // Enhanced Types\n 'location': 'JSONObject',\n 'address': 'JSONObject',\n 'code': 'String',\n 'json': 'JSON',\n 'color': 'String',\n 'rating': 'Float',\n 'slider': 'Float',\n 'signature': 'String',\n 'qrcode': 'String',\n 'progress': 'Float',\n 'tags': '[String]',\n \n // AI/ML\n 'vector': '[Float]',\n };\n \n return mapping[fieldType] || 'String';\n};\n","// Copyright (c) 2025 ObjectStack. Licensed under the Apache-2.0 license.\n\nimport { z } from 'zod';\nimport { ApiErrorSchema, BaseResponseSchema, RecordDataSchema } from './contract.zod';\n\n/**\n * Batch Operations API\n * \n * Provides efficient bulk data operations with transaction support.\n * Implements P0/P1 requirements for ObjectStack kernel.\n * \n * Features:\n * - Batch create/update/delete operations\n * - Atomic transaction support (all-or-none)\n * - Partial success handling\n * - Detailed error reporting per record\n * \n * Industry alignment: Salesforce Bulk API, Microsoft Dynamics Bulk Operations\n */\n\n// ==========================================\n// Batch Operation Types\n// ==========================================\n\n/**\n * Batch Operation Type Enum\n * Defines the type of batch operation to perform\n */\nexport const BatchOperationType = z.enum([\n 'create', // Batch insert\n 'update', // Batch update\n 'upsert', // Batch upsert (insert or update based on external ID)\n 'delete', // Batch delete\n]);\n\nexport type BatchOperationType = z.infer<typeof BatchOperationType>;\n\n// ==========================================\n// Batch Request Schemas\n// ==========================================\n\n/**\n * Batch Record Schema\n * Individual record in a batch operation\n */\nexport const BatchRecordSchema = z.object({\n id: z.string().optional().describe('Record ID (required for update/delete)'),\n data: RecordDataSchema.optional().describe('Record data (required for create/update/upsert)'),\n externalId: z.string().optional().describe('External ID for upsert matching'),\n});\n\nexport type BatchRecord = z.infer<typeof BatchRecordSchema>;\n\n/**\n * Batch Operation Options Schema\n * Configuration options for batch operations\n */\nexport const BatchOptionsSchema = z.object({\n atomic: z.boolean().optional().default(true).describe('If true, rollback entire batch on any failure (transaction mode)'),\n returnRecords: z.boolean().optional().default(false).describe('If true, return full record data in response'),\n continueOnError: z.boolean().optional().default(false).describe('If true (and atomic=false), continue processing remaining records after errors'),\n validateOnly: z.boolean().optional().default(false).describe('If true, validate records without persisting changes (dry-run mode)'),\n});\n\nexport type BatchOptions = z.infer<typeof BatchOptionsSchema>;\n\n/**\n * Batch Update Request Schema\n * Request payload for batch update operations\n * \n * @example\n * // POST /api/v1/data/{object}/batch\n * {\n * \"operation\": \"update\",\n * \"records\": [\n * { \"id\": \"1\", \"data\": { \"name\": \"Updated Name 1\", \"status\": \"active\" } },\n * { \"id\": \"2\", \"data\": { \"name\": \"Updated Name 2\", \"status\": \"active\" } }\n * ],\n * \"options\": {\n * \"atomic\": true,\n * \"returnRecords\": true\n * }\n * }\n */\nexport const BatchUpdateRequestSchema = z.object({\n operation: BatchOperationType.describe('Type of batch operation'),\n records: z.array(BatchRecordSchema).min(1).max(200).describe('Array of records to process (max 200 per batch)'),\n options: BatchOptionsSchema.optional().describe('Batch operation options'),\n});\n\nexport type BatchUpdateRequest = z.input<typeof BatchUpdateRequestSchema>;\n\n/**\n * Simplified Batch Update Request (for updateMany API)\n * Simplified request for batch updates without operation field\n * \n * @example\n * // POST /api/v1/data/{object}/updateMany\n * {\n * \"records\": [\n * { \"id\": \"1\", \"data\": { \"name\": \"Updated Name 1\" } },\n * { \"id\": \"2\", \"data\": { \"name\": \"Updated Name 2\" } }\n * ],\n * \"options\": { \"atomic\": true }\n * }\n */\nexport const UpdateManyRequestSchema = z.object({\n records: z.array(BatchRecordSchema).min(1).max(200).describe('Array of records to update (max 200 per batch)'),\n options: BatchOptionsSchema.optional().describe('Update options'),\n});\n\nexport type UpdateManyRequest = z.input<typeof UpdateManyRequestSchema>;\n\n// ==========================================\n// Batch Response Schemas\n// ==========================================\n\n/**\n * Batch Operation Result Schema\n * Result for a single record in a batch operation\n */\nexport const BatchOperationResultSchema = z.object({\n id: z.string().optional().describe('Record ID if operation succeeded'),\n success: z.boolean().describe('Whether this record was processed successfully'),\n errors: z.array(ApiErrorSchema).optional().describe('Array of errors if operation failed'),\n data: RecordDataSchema.optional().describe('Full record data (if returnRecords=true)'),\n index: z.number().optional().describe('Index of the record in the request array'),\n});\n\nexport type BatchOperationResult = z.infer<typeof BatchOperationResultSchema>;\n\n/**\n * Batch Update Response Schema\n * Response payload for batch operations\n * \n * @example Success Response\n * {\n * \"success\": true,\n * \"operation\": \"update\",\n * \"total\": 2,\n * \"succeeded\": 2,\n * \"failed\": 0,\n * \"results\": [\n * { \"id\": \"1\", \"success\": true, \"index\": 0 },\n * { \"id\": \"2\", \"success\": true, \"index\": 1 }\n * ],\n * \"meta\": {\n * \"timestamp\": \"2026-01-29T12:00:00Z\",\n * \"duration\": 150\n * }\n * }\n * \n * @example Partial Success Response (atomic=false)\n * {\n * \"success\": false,\n * \"operation\": \"update\",\n * \"total\": 2,\n * \"succeeded\": 1,\n * \"failed\": 1,\n * \"results\": [\n * { \"id\": \"1\", \"success\": true, \"index\": 0 },\n * { \n * \"success\": false, \n * \"index\": 1,\n * \"errors\": [{ \"code\": \"validation_error\", \"message\": \"Invalid email format\" }]\n * }\n * ],\n * \"meta\": {\n * \"timestamp\": \"2026-01-29T12:00:00Z\"\n * }\n * }\n */\nexport const BatchUpdateResponseSchema = BaseResponseSchema.extend({\n operation: BatchOperationType.optional().describe('Operation type that was performed'),\n total: z.number().describe('Total number of records in the batch'),\n succeeded: z.number().describe('Number of records that succeeded'),\n failed: z.number().describe('Number of records that failed'),\n results: z.array(BatchOperationResultSchema).describe('Detailed results for each record'),\n});\n\nexport type BatchUpdateResponse = z.infer<typeof BatchUpdateResponseSchema>;\n\n// ==========================================\n// Batch Delete Schemas\n// ==========================================\n\n/**\n * Batch Delete Request Schema\n * Simplified request for batch delete operations\n * \n * @example\n * // POST /api/v1/data/{object}/deleteMany\n * {\n * \"ids\": [\"1\", \"2\", \"3\"],\n * \"options\": { \"atomic\": true }\n * }\n */\nexport const DeleteManyRequestSchema = z.object({\n ids: z.array(z.string()).min(1).max(200).describe('Array of record IDs to delete (max 200)'),\n options: BatchOptionsSchema.optional().describe('Delete options'),\n});\n\nexport type DeleteManyRequest = z.infer<typeof DeleteManyRequestSchema>;\n\n// ==========================================\n// API Contract Exports\n// ==========================================\n\n/**\n * Batch API Contracts\n * Standardized contracts for batch operations\n */\nexport const BatchApiContracts = {\n batchOperation: {\n input: BatchUpdateRequestSchema,\n output: BatchUpdateResponseSchema,\n },\n updateMany: {\n input: UpdateManyRequestSchema,\n output: BatchUpdateResponseSchema,\n },\n deleteMany: {\n input: DeleteManyRequestSchema,\n output: BatchUpdateResponseSchema,\n },\n};\n\n/**\n * Batch Configuration Schema\n * \n * Configuration for enabling batch operations API.\n */\nexport const BatchConfigSchema = z.object({\n /** Enable batch operations */\n enabled: z.boolean().default(true).describe('Enable batch operations'),\n \n /** Maximum records per batch */\n maxRecordsPerBatch: z.number().int().min(1).max(1000).default(200).describe('Maximum records per batch'),\n \n /** Default options */\n defaultOptions: BatchOptionsSchema.optional().describe('Default batch options'),\n}).passthrough(); // Allow additional properties\n\nexport type BatchConfig = z.infer<typeof BatchConfigSchema>;\n","// Copyright (c) 2025 ObjectStack. Licensed under the Apache-2.0 license.\n\nimport { z } from 'zod';\n\n/**\n * HTTP Metadata Cache Protocol\n * \n * Implements efficient HTTP-level metadata caching with ETag support.\n * Implements P0 requirement for ObjectStack kernel.\n * \n * ## Caching in ObjectStack\n * \n * **HTTP Cache (`api/http-cache.zod.ts`) - This File**\n * - **Purpose**: Cache API responses at HTTP protocol level\n * - **Technologies**: HTTP headers (ETag, Last-Modified, Cache-Control), CDN\n * - **Configuration**: Cache-Control headers, validation tokens\n * - **Use case**: Reduce API response time for repeated metadata requests\n * - **Scope**: HTTP layer, client-server communication\n * \n * **Application Cache (`system/cache.zod.ts`)**\n * - **Purpose**: Cache computed data, query results, aggregations\n * - **Technologies**: Redis, Memcached, in-memory LRU\n * - **Configuration**: TTL, eviction policies, cache warming\n * - **Use case**: Cache expensive database queries, computed values\n * - **Scope**: Application layer, server-side data storage\n * \n * ## Features\n * - ETag-based conditional requests (HTTP 304 Not Modified)\n * - Cache-Control directives\n * - Metadata versioning\n * - Selective cache invalidation\n * \n * Industry alignment: HTTP Caching (RFC 7234), Salesforce Metadata API\n * \n * @see ../../system/cache.zod.ts for application-level caching\n */\n\n// ==========================================\n// Cache Control Headers\n// ==========================================\n\n/**\n * Cache Control Directive Enum\n * Standard HTTP cache control directives\n */\nexport const CacheDirective = z.enum([\n 'public', // Cacheable by any cache\n 'private', // Cacheable only by user-agent\n 'no-cache', // Must revalidate with server\n 'no-store', // Never cache\n 'must-revalidate', // Must revalidate stale responses\n 'max-age', // Maximum cache age in seconds\n]);\n\nexport type CacheDirective = z.infer<typeof CacheDirective>;\n\n/**\n * Cache Control Schema\n * HTTP cache control configuration\n * \n * @example\n * {\n * \"directives\": [\"public\", \"max-age\"],\n * \"maxAge\": 3600,\n * \"staleWhileRevalidate\": 86400\n * }\n */\nexport const CacheControlSchema = z.object({\n directives: z.array(CacheDirective).describe('Cache control directives'),\n maxAge: z.number().optional().describe('Maximum cache age in seconds'),\n staleWhileRevalidate: z.number().optional().describe('Allow serving stale content while revalidating (seconds)'),\n staleIfError: z.number().optional().describe('Allow serving stale content on error (seconds)'),\n});\n\nexport type CacheControl = z.infer<typeof CacheControlSchema>;\n\n// ==========================================\n// ETag Support\n// ==========================================\n\n/**\n * ETag Schema\n * Entity tag for cache validation\n * \n * ETags can be:\n * - Strong: Exact match required (e.g., \"686897696a7c876b7e\")\n * - Weak: Semantic equivalence (e.g., W/\"686897696a7c876b7e\")\n */\nexport const ETagSchema = z.object({\n value: z.string().describe('ETag value (hash or version identifier)'),\n weak: z.boolean().optional().default(false).describe('Whether this is a weak ETag'),\n});\n\nexport type ETag = z.infer<typeof ETagSchema>;\n\n// ==========================================\n// Metadata Cache Request\n// ==========================================\n\n/**\n * Metadata Cache Request Schema\n * Request with cache validation headers\n * \n * @example\n * // GET /api/v1/metadata/objects/account\n * // Headers:\n * // If-None-Match: \"686897696a7c876b7e\"\n * // If-Modified-Since: Wed, 21 Oct 2015 07:28:00 GMT\n */\nexport const MetadataCacheRequestSchema = z.object({\n ifNoneMatch: z.string().optional().describe('ETag value for conditional request (If-None-Match header)'),\n ifModifiedSince: z.string().datetime().optional().describe('Timestamp for conditional request (If-Modified-Since header)'),\n cacheControl: CacheControlSchema.optional().describe('Client cache control preferences'),\n});\n\nexport type MetadataCacheRequest = z.infer<typeof MetadataCacheRequestSchema>;\n\n// ==========================================\n// Metadata Cache Response\n// ==========================================\n\n/**\n * Metadata Cache Response Schema\n * Response with cache control headers\n * \n * @example Success Response (200 OK)\n * {\n * \"data\": { \"object\": \"account\" },\n * \"etag\": {\n * \"value\": \"686897696a7c876b7e\",\n * \"weak\": false\n * },\n * \"lastModified\": \"2026-01-29T12:00:00Z\",\n * \"cacheControl\": {\n * \"directives\": [\"public\", \"max-age\"],\n * \"maxAge\": 3600\n * }\n * }\n * \n * @example Not Modified Response (304 Not Modified)\n * {\n * \"notModified\": true,\n * \"etag\": {\n * \"value\": \"686897696a7c876b7e\"\n * }\n * }\n */\nexport const MetadataCacheResponseSchema = z.object({\n data: z.unknown().optional().describe('Metadata payload (omitted for 304 Not Modified)'),\n etag: ETagSchema.optional().describe('ETag for this resource version'),\n lastModified: z.string().datetime().optional().describe('Last modification timestamp'),\n cacheControl: CacheControlSchema.optional().describe('Cache control directives'),\n notModified: z.boolean().optional().default(false).describe('True if resource has not been modified (304 response)'),\n version: z.string().optional().describe('Metadata version identifier'),\n});\n\nexport type MetadataCacheResponse = z.infer<typeof MetadataCacheResponseSchema>;\n\n// ==========================================\n// Metadata Cache Invalidation\n// ==========================================\n\n/**\n * Cache Invalidation Target Enum\n * Specifies what to invalidate\n */\nexport const CacheInvalidationTarget = z.enum([\n 'all', // Invalidate all cached metadata\n 'object', // Invalidate specific object metadata\n 'field', // Invalidate specific field metadata\n 'permission', // Invalidate permission metadata\n 'layout', // Invalidate layout metadata\n 'custom', // Custom invalidation pattern\n]);\n\nexport type CacheInvalidationTarget = z.infer<typeof CacheInvalidationTarget>;\n\n/**\n * Cache Invalidation Request Schema\n * Request to invalidate cached metadata\n * \n * @example\n * // POST /api/v1/metadata/cache/invalidate\n * {\n * \"target\": \"object\",\n * \"identifiers\": [\"account\", \"contact\"],\n * \"cascade\": true\n * }\n */\nexport const CacheInvalidationRequestSchema = z.object({\n target: CacheInvalidationTarget.describe('What to invalidate'),\n identifiers: z.array(z.string()).optional().describe('Specific resources to invalidate (e.g., object names)'),\n cascade: z.boolean().optional().default(false).describe('If true, invalidate dependent resources'),\n pattern: z.string().optional().describe('Pattern for custom invalidation (supports wildcards)'),\n});\n\nexport type CacheInvalidationRequest = z.infer<typeof CacheInvalidationRequestSchema>;\n\n/**\n * Cache Invalidation Response Schema\n * Response for cache invalidation\n * \n * @example\n * {\n * \"success\": true,\n * \"invalidated\": 5,\n * \"targets\": [\"account\", \"contact\", \"opportunity\"]\n * }\n */\nexport const CacheInvalidationResponseSchema = z.object({\n success: z.boolean().describe('Whether invalidation succeeded'),\n invalidated: z.number().describe('Number of cache entries invalidated'),\n targets: z.array(z.string()).optional().describe('List of invalidated resources'),\n});\n\nexport type CacheInvalidationResponse = z.infer<typeof CacheInvalidationResponseSchema>;\n\n// ==========================================\n// Metadata Cache API Methods\n// ==========================================\n\n/**\n * Metadata Cache API Client Interface\n * \n * @example Usage\n * // Get metadata with cache support\n * const response = await client.meta.getCached('account', {\n * ifNoneMatch: '\"686897696a7c876b7e\"'\n * });\n * \n * if (response.notModified) {\n * // Use cached version\n * } else {\n * // Update cache with response.data\n * cache.set('account', response.data, {\n * etag: response.etag?.value,\n * maxAge: response.cacheControl?.maxAge\n * });\n * }\n */\nexport const MetadataCacheApi = {\n getCached: {\n input: MetadataCacheRequestSchema,\n output: MetadataCacheResponseSchema,\n },\n invalidate: {\n input: CacheInvalidationRequestSchema,\n output: CacheInvalidationResponseSchema,\n },\n};\n","// Copyright (c) 2025 ObjectStack. Licensed under the Apache-2.0 license.\n\nimport { z } from 'zod';\n\n/**\n * Standardized Error Codes Protocol\n * \n * Implements P0 requirement for ObjectStack kernel.\n * Provides consistent, machine-readable error codes across the platform.\n * \n * Features:\n * - Categorized error codes (validation, authentication, authorization, etc.)\n * - HTTP status code mapping\n * - Localization support\n * - Retry guidance\n * \n * Industry alignment: Google Cloud Errors, AWS Error Codes, Stripe API Errors\n */\n\n// ==========================================\n// Error Code Categories\n// ==========================================\n\n/**\n * Error Category Enum\n * High-level categorization of errors\n */\nexport const ErrorCategory = z.enum([\n 'validation', // Input validation errors (400)\n 'authentication', // Authentication failures (401)\n 'authorization', // Permission denied errors (403)\n 'not_found', // Resource not found (404)\n 'conflict', // Resource conflict (409)\n 'rate_limit', // Rate limiting (429)\n 'server', // Internal server errors (500)\n 'external', // External service errors (502/503)\n 'maintenance', // Planned maintenance (503)\n]);\n\nexport type ErrorCategory = z.infer<typeof ErrorCategory>;\n\n// ==========================================\n// Standard Error Codes\n// ==========================================\n\n/**\n * Standard Error Code Enum\n * Machine-readable error codes for common error scenarios\n */\nexport const StandardErrorCode = z.enum([\n // Validation Errors (400)\n 'validation_error', // Generic validation failure\n 'invalid_field', // Invalid field value\n 'missing_required_field', // Required field missing\n 'invalid_format', // Field format invalid (e.g., email, date)\n 'value_too_long', // Field value exceeds max length\n 'value_too_short', // Field value below min length\n 'value_out_of_range', // Numeric value out of range\n 'invalid_reference', // Invalid foreign key reference\n 'duplicate_value', // Unique constraint violation\n 'invalid_query', // Malformed query syntax\n 'invalid_filter', // Invalid filter expression\n 'invalid_sort', // Invalid sort specification\n 'max_records_exceeded', // Query would return too many records\n \n // Authentication Errors (401)\n 'unauthenticated', // No valid authentication provided\n 'invalid_credentials', // Wrong username/password\n 'expired_token', // Authentication token expired\n 'invalid_token', // Authentication token invalid\n 'session_expired', // User session expired\n 'mfa_required', // Multi-factor authentication required\n 'email_not_verified', // Email verification required\n \n // Authorization Errors (403)\n 'permission_denied', // User lacks required permission\n 'insufficient_privileges', // Operation requires higher privileges\n 'field_not_accessible', // Field-level security restriction\n 'record_not_accessible', // Sharing rule restriction\n 'license_required', // Feature requires license\n 'ip_restricted', // IP address not allowed\n 'time_restricted', // Access outside allowed time window\n \n // Not Found Errors (404)\n 'resource_not_found', // Generic resource not found\n 'object_not_found', // Object/table not found\n 'record_not_found', // Record with given ID not found\n 'field_not_found', // Field not found in object\n 'endpoint_not_found', // API endpoint not found\n \n // Conflict Errors (409)\n 'resource_conflict', // Generic resource conflict\n 'concurrent_modification', // Record modified by another user\n 'delete_restricted', // Cannot delete due to dependencies\n 'duplicate_record', // Record already exists\n 'lock_conflict', // Record is locked by another process\n \n // Rate Limiting (429)\n 'rate_limit_exceeded', // Too many requests\n 'quota_exceeded', // API quota exceeded\n 'concurrent_limit_exceeded', // Too many concurrent requests\n \n // Server Errors (500)\n 'internal_error', // Generic internal server error\n 'database_error', // Database operation failed\n 'timeout', // Operation timed out\n 'service_unavailable', // Service temporarily unavailable\n 'not_implemented', // Feature not yet implemented\n \n // External Service Errors (502/503)\n 'external_service_error', // External API call failed\n 'integration_error', // Integration service error\n 'webhook_delivery_failed', // Webhook delivery failed\n \n // Batch Operation Errors\n 'batch_partial_failure', // Batch operation partially succeeded\n 'batch_complete_failure', // Batch operation completely failed\n 'transaction_failed', // Transaction rolled back\n]);\n\nexport type StandardErrorCode = z.infer<typeof StandardErrorCode>;\n\n// ==========================================\n// Enhanced Error Schema\n// ==========================================\n\n/**\n * HTTP Status Code mapping for error categories\n */\nexport const ErrorHttpStatusMap: Record<string, number> = {\n validation: 400,\n authentication: 401,\n authorization: 403,\n not_found: 404,\n conflict: 409,\n rate_limit: 429,\n server: 500,\n external: 502,\n maintenance: 503,\n};\n\n/**\n * Retry Strategy Enum\n * Guidance on whether to retry failed requests\n */\nexport const RetryStrategy = z.enum([\n 'no_retry', // Do not retry (permanent failure)\n 'retry_immediate', // Retry immediately\n 'retry_backoff', // Retry with exponential backoff\n 'retry_after', // Retry after specified delay\n]);\n\nexport type RetryStrategy = z.infer<typeof RetryStrategy>;\n\n/**\n * Field Error Schema\n * Detailed error for a specific field\n */\nexport const FieldErrorSchema = z.object({\n field: z.string().describe('Field path (supports dot notation)'),\n code: StandardErrorCode.describe('Error code for this field'),\n message: z.string().describe('Human-readable error message'),\n value: z.unknown().optional().describe('The invalid value that was provided'),\n constraint: z.unknown().optional().describe('The constraint that was violated (e.g., max length)'),\n});\n\nexport type FieldError = z.infer<typeof FieldErrorSchema>;\n\n/**\n * Enhanced API Error Schema\n * Standardized error response with detailed metadata\n * \n * @example Validation Error\n * {\n * \"code\": \"validation_error\",\n * \"message\": \"Validation failed for 2 fields\",\n * \"category\": \"validation\",\n * \"httpStatus\": 400,\n * \"retryable\": false,\n * \"retryStrategy\": \"no_retry\",\n * \"details\": {\n * \"fieldErrors\": [\n * {\n * \"field\": \"email\",\n * \"code\": \"invalid_format\",\n * \"message\": \"Email format is invalid\",\n * \"value\": \"not-an-email\"\n * },\n * {\n * \"field\": \"age\",\n * \"code\": \"value_out_of_range\",\n * \"message\": \"Age must be between 0 and 120\",\n * \"value\": 150,\n * \"constraint\": { \"min\": 0, \"max\": 120 }\n * }\n * ]\n * },\n * \"timestamp\": \"2026-01-29T12:00:00Z\",\n * \"requestId\": \"req_123456\",\n * \"documentation\": \"https://docs.objectstack.dev/errors/validation_error\"\n * }\n * \n * @example Rate Limit Error\n * {\n * \"code\": \"rate_limit_exceeded\",\n * \"message\": \"Rate limit exceeded. Try again in 60 seconds.\",\n * \"category\": \"rate_limit\",\n * \"httpStatus\": 429,\n * \"retryable\": true,\n * \"retryStrategy\": \"retry_after\",\n * \"retryAfter\": 60,\n * \"details\": {\n * \"limit\": 1000,\n * \"remaining\": 0,\n * \"resetAt\": \"2026-01-29T13:00:00Z\"\n * }\n * }\n */\nexport const EnhancedApiErrorSchema = z.object({\n code: StandardErrorCode.describe('Machine-readable error code'),\n message: z.string().describe('Human-readable error message'),\n category: ErrorCategory.optional().describe('Error category'),\n httpStatus: z.number().optional().describe('HTTP status code'),\n retryable: z.boolean().default(false).describe('Whether the request can be retried'),\n retryStrategy: RetryStrategy.optional().describe('Recommended retry strategy'),\n retryAfter: z.number().optional().describe('Seconds to wait before retrying'),\n details: z.unknown().optional().describe('Additional error context'),\n fieldErrors: z.array(FieldErrorSchema).optional().describe('Field-specific validation errors'),\n timestamp: z.string().datetime().optional().describe('When the error occurred'),\n requestId: z.string().optional().describe('Request ID for tracking'),\n traceId: z.string().optional().describe('Distributed trace ID'),\n documentation: z.string().url().optional().describe('URL to error documentation'),\n helpText: z.string().optional().describe('Suggested actions to resolve the error'),\n});\n\nexport type EnhancedApiError = z.infer<typeof EnhancedApiErrorSchema>;\n\n// ==========================================\n// Error Response Schema\n// ==========================================\n\n/**\n * Standardized Error Response Schema\n * Complete error response envelope\n * \n * @example\n * {\n * \"success\": false,\n * \"error\": {\n * \"code\": \"permission_denied\",\n * \"message\": \"You do not have permission to update this record\",\n * \"category\": \"authorization\",\n * \"httpStatus\": 403,\n * \"retryable\": false\n * }\n * }\n */\nexport const ErrorResponseSchema = z.object({\n success: z.literal(false).describe('Always false for error responses'),\n error: EnhancedApiErrorSchema.describe('Error details'),\n meta: z.object({\n timestamp: z.string().datetime().optional(),\n requestId: z.string().optional(),\n traceId: z.string().optional(),\n }).optional().describe('Response metadata'),\n});\n\nexport type ErrorResponse = z.infer<typeof ErrorResponseSchema>;\n\n// ==========================================\n// Helper Functions\n// ==========================================\n\n/**\n * Get HTTP status code for an error category\n * @deprecated Move to @objectstack/core. Will be removed from spec in v2.0.0\n */\nexport function getHttpStatusForCategory(category: ErrorCategory): number {\n return ErrorHttpStatusMap[category] || 500;\n}\n\n/**\n * Create a standardized error response\n * @deprecated Move to @objectstack/core. Will be removed from spec in v2.0.0\n */\nexport function createErrorResponse(\n code: StandardErrorCode,\n message: string,\n options?: Partial<EnhancedApiError>\n): ErrorResponse {\n const category = getCategoryForCode(code);\n \n return {\n success: false,\n error: {\n code,\n message,\n category,\n httpStatus: getHttpStatusForCategory(category),\n timestamp: new Date().toISOString(),\n retryable: false,\n ...options,\n },\n };\n}\n\n/**\n * Infer error category from error code\n */\nfunction getCategoryForCode(code: StandardErrorCode): ErrorCategory {\n if (code.includes('validation') || code.includes('invalid') || code.includes('missing') || code.includes('duplicate')) {\n return 'validation';\n }\n if (code.includes('unauthenticated') || code.includes('token') || code.includes('credentials') || code.includes('session')) {\n return 'authentication';\n }\n if (code.includes('permission') || code.includes('privileges') || code.includes('accessible') || code.includes('restricted')) {\n return 'authorization';\n }\n if (code.includes('not_found')) {\n return 'not_found';\n }\n if (code.includes('conflict') || code.includes('concurrent') || code.includes('lock')) {\n return 'conflict';\n }\n if (code.includes('rate_limit') || code.includes('quota')) {\n return 'rate_limit';\n }\n if (code.includes('external') || code.includes('integration') || code.includes('webhook')) {\n return 'external';\n }\n if (code.includes('maintenance')) {\n return 'maintenance';\n }\n return 'server';\n}\n","// Copyright (c) 2025 ObjectStack. Licensed under the Apache-2.0 license.\n\nimport { z } from 'zod';\nimport { ViewSchema } from '../ui/view.zod';\nimport { ApiRoutesSchema, ServiceInfoSchema } from './discovery.zod';\nimport { BatchUpdateRequestSchema, BatchUpdateResponseSchema, BatchOptionsSchema } from './batch.zod';\nimport { MetadataCacheRequestSchema, MetadataCacheResponseSchema } from './http-cache.zod';\nimport { QuerySchema } from '../data/query.zod';\nimport { \n AnalyticsQueryRequestSchema, \n AnalyticsResultResponseSchema, \n GetAnalyticsMetaRequestSchema, \n AnalyticsMetadataResponseSchema \n} from './analytics.zod';\nimport { RealtimePresenceSchema, TransportProtocol } from './realtime.zod';\nimport { ObjectPermissionSchema, FieldPermissionSchema } from '../security/permission.zod';\nimport { WorkflowRuleSchema } from '../automation/workflow.zod';\nimport { TranslationDataSchema } from '../system/translation.zod';\nimport {\n ListPackagesRequestSchema,\n ListPackagesResponseSchema,\n GetPackageRequestSchema,\n GetPackageResponseSchema,\n InstallPackageRequestSchema,\n InstallPackageResponseSchema,\n UninstallPackageRequestSchema,\n UninstallPackageResponseSchema,\n EnablePackageRequestSchema,\n EnablePackageResponseSchema,\n DisablePackageRequestSchema,\n DisablePackageResponseSchema,\n} from '../kernel/package-registry.zod';\nimport type {\n ListPackagesRequest,\n ListPackagesResponse,\n GetPackageRequest,\n GetPackageResponse,\n InstallPackageRequest,\n InstallPackageResponse,\n UninstallPackageRequest,\n UninstallPackageResponse,\n EnablePackageRequest,\n EnablePackageResponse,\n DisablePackageRequest,\n DisablePackageResponse,\n InstalledPackage,\n PackageStatus,\n} from '../kernel/package-registry.zod';\n\nexport const AutomationTriggerRequestSchema = z.object({\n trigger: z.string(),\n payload: z.record(z.string(), z.unknown())\n});\n\nexport const AutomationTriggerResponseSchema = z.object({\n success: z.boolean(),\n jobId: z.string().optional(),\n result: z.unknown().optional()\n});\n\n/**\n * ObjectStack Protocol - Zod Schema Definitions\n * \n * Defines the runtime-validated contract for interacting with ObjectStack metadata and data.\n * Used by API adapters (HTTP, WebSocket, gRPC) to fetch data/metadata without knowing engine internals.\n * \n * This protocol enables:\n * - Runtime request/response validation at API gateway level\n * - Automatic API documentation generation\n * - Type-safe RPC communication between microservices\n * - Client SDK generation from schemas\n * \n * Architecture Alignment:\n * - Salesforce: REST API Request/Response schemas\n * - Kubernetes: API Resource schemas with runtime validation\n * - GraphQL: Schema-first API design\n */\n\n// ==========================================\n// Discovery & Metadata Operations\n// ==========================================\n\n/**\n * Get API Discovery Request\n * No parameters needed\n */\nexport const GetDiscoveryRequestSchema = z.object({});\n\n/**\n * Get API Discovery Response\n * Returns API version information and service availability.\n * \n * - `routes` provides a flat endpoint map for client routing.\n * - `services` is the single source of truth for service availability.\n * - `capabilities` was removed — derive from `services[x].enabled`.\n */\nexport const GetDiscoveryResponseSchema = z.object({\n version: z.string().describe('API version (e.g., \"v1\", \"2024-01\")'),\n apiName: z.string().describe('API name'),\n routes: ApiRoutesSchema.optional().describe('Available endpoint paths'),\n services: z.record(z.string(), ServiceInfoSchema).optional().describe('Per-service availability map'),\n});\n\n/**\n * Get Metadata Types Request\n */\nexport const GetMetaTypesRequestSchema = z.object({});\n\n/**\n * Get Metadata Types Response\n */\nexport const GetMetaTypesResponseSchema = z.object({\n types: z.array(z.string()).describe('Available metadata type names (e.g., \"object\", \"plugin\", \"view\")'),\n});\n\n/**\n * Get Metadata Items Request\n * Get all items of a specific metadata type\n */\nexport const GetMetaItemsRequestSchema = z.object({\n type: z.string().describe('Metadata type name (e.g., \"object\", \"plugin\")'),\n});\n\n/**\n * Get Metadata Items Response\n */\nexport const GetMetaItemsResponseSchema = z.object({\n type: z.string().describe('Metadata type name'),\n items: z.array(z.unknown()).describe('Array of metadata items'),\n});\n\n/**\n * Get Metadata Item Request\n * Get a specific metadata item by type and name\n */\nexport const GetMetaItemRequestSchema = z.object({\n type: z.string().describe('Metadata type name'),\n name: z.string().describe('Item name (snake_case identifier)'),\n});\n\n/**\n * Get Metadata Item Response\n */\nexport const GetMetaItemResponseSchema = z.object({\n type: z.string().describe('Metadata type name'),\n name: z.string().describe('Item name'),\n item: z.unknown().describe('Metadata item definition'),\n});\n\n/**\n * Save Metadata Item Request\n * Create or update a metadata item\n */\nexport const SaveMetaItemRequestSchema = z.object({\n type: z.string().describe('Metadata type name'),\n name: z.string().describe('Item name'),\n item: z.unknown().describe('Metadata item definition'),\n});\n\n/**\n * Save Metadata Item Response\n */\nexport const SaveMetaItemResponseSchema = z.object({\n success: z.boolean(),\n message: z.string().optional(),\n});\n\n/**\n * Get Metadata Item with Cache Request\n * Get a specific metadata item with HTTP cache validation support\n */\nexport const GetMetaItemCachedRequestSchema = z.object({\n type: z.string().describe('Metadata type name'),\n name: z.string().describe('Item name'),\n cacheRequest: MetadataCacheRequestSchema.optional().describe('Cache validation parameters'),\n});\n\n/**\n * Get Metadata Item with Cache Response\n * Uses MetadataCacheResponse from http-cache.zod.ts\n */\nexport const GetMetaItemCachedResponseSchema = MetadataCacheResponseSchema;\n\n/**\n * Get UI View Request\n * Resolves the appropriate UI view for an object based on context.\n * Unlike getMetaItem, this does not require a specific View ID.\n */\nexport const GetUiViewRequestSchema = z.object({\n object: z.string().describe('Object name (snake_case)'),\n type: z.enum(['list', 'form']).describe('View type'),\n});\n\n/**\n * Get UI View Response\n */\nexport const GetUiViewResponseSchema = ViewSchema;\n\n// ==========================================\n// Data Operations\n// ==========================================\n\n/**\n * Find Data Request\n * Defines a query to retrieve records from a specific object.\n * Supports filtering, sorting, pagination, and field selection.\n * \n * @example\n * {\n * \"object\": \"customers\",\n * \"query\": {\n * \"filters\": [[\"status\", \"=\", \"active\"], [\"revenue\", \">\", 10000]],\n * \"sort\": \"name desc\",\n * \"top\": 10\n * }\n * }\n */\nexport const FindDataRequestSchema = z.object({\n object: z.string().describe('The unique machine name of the object to query (e.g. \"account\").'),\n query: QuerySchema.optional().describe('Structured query definition (filter, sort, select, pagination).'),\n});\n\n/**\n * Find Data Response\n * Returns a list of records matching the query criteria.\n */\nexport const FindDataResponseSchema = z.object({\n object: z.string().describe('The object name for the returned records.'),\n records: z.array(z.record(z.string(), z.unknown())).describe('The list of matching records.'),\n total: z.number().optional().describe('Total number of records matching the filter (if requested).'),\n hasMore: z.boolean().optional().describe('True if there are more records available (pagination).'),\n});\n\n/**\n * Get Data Request\n * Retrieval of a single record by its unique identifier.\n * \n * @example\n * {\n * \"object\": \"contracts\",\n * \"id\": \"cnt_123456\"\n * }\n */\nexport const GetDataRequestSchema = z.object({\n object: z.string().describe('The object name.'),\n id: z.string().describe('The unique record identifier (primary key).'),\n});\n\n/**\n * Get Data Response\n */\nexport const GetDataResponseSchema = z.object({\n object: z.string().describe('The object name.'),\n id: z.string().describe('The record ID.'),\n record: z.record(z.string(), z.unknown()).describe('The complete record data.'),\n});\n\n/**\n * Create Data Request\n * Creation of a new record.\n * \n * @example\n * {\n * \"object\": \"leads\",\n * \"data\": {\n * \"first_name\": \"John\",\n * \"last_name\": \"Doe\",\n * \"company\": \"Acme Inc\"\n * }\n * }\n */\nexport const CreateDataRequestSchema = z.object({\n object: z.string().describe('The object name.'),\n data: z.record(z.string(), z.unknown()).describe('The dictionary of field values to insert.'),\n});\n\n/**\n * Create Data Response\n */\nexport const CreateDataResponseSchema = z.object({\n object: z.string().describe('The object name.'),\n id: z.string().describe('The ID of the newly created record.'),\n record: z.record(z.string(), z.unknown()).describe('The created record, including server-generated fields (created_at, owner).'),\n});\n\n/**\n * Update Data Request\n * Modification of an existing record.\n * \n * @example\n * {\n * \"object\": \"tasks\",\n * \"id\": \"tsk_001\",\n * \"data\": {\n * \"status\": \"completed\",\n * \"percent_complete\": 100\n * }\n * }\n */\nexport const UpdateDataRequestSchema = z.object({\n object: z.string().describe('The object name.'),\n id: z.string().describe('The ID of the record to update.'),\n data: z.record(z.string(), z.unknown()).describe('The fields to update (partial update).'),\n});\n\n/**\n * Update Data Response\n */\nexport const UpdateDataResponseSchema = z.object({\n object: z.string().describe('Object name'),\n id: z.string().describe('Updated record ID'),\n record: z.record(z.string(), z.unknown()).describe('Updated record'),\n});\n\n/**\n * Delete Data Request\n */\nexport const DeleteDataRequestSchema = z.object({\n object: z.string().describe('Object name'),\n id: z.string().describe('Record ID to delete'),\n});\n\n/**\n * Delete Data Response\n */\nexport const DeleteDataResponseSchema = z.object({\n object: z.string().describe('Object name'),\n id: z.string().describe('Deleted record ID'),\n success: z.boolean().describe('Whether deletion succeeded'),\n});\n\n// ==========================================\n// Batch Operations\n// ==========================================\n\n/**\n * Batch Data Request\n */\nexport const BatchDataRequestSchema = z.object({\n object: z.string().describe('Object name'),\n request: BatchUpdateRequestSchema.describe('Batch operation request'),\n});\n\n/**\n * Batch Data Response\n * Uses BatchUpdateResponse from batch.zod.ts\n */\nexport const BatchDataResponseSchema = BatchUpdateResponseSchema;\n\n/**\n * Create Many Data Request\n */\nexport const CreateManyDataRequestSchema = z.object({\n object: z.string().describe('Object name'),\n records: z.array(z.record(z.string(), z.unknown())).describe('Array of records to create'),\n});\n\n/**\n * Create Many Data Response\n */\nexport const CreateManyDataResponseSchema = z.object({\n object: z.string().describe('Object name'),\n records: z.array(z.record(z.string(), z.unknown())).describe('Created records'),\n count: z.number().describe('Number of records created'),\n});\n\n/**\n * Update Many Data Request\n */\nexport const UpdateManyDataRequestSchema = z.object({\n object: z.string().describe('Object name'),\n records: z.array(z.object({\n id: z.string().describe('Record ID'),\n data: z.record(z.string(), z.unknown()).describe('Fields to update'),\n })).describe('Array of updates'),\n options: BatchOptionsSchema.optional().describe('Update options'),\n});\n\n/**\n * Update Many Data Response\n * Uses BatchUpdateResponse for consistency\n */\nexport const UpdateManyDataResponseSchema = BatchUpdateResponseSchema;\n\n/**\n * Delete Many Data Request\n */\nexport const DeleteManyDataRequestSchema = z.object({\n object: z.string().describe('Object name'),\n ids: z.array(z.string()).describe('Array of record IDs to delete'),\n options: BatchOptionsSchema.optional().describe('Delete options'),\n});\n\n/**\n * Delete Many Data Response\n */\nexport const DeleteManyDataResponseSchema = BatchUpdateResponseSchema;\n\n// ==========================================\n// Package Management Operations\n// ==========================================\n\n/**\n * Re-export Package Management Request/Response schemas from kernel.\n * These define the contract for package lifecycle management:\n * - List installed packages (with filters)\n * - Get a specific package by ID\n * - Install a new package (from manifest)\n * - Uninstall a package\n * - Enable/Disable a package\n * \n * Key distinction: Package (ManifestSchema) is the unit of installation.\n * An App (AppSchema) is a UI navigation entity within a package.\n * A package may contain 0, 1, or many apps.\n */\nexport {\n ListPackagesRequestSchema,\n ListPackagesResponseSchema,\n GetPackageRequestSchema,\n GetPackageResponseSchema,\n InstallPackageRequestSchema,\n InstallPackageResponseSchema,\n UninstallPackageRequestSchema,\n UninstallPackageResponseSchema,\n EnablePackageRequestSchema,\n EnablePackageResponseSchema,\n DisablePackageRequestSchema,\n DisablePackageResponseSchema,\n};\n\n// ==========================================\n// View Management Operations\n// ==========================================\n\nexport const ListViewsRequestSchema = z.object({\n object: z.string().describe('Object name (snake_case)'),\n type: z.enum(['list', 'form']).optional().describe('Filter by view type'),\n});\n\nexport const ListViewsResponseSchema = z.object({\n object: z.string().describe('Object name'),\n views: z.array(ViewSchema).describe('Array of view definitions'),\n});\n\nexport const GetViewRequestSchema = z.object({\n object: z.string().describe('Object name (snake_case)'),\n viewId: z.string().describe('View identifier'),\n});\n\nexport const GetViewResponseSchema = z.object({\n object: z.string().describe('Object name'),\n view: ViewSchema.describe('View definition'),\n});\n\nexport const CreateViewRequestSchema = z.object({\n object: z.string().describe('Object name (snake_case)'),\n data: ViewSchema.describe('View definition to create'),\n});\n\nexport const CreateViewResponseSchema = z.object({\n object: z.string().describe('Object name'),\n viewId: z.string().describe('Created view identifier'),\n view: ViewSchema.describe('Created view definition'),\n});\n\nexport const UpdateViewRequestSchema = z.object({\n object: z.string().describe('Object name (snake_case)'),\n viewId: z.string().describe('View identifier'),\n data: ViewSchema.partial().describe('Partial view data to update'),\n});\n\nexport const UpdateViewResponseSchema = z.object({\n object: z.string().describe('Object name'),\n viewId: z.string().describe('Updated view identifier'),\n view: ViewSchema.describe('Updated view definition'),\n});\n\nexport const DeleteViewRequestSchema = z.object({\n object: z.string().describe('Object name (snake_case)'),\n viewId: z.string().describe('View identifier to delete'),\n});\n\nexport const DeleteViewResponseSchema = z.object({\n object: z.string().describe('Object name'),\n viewId: z.string().describe('Deleted view identifier'),\n success: z.boolean().describe('Whether deletion succeeded'),\n});\n\n// ==========================================\n// Permission Operations\n// ==========================================\n\nexport const CheckPermissionRequestSchema = z.object({\n object: z.string().describe('Object name to check permissions for'),\n action: z.enum(['create', 'read', 'edit', 'delete', 'transfer', 'restore', 'purge']).describe('Action to check'),\n recordId: z.string().optional().describe('Specific record ID (for record-level checks)'),\n field: z.string().optional().describe('Specific field name (for field-level checks)'),\n});\n\nexport const CheckPermissionResponseSchema = z.object({\n allowed: z.boolean().describe('Whether the action is permitted'),\n reason: z.string().optional().describe('Reason if denied'),\n});\n\nexport const GetObjectPermissionsRequestSchema = z.object({\n object: z.string().describe('Object name to get permissions for'),\n});\n\nexport const GetObjectPermissionsResponseSchema = z.object({\n object: z.string().describe('Object name'),\n permissions: ObjectPermissionSchema.describe('Object-level permissions'),\n fieldPermissions: z.record(z.string(), FieldPermissionSchema).optional().describe('Field-level permissions keyed by field name'),\n});\n\nexport const GetEffectivePermissionsRequestSchema = z.object({});\n\nexport const GetEffectivePermissionsResponseSchema = z.object({\n objects: z.record(z.string(), ObjectPermissionSchema).describe('Effective object permissions keyed by object name'),\n systemPermissions: z.array(z.string()).describe('Effective system-level permissions'),\n});\n\n// ==========================================\n// Workflow Operations\n// ==========================================\n\nexport const GetWorkflowConfigRequestSchema = z.object({\n object: z.string().describe('Object name to get workflow config for'),\n});\n\nexport const GetWorkflowConfigResponseSchema = z.object({\n object: z.string().describe('Object name'),\n workflows: z.array(WorkflowRuleSchema).describe('Active workflow rules for this object'),\n});\n\nexport const WorkflowStateSchema = z.object({\n currentState: z.string().describe('Current workflow state name'),\n availableTransitions: z.array(z.object({\n name: z.string().describe('Transition name'),\n targetState: z.string().describe('Target state after transition'),\n label: z.string().optional().describe('Display label'),\n requiresApproval: z.boolean().default(false).describe('Whether transition requires approval'),\n })).describe('Available transitions from current state'),\n history: z.array(z.object({\n fromState: z.string().describe('Previous state'),\n toState: z.string().describe('New state'),\n action: z.string().describe('Action that triggered the transition'),\n userId: z.string().describe('User who performed the action'),\n timestamp: z.string().datetime().describe('When the transition occurred'),\n comment: z.string().optional().describe('Optional comment'),\n })).optional().describe('State transition history'),\n});\n\nexport const GetWorkflowStateRequestSchema = z.object({\n object: z.string().describe('Object name'),\n recordId: z.string().describe('Record ID to get workflow state for'),\n});\n\nexport const GetWorkflowStateResponseSchema = z.object({\n object: z.string().describe('Object name'),\n recordId: z.string().describe('Record ID'),\n state: WorkflowStateSchema.describe('Current workflow state and available transitions'),\n});\n\nexport const WorkflowTransitionRequestSchema = z.object({\n object: z.string().describe('Object name'),\n recordId: z.string().describe('Record ID'),\n transition: z.string().describe('Transition name to execute'),\n comment: z.string().optional().describe('Optional comment for the transition'),\n data: z.record(z.string(), z.unknown()).optional().describe('Additional data for the transition'),\n});\n\nexport const WorkflowTransitionResponseSchema = z.object({\n object: z.string().describe('Object name'),\n recordId: z.string().describe('Record ID'),\n success: z.boolean().describe('Whether the transition succeeded'),\n state: WorkflowStateSchema.describe('New workflow state after transition'),\n});\n\nexport const WorkflowApproveRequestSchema = z.object({\n object: z.string().describe('Object name'),\n recordId: z.string().describe('Record ID'),\n comment: z.string().optional().describe('Approval comment'),\n data: z.record(z.string(), z.unknown()).optional().describe('Additional data'),\n});\n\nexport const WorkflowApproveResponseSchema = z.object({\n object: z.string().describe('Object name'),\n recordId: z.string().describe('Record ID'),\n success: z.boolean().describe('Whether the approval succeeded'),\n state: WorkflowStateSchema.describe('New workflow state after approval'),\n});\n\nexport const WorkflowRejectRequestSchema = z.object({\n object: z.string().describe('Object name'),\n recordId: z.string().describe('Record ID'),\n reason: z.string().describe('Rejection reason'),\n comment: z.string().optional().describe('Additional comment'),\n});\n\nexport const WorkflowRejectResponseSchema = z.object({\n object: z.string().describe('Object name'),\n recordId: z.string().describe('Record ID'),\n success: z.boolean().describe('Whether the rejection succeeded'),\n state: WorkflowStateSchema.describe('New workflow state after rejection'),\n});\n\n// ==========================================\n// Realtime Operations\n// ==========================================\n\nexport const RealtimeConnectRequestSchema = z.object({\n transport: TransportProtocol.optional().describe('Preferred transport protocol'),\n channels: z.array(z.string()).optional().describe('Channels to subscribe to on connect'),\n token: z.string().optional().describe('Authentication token'),\n});\n\nexport const RealtimeConnectResponseSchema = z.object({\n connectionId: z.string().describe('Unique connection identifier'),\n transport: TransportProtocol.describe('Negotiated transport protocol'),\n url: z.string().optional().describe('WebSocket/SSE endpoint URL'),\n});\n\nexport const RealtimeDisconnectRequestSchema = z.object({\n connectionId: z.string().optional().describe('Connection ID to disconnect'),\n});\n\nexport const RealtimeDisconnectResponseSchema = z.object({\n success: z.boolean().describe('Whether disconnection succeeded'),\n});\n\nexport const RealtimeSubscribeRequestSchema = z.object({\n channel: z.string().describe('Channel name to subscribe to'),\n events: z.array(z.string()).optional().describe('Specific event types to listen for'),\n filter: z.record(z.string(), z.unknown()).optional().describe('Event filter criteria'),\n});\n\nexport const RealtimeSubscribeResponseSchema = z.object({\n subscriptionId: z.string().describe('Unique subscription identifier'),\n channel: z.string().describe('Subscribed channel name'),\n});\n\nexport const RealtimeUnsubscribeRequestSchema = z.object({\n subscriptionId: z.string().describe('Subscription ID to cancel'),\n});\n\nexport const RealtimeUnsubscribeResponseSchema = z.object({\n success: z.boolean().describe('Whether unsubscription succeeded'),\n});\n\nexport const SetPresenceRequestSchema = z.object({\n channel: z.string().describe('Channel to set presence in'),\n state: RealtimePresenceSchema.describe('Presence state to set'),\n});\n\nexport const SetPresenceResponseSchema = z.object({\n success: z.boolean().describe('Whether presence was set'),\n});\n\nexport const GetPresenceRequestSchema = z.object({\n channel: z.string().describe('Channel to get presence for'),\n});\n\nexport const GetPresenceResponseSchema = z.object({\n channel: z.string().describe('Channel name'),\n members: z.array(RealtimePresenceSchema).describe('Active members and their presence state'),\n});\n\n// ==========================================\n// Notification Operations\n// ==========================================\n\nexport const RegisterDeviceRequestSchema = z.object({\n token: z.string().describe('Device push notification token'),\n platform: z.enum(['ios', 'android', 'web']).describe('Device platform'),\n deviceId: z.string().optional().describe('Unique device identifier'),\n name: z.string().optional().describe('Device friendly name'),\n});\n\nexport const RegisterDeviceResponseSchema = z.object({\n deviceId: z.string().describe('Registered device ID'),\n success: z.boolean().describe('Whether registration succeeded'),\n});\n\nexport const UnregisterDeviceRequestSchema = z.object({\n deviceId: z.string().describe('Device ID to unregister'),\n});\n\nexport const UnregisterDeviceResponseSchema = z.object({\n success: z.boolean().describe('Whether unregistration succeeded'),\n});\n\nexport const NotificationPreferencesSchema = z.object({\n email: z.boolean().default(true).describe('Receive email notifications'),\n push: z.boolean().default(true).describe('Receive push notifications'),\n inApp: z.boolean().default(true).describe('Receive in-app notifications'),\n digest: z.enum(['none', 'daily', 'weekly']).default('none').describe('Email digest frequency'),\n channels: z.record(z.string(), z.object({\n enabled: z.boolean().default(true).describe('Whether this channel is enabled'),\n email: z.boolean().optional().describe('Override email setting'),\n push: z.boolean().optional().describe('Override push setting'),\n })).optional().describe('Per-channel notification preferences'),\n});\n\nexport const GetNotificationPreferencesRequestSchema = z.object({});\n\nexport const GetNotificationPreferencesResponseSchema = z.object({\n preferences: NotificationPreferencesSchema.describe('Current notification preferences'),\n});\n\nexport const UpdateNotificationPreferencesRequestSchema = z.object({\n preferences: NotificationPreferencesSchema.partial().describe('Preferences to update'),\n});\n\nexport const UpdateNotificationPreferencesResponseSchema = z.object({\n preferences: NotificationPreferencesSchema.describe('Updated notification preferences'),\n});\n\nexport const NotificationSchema = z.object({\n id: z.string().describe('Notification ID'),\n type: z.string().describe('Notification type'),\n title: z.string().describe('Notification title'),\n body: z.string().describe('Notification body text'),\n read: z.boolean().default(false).describe('Whether notification has been read'),\n data: z.record(z.string(), z.unknown()).optional().describe('Additional notification data'),\n actionUrl: z.string().optional().describe('URL to navigate to when clicked'),\n createdAt: z.string().datetime().describe('When notification was created'),\n});\n\nexport const ListNotificationsRequestSchema = z.object({\n read: z.boolean().optional().describe('Filter by read status'),\n type: z.string().optional().describe('Filter by notification type'),\n limit: z.number().default(20).describe('Maximum number of notifications to return'),\n cursor: z.string().optional().describe('Pagination cursor'),\n});\n\nexport const ListNotificationsResponseSchema = z.object({\n notifications: z.array(NotificationSchema).describe('List of notifications'),\n unreadCount: z.number().describe('Total number of unread notifications'),\n cursor: z.string().optional().describe('Next page cursor'),\n});\n\nexport const MarkNotificationsReadRequestSchema = z.object({\n ids: z.array(z.string()).describe('Notification IDs to mark as read'),\n});\n\nexport const MarkNotificationsReadResponseSchema = z.object({\n success: z.boolean().describe('Whether the operation succeeded'),\n readCount: z.number().describe('Number of notifications marked as read'),\n});\n\nexport const MarkAllNotificationsReadRequestSchema = z.object({});\n\nexport const MarkAllNotificationsReadResponseSchema = z.object({\n success: z.boolean().describe('Whether the operation succeeded'),\n readCount: z.number().describe('Number of notifications marked as read'),\n});\n\n// ==========================================\n// AI Operations\n// ==========================================\n\nexport const AiNlqRequestSchema = z.object({\n query: z.string().describe('Natural language query string'),\n object: z.string().optional().describe('Target object context'),\n conversationId: z.string().optional().describe('Conversation ID for multi-turn queries'),\n});\n\nexport const AiNlqResponseSchema = z.object({\n query: z.unknown().describe('Generated structured query (AST)'),\n explanation: z.string().optional().describe('Human-readable explanation of the query'),\n confidence: z.number().min(0).max(1).optional().describe('Confidence score (0-1)'),\n suggestions: z.array(z.string()).optional().describe('Suggested follow-up queries'),\n});\n\nexport const AiChatRequestSchema = z.object({\n message: z.string().describe('User message'),\n conversationId: z.string().optional().describe('Conversation ID for context'),\n context: z.record(z.string(), z.unknown()).optional().describe('Additional context data'),\n});\n\nexport const AiChatResponseSchema = z.object({\n message: z.string().describe('Assistant response message'),\n conversationId: z.string().describe('Conversation ID'),\n actions: z.array(z.object({\n type: z.string().describe('Action type'),\n label: z.string().describe('Action display label'),\n data: z.record(z.string(), z.unknown()).optional().describe('Action data'),\n })).optional().describe('Suggested actions'),\n});\n\nexport const AiSuggestRequestSchema = z.object({\n object: z.string().describe('Object name for context'),\n field: z.string().optional().describe('Field to suggest values for'),\n recordId: z.string().optional().describe('Record ID for context'),\n partial: z.string().optional().describe('Partial input for completion'),\n});\n\nexport const AiSuggestResponseSchema = z.object({\n suggestions: z.array(z.object({\n value: z.unknown().describe('Suggested value'),\n label: z.string().describe('Display label'),\n confidence: z.number().min(0).max(1).optional().describe('Confidence score (0-1)'),\n reason: z.string().optional().describe('Reason for this suggestion'),\n })).describe('Suggested values'),\n});\n\nexport const AiInsightsRequestSchema = z.object({\n object: z.string().describe('Object name to analyze'),\n recordId: z.string().optional().describe('Specific record to analyze'),\n type: z.enum(['summary', 'trends', 'anomalies', 'recommendations']).optional().describe('Type of insight'),\n});\n\nexport const AiInsightsResponseSchema = z.object({\n insights: z.array(z.object({\n type: z.string().describe('Insight type'),\n title: z.string().describe('Insight title'),\n description: z.string().describe('Detailed description'),\n confidence: z.number().min(0).max(1).optional().describe('Confidence score (0-1)'),\n data: z.record(z.string(), z.unknown()).optional().describe('Supporting data'),\n })).describe('Generated insights'),\n});\n\n// ==========================================\n// i18n Operations\n// ==========================================\n\nexport const GetLocalesRequestSchema = z.object({});\n\nexport const GetLocalesResponseSchema = z.object({\n locales: z.array(z.object({\n code: z.string().describe('BCP-47 locale code (e.g., en-US, zh-CN)'),\n label: z.string().describe('Display name of the locale'),\n isDefault: z.boolean().default(false).describe('Whether this is the default locale'),\n })).describe('Available locales'),\n});\n\nexport const GetTranslationsRequestSchema = z.object({\n locale: z.string().describe('BCP-47 locale code'),\n namespace: z.string().optional().describe('Translation namespace (e.g., objects, apps, messages)'),\n keys: z.array(z.string()).optional().describe('Specific translation keys to fetch'),\n});\n\nexport const GetTranslationsResponseSchema = z.object({\n locale: z.string().describe('Locale code'),\n translations: TranslationDataSchema.describe('Translation data'),\n});\n\nexport const GetFieldLabelsRequestSchema = z.object({\n object: z.string().describe('Object name'),\n locale: z.string().describe('BCP-47 locale code'),\n});\n\nexport const GetFieldLabelsResponseSchema = z.object({\n object: z.string().describe('Object name'),\n locale: z.string().describe('Locale code'),\n labels: z.record(z.string(), z.object({\n label: z.string().describe('Translated field label'),\n help: z.string().optional().describe('Translated help text'),\n options: z.record(z.string(), z.string()).optional().describe('Translated option labels'),\n })).describe('Field labels keyed by field name'),\n});\n\n// ==========================================\n// Protocol Interface Schema\n// ==========================================\n\n/**\n * ObjectStack Protocol Contract\n * \n * This schema defines the complete API contract as a Zod schema.\n * Unlike the old TypeScript interface, this provides runtime validation\n * and can be used for:\n * - API Gateway validation\n * - RPC call validation\n * - Client SDK generation\n * - API documentation generation\n * \n * Each method is defined with its request and response schemas.\n */\nexport const ObjectStackProtocolSchema = z.object({\n // Discovery & Metadata\n getDiscovery: z.function()\n .describe('Get API discovery information'),\n\n getMetaTypes: z.function()\n .describe('Get available metadata types'),\n\n getMetaItems: z.function()\n .describe('Get all items of a metadata type'),\n\n getMetaItem: z.function()\n .describe('Get a specific metadata item'),\n saveMetaItem: z.function()\n .describe('Save metadata item'),\n getMetaItemCached: z.function()\n .describe('Get a metadata item with cache validation'),\n\n getUiView: z.function()\n .describe('Get UI view definition'),\n\n // Analytics Operations\n analyticsQuery: z.function()\n .describe('Execute analytics query'),\n\n getAnalyticsMeta: z.function()\n .describe('Get analytics metadata (cubes)'),\n\n // Automation Operations\n triggerAutomation: z.function()\n .describe('Trigger an automation flow or script'),\n\n // Package Management Operations\n listPackages: z.function()\n .describe('List installed packages with optional filters'),\n\n getPackage: z.function()\n .describe('Get a specific installed package by ID'),\n\n installPackage: z.function()\n .describe('Install a new package from manifest'),\n\n uninstallPackage: z.function()\n .describe('Uninstall a package by ID'),\n\n enablePackage: z.function()\n .describe('Enable a disabled package'),\n\n disablePackage: z.function()\n .describe('Disable an installed package'),\n\n // Data Operations\n findData: z.function()\n .describe('Find data records'),\n\n getData: z.function()\n .describe('Get single data record'),\n\n createData: z.function()\n .describe('Create a data record'),\n\n updateData: z.function()\n .describe('Update a data record'),\n\n deleteData: z.function()\n .describe('Delete a data record'),\n\n // Batch Operations\n batchData: z.function()\n .describe('Perform batch operations'),\n\n createManyData: z.function()\n .describe('Create multiple records'),\n\n updateManyData: z.function()\n .describe('Update multiple records'),\n\n deleteManyData: z.function()\n .describe('Delete multiple records'),\n\n // View Management Operations\n listViews: z.function()\n .describe('List views for an object'),\n getView: z.function()\n .describe('Get a specific view'),\n createView: z.function()\n .describe('Create a new view'),\n updateView: z.function()\n .describe('Update an existing view'),\n deleteView: z.function()\n .describe('Delete a view'),\n\n // Permission Operations\n checkPermission: z.function()\n .describe('Check if an action is permitted'),\n getObjectPermissions: z.function()\n .describe('Get permissions for an object'),\n getEffectivePermissions: z.function()\n .describe('Get effective permissions for current user'),\n\n // Workflow Operations\n getWorkflowConfig: z.function()\n .describe('Get workflow configuration for an object'),\n getWorkflowState: z.function()\n .describe('Get workflow state for a record'),\n workflowTransition: z.function()\n .describe('Execute a workflow state transition'),\n workflowApprove: z.function()\n .describe('Approve a workflow step'),\n workflowReject: z.function()\n .describe('Reject a workflow step'),\n\n // Realtime Operations\n realtimeConnect: z.function()\n .describe('Establish realtime connection'),\n realtimeDisconnect: z.function()\n .describe('Close realtime connection'),\n realtimeSubscribe: z.function()\n .describe('Subscribe to a realtime channel'),\n realtimeUnsubscribe: z.function()\n .describe('Unsubscribe from a realtime channel'),\n setPresence: z.function()\n .describe('Set user presence state'),\n getPresence: z.function()\n .describe('Get channel presence information'),\n\n // Notification Operations\n registerDevice: z.function()\n .describe('Register a device for push notifications'),\n unregisterDevice: z.function()\n .describe('Unregister a device'),\n getNotificationPreferences: z.function()\n .describe('Get notification preferences'),\n updateNotificationPreferences: z.function()\n .describe('Update notification preferences'),\n listNotifications: z.function()\n .describe('List notifications'),\n markNotificationsRead: z.function()\n .describe('Mark specific notifications as read'),\n markAllNotificationsRead: z.function()\n .describe('Mark all notifications as read'),\n\n // AI Operations\n aiNlq: z.function()\n .describe('Natural language query'),\n aiChat: z.function()\n .describe('AI chat interaction'),\n aiSuggest: z.function()\n .describe('Get AI-powered suggestions'),\n aiInsights: z.function()\n .describe('Get AI-generated insights'),\n\n // i18n Operations\n getLocales: z.function()\n .describe('Get available locales'),\n getTranslations: z.function()\n .describe('Get translations for a locale'),\n getFieldLabels: z.function()\n .describe('Get translated field labels for an object'),\n});\n\n/**\n * TypeScript Types\n * Derived from Zod schemas using z.infer\n */\nexport type GetDiscoveryRequest = z.infer<typeof GetDiscoveryRequestSchema>;\nexport type GetDiscoveryResponse = z.infer<typeof GetDiscoveryResponseSchema>;\nexport type GetMetaTypesRequest = z.infer<typeof GetMetaTypesRequestSchema>;\nexport type GetMetaTypesResponse = z.infer<typeof GetMetaTypesResponseSchema>;\nexport type GetMetaItemsRequest = z.infer<typeof GetMetaItemsRequestSchema>;\nexport type GetMetaItemsResponse = z.infer<typeof GetMetaItemsResponseSchema>;\nexport type GetMetaItemRequest = z.infer<typeof GetMetaItemRequestSchema>;\nexport type GetMetaItemResponse = z.infer<typeof GetMetaItemResponseSchema>;\nexport type SaveMetaItemRequest = z.infer<typeof SaveMetaItemRequestSchema>;\nexport type SaveMetaItemResponse = z.infer<typeof SaveMetaItemResponseSchema>;\nexport type GetMetaItemCachedRequest = z.infer<typeof GetMetaItemCachedRequestSchema>;\nexport type GetMetaItemCachedResponse = z.infer<typeof GetMetaItemCachedResponseSchema>;\nexport type GetUiViewRequest = z.infer<typeof GetUiViewRequestSchema>;\nexport type GetUiViewResponse = z.infer<typeof GetUiViewResponseSchema>;\n\nexport type AnalyticsQueryRequest = z.infer<typeof AnalyticsQueryRequestSchema>;\nexport type AnalyticsResultResponse = z.infer<typeof AnalyticsResultResponseSchema>;\nexport type GetAnalyticsMetaRequest = z.infer<typeof GetAnalyticsMetaRequestSchema>;\nexport type GetAnalyticsMetaResponse = z.infer<typeof AnalyticsMetadataResponseSchema>;\n\nexport type AutomationTriggerRequest = z.infer<typeof AutomationTriggerRequestSchema>;\nexport type AutomationTriggerResponse = z.infer<typeof AutomationTriggerResponseSchema>;\n\nexport type FindDataRequest = z.input<typeof FindDataRequestSchema>;\nexport type FindDataResponse = z.infer<typeof FindDataResponseSchema>;\nexport type GetDataRequest = z.input<typeof GetDataRequestSchema>;\nexport type GetDataResponse = z.infer<typeof GetDataResponseSchema>;\nexport type CreateDataRequest = z.input<typeof CreateDataRequestSchema>;\nexport type CreateDataResponse = z.infer<typeof CreateDataResponseSchema>;\nexport type UpdateDataRequest = z.input<typeof UpdateDataRequestSchema>;\nexport type UpdateDataResponse = z.infer<typeof UpdateDataResponseSchema>;\nexport type DeleteDataRequest = z.input<typeof DeleteDataRequestSchema>;\nexport type DeleteDataResponse = z.infer<typeof DeleteDataResponseSchema>;\n\nexport type BatchDataRequest = z.input<typeof BatchDataRequestSchema>;\nexport type BatchDataResponse = z.infer<typeof BatchDataResponseSchema>;\nexport type CreateManyDataRequest = z.input<typeof CreateManyDataRequestSchema>;\nexport type CreateManyDataResponse = z.infer<typeof CreateManyDataResponseSchema>;\nexport type UpdateManyDataRequest = z.input<typeof UpdateManyDataRequestSchema>;\nexport type UpdateManyDataResponse = z.infer<typeof UpdateManyDataResponseSchema>;\nexport type DeleteManyDataRequest = z.input<typeof DeleteManyDataRequestSchema>;\nexport type DeleteManyDataResponse = z.infer<typeof DeleteManyDataResponseSchema>;\n\n// View Management Types\nexport type ListViewsRequest = z.input<typeof ListViewsRequestSchema>;\nexport type ListViewsResponse = z.infer<typeof ListViewsResponseSchema>;\nexport type GetViewRequest = z.input<typeof GetViewRequestSchema>;\nexport type GetViewResponse = z.infer<typeof GetViewResponseSchema>;\nexport type CreateViewRequest = z.input<typeof CreateViewRequestSchema>;\nexport type CreateViewResponse = z.infer<typeof CreateViewResponseSchema>;\nexport type UpdateViewRequest = z.input<typeof UpdateViewRequestSchema>;\nexport type UpdateViewResponse = z.infer<typeof UpdateViewResponseSchema>;\nexport type DeleteViewRequest = z.input<typeof DeleteViewRequestSchema>;\nexport type DeleteViewResponse = z.infer<typeof DeleteViewResponseSchema>;\n\n// Permission Types\nexport type CheckPermissionRequest = z.input<typeof CheckPermissionRequestSchema>;\nexport type CheckPermissionResponse = z.infer<typeof CheckPermissionResponseSchema>;\nexport type GetObjectPermissionsRequest = z.input<typeof GetObjectPermissionsRequestSchema>;\nexport type GetObjectPermissionsResponse = z.infer<typeof GetObjectPermissionsResponseSchema>;\nexport type GetEffectivePermissionsRequest = z.input<typeof GetEffectivePermissionsRequestSchema>;\nexport type GetEffectivePermissionsResponse = z.infer<typeof GetEffectivePermissionsResponseSchema>;\n\n// Workflow Types\nexport type GetWorkflowConfigRequest = z.input<typeof GetWorkflowConfigRequestSchema>;\nexport type GetWorkflowConfigResponse = z.infer<typeof GetWorkflowConfigResponseSchema>;\nexport type WorkflowState = z.infer<typeof WorkflowStateSchema>;\nexport type GetWorkflowStateRequest = z.input<typeof GetWorkflowStateRequestSchema>;\nexport type GetWorkflowStateResponse = z.infer<typeof GetWorkflowStateResponseSchema>;\nexport type WorkflowTransitionRequest = z.input<typeof WorkflowTransitionRequestSchema>;\nexport type WorkflowTransitionResponse = z.infer<typeof WorkflowTransitionResponseSchema>;\nexport type WorkflowApproveRequest = z.input<typeof WorkflowApproveRequestSchema>;\nexport type WorkflowApproveResponse = z.infer<typeof WorkflowApproveResponseSchema>;\nexport type WorkflowRejectRequest = z.input<typeof WorkflowRejectRequestSchema>;\nexport type WorkflowRejectResponse = z.infer<typeof WorkflowRejectResponseSchema>;\n\n// Realtime Types\nexport type RealtimeConnectRequest = z.input<typeof RealtimeConnectRequestSchema>;\nexport type RealtimeConnectResponse = z.infer<typeof RealtimeConnectResponseSchema>;\nexport type RealtimeDisconnectRequest = z.input<typeof RealtimeDisconnectRequestSchema>;\nexport type RealtimeDisconnectResponse = z.infer<typeof RealtimeDisconnectResponseSchema>;\nexport type RealtimeSubscribeRequest = z.input<typeof RealtimeSubscribeRequestSchema>;\nexport type RealtimeSubscribeResponse = z.infer<typeof RealtimeSubscribeResponseSchema>;\nexport type RealtimeUnsubscribeRequest = z.input<typeof RealtimeUnsubscribeRequestSchema>;\nexport type RealtimeUnsubscribeResponse = z.infer<typeof RealtimeUnsubscribeResponseSchema>;\nexport type SetPresenceRequest = z.input<typeof SetPresenceRequestSchema>;\nexport type SetPresenceResponse = z.infer<typeof SetPresenceResponseSchema>;\nexport type GetPresenceRequest = z.input<typeof GetPresenceRequestSchema>;\nexport type GetPresenceResponse = z.infer<typeof GetPresenceResponseSchema>;\n\n// Notification Types\nexport type RegisterDeviceRequest = z.input<typeof RegisterDeviceRequestSchema>;\nexport type RegisterDeviceResponse = z.infer<typeof RegisterDeviceResponseSchema>;\nexport type UnregisterDeviceRequest = z.input<typeof UnregisterDeviceRequestSchema>;\nexport type UnregisterDeviceResponse = z.infer<typeof UnregisterDeviceResponseSchema>;\nexport type NotificationPreferences = z.infer<typeof NotificationPreferencesSchema>;\nexport type NotificationPreferencesInput = z.input<typeof NotificationPreferencesSchema>;\nexport type GetNotificationPreferencesRequest = z.input<typeof GetNotificationPreferencesRequestSchema>;\nexport type GetNotificationPreferencesResponse = z.infer<typeof GetNotificationPreferencesResponseSchema>;\nexport type UpdateNotificationPreferencesRequest = z.input<typeof UpdateNotificationPreferencesRequestSchema>;\nexport type UpdateNotificationPreferencesResponse = z.infer<typeof UpdateNotificationPreferencesResponseSchema>;\nexport type Notification = z.infer<typeof NotificationSchema>;\nexport type NotificationInput = z.input<typeof NotificationSchema>;\nexport type ListNotificationsRequest = z.input<typeof ListNotificationsRequestSchema>;\nexport type ListNotificationsResponse = z.infer<typeof ListNotificationsResponseSchema>;\nexport type MarkNotificationsReadRequest = z.input<typeof MarkNotificationsReadRequestSchema>;\nexport type MarkNotificationsReadResponse = z.infer<typeof MarkNotificationsReadResponseSchema>;\nexport type MarkAllNotificationsReadRequest = z.input<typeof MarkAllNotificationsReadRequestSchema>;\nexport type MarkAllNotificationsReadResponse = z.infer<typeof MarkAllNotificationsReadResponseSchema>;\n\n// AI Types\nexport type AiNlqRequest = z.input<typeof AiNlqRequestSchema>;\nexport type AiNlqResponse = z.infer<typeof AiNlqResponseSchema>;\nexport type AiChatRequest = z.input<typeof AiChatRequestSchema>;\nexport type AiChatResponse = z.infer<typeof AiChatResponseSchema>;\nexport type AiSuggestRequest = z.input<typeof AiSuggestRequestSchema>;\nexport type AiSuggestResponse = z.infer<typeof AiSuggestResponseSchema>;\nexport type AiInsightsRequest = z.input<typeof AiInsightsRequestSchema>;\nexport type AiInsightsResponse = z.infer<typeof AiInsightsResponseSchema>;\n\n// i18n Types\nexport type GetLocalesRequest = z.input<typeof GetLocalesRequestSchema>;\nexport type GetLocalesResponse = z.infer<typeof GetLocalesResponseSchema>;\nexport type GetTranslationsRequest = z.input<typeof GetTranslationsRequestSchema>;\nexport type GetTranslationsResponse = z.infer<typeof GetTranslationsResponseSchema>;\nexport type GetFieldLabelsRequest = z.input<typeof GetFieldLabelsRequestSchema>;\nexport type GetFieldLabelsResponse = z.infer<typeof GetFieldLabelsResponseSchema>;\n\n// Package Management Types (re-exported from kernel for convenience)\nexport type { \n ListPackagesRequest,\n ListPackagesResponse,\n GetPackageRequest,\n GetPackageResponse,\n InstallPackageRequest,\n InstallPackageResponse,\n UninstallPackageRequest,\n UninstallPackageResponse,\n EnablePackageRequest,\n EnablePackageResponse,\n DisablePackageRequest,\n DisablePackageResponse,\n InstalledPackage,\n PackageStatus,\n};\n\n/**\n * Zod-inferred protocol type (for runtime validation only).\n * Use ObjectStackProtocol interface for implementation contracts.\n */\nexport type ObjectStackProtocolZod = z.infer<typeof ObjectStackProtocolSchema>;\n\n/**\n * ObjectStack Protocol Interface\n * \n * Properly typed interface for implementing the ObjectStack API protocol.\n * The Zod schema (ObjectStackProtocolSchema) is used for runtime validation,\n * while this interface provides compile-time type safety for implementations.\n */\nexport interface ObjectStackProtocol {\n // Discovery & Metadata (core)\n getDiscovery(request?: GetDiscoveryRequest): Promise<GetDiscoveryResponse>;\n getMetaTypes(request?: GetMetaTypesRequest): Promise<GetMetaTypesResponse>;\n getMetaItems(request: GetMetaItemsRequest): Promise<GetMetaItemsResponse>;\n getMetaItem(request: GetMetaItemRequest): Promise<GetMetaItemResponse>;\n saveMetaItem(request: SaveMetaItemRequest): Promise<SaveMetaItemResponse>;\n getMetaItemCached?(request: GetMetaItemCachedRequest): Promise<GetMetaItemCachedResponse>;\n getUiView?(request: GetUiViewRequest): Promise<GetUiViewResponse>;\n \n // Analytics (optional)\n analyticsQuery?(request: AnalyticsQueryRequest): Promise<AnalyticsResultResponse>;\n getAnalyticsMeta?(request: GetAnalyticsMetaRequest): Promise<GetAnalyticsMetaResponse>;\n\n // Automation (optional)\n triggerAutomation?(request: AutomationTriggerRequest): Promise<AutomationTriggerResponse>;\n\n // Package Management (optional)\n listPackages?(request: ListPackagesRequest): Promise<ListPackagesResponse>;\n getPackage?(request: GetPackageRequest): Promise<GetPackageResponse>;\n installPackage?(request: InstallPackageRequest): Promise<InstallPackageResponse>;\n uninstallPackage?(request: UninstallPackageRequest): Promise<UninstallPackageResponse>;\n enablePackage?(request: EnablePackageRequest): Promise<EnablePackageResponse>;\n disablePackage?(request: DisablePackageRequest): Promise<DisablePackageResponse>;\n\n // Data Operations (core)\n findData(request: FindDataRequest): Promise<FindDataResponse>;\n getData(request: GetDataRequest): Promise<GetDataResponse>;\n createData(request: CreateDataRequest): Promise<CreateDataResponse>;\n updateData(request: UpdateDataRequest): Promise<UpdateDataResponse>;\n deleteData(request: DeleteDataRequest): Promise<DeleteDataResponse>;\n \n // Batch Operations (optional)\n batchData?(request: BatchDataRequest): Promise<BatchDataResponse>;\n createManyData?(request: CreateManyDataRequest): Promise<CreateManyDataResponse>;\n updateManyData?(request: UpdateManyDataRequest): Promise<UpdateManyDataResponse>;\n deleteManyData?(request: DeleteManyDataRequest): Promise<DeleteManyDataResponse>;\n\n // View Management (optional)\n listViews?(request: ListViewsRequest): Promise<ListViewsResponse>;\n getView?(request: GetViewRequest): Promise<GetViewResponse>;\n createView?(request: CreateViewRequest): Promise<CreateViewResponse>;\n updateView?(request: UpdateViewRequest): Promise<UpdateViewResponse>;\n deleteView?(request: DeleteViewRequest): Promise<DeleteViewResponse>;\n\n // Permissions (optional)\n checkPermission?(request: CheckPermissionRequest): Promise<CheckPermissionResponse>;\n getObjectPermissions?(request: GetObjectPermissionsRequest): Promise<GetObjectPermissionsResponse>;\n getEffectivePermissions?(request: GetEffectivePermissionsRequest): Promise<GetEffectivePermissionsResponse>;\n\n // Workflows (optional)\n getWorkflowConfig?(request: GetWorkflowConfigRequest): Promise<GetWorkflowConfigResponse>;\n getWorkflowState?(request: GetWorkflowStateRequest): Promise<GetWorkflowStateResponse>;\n workflowTransition?(request: WorkflowTransitionRequest): Promise<WorkflowTransitionResponse>;\n workflowApprove?(request: WorkflowApproveRequest): Promise<WorkflowApproveResponse>;\n workflowReject?(request: WorkflowRejectRequest): Promise<WorkflowRejectResponse>;\n\n // Realtime (optional)\n realtimeConnect?(request: RealtimeConnectRequest): Promise<RealtimeConnectResponse>;\n realtimeDisconnect?(request: RealtimeDisconnectRequest): Promise<RealtimeDisconnectResponse>;\n realtimeSubscribe?(request: RealtimeSubscribeRequest): Promise<RealtimeSubscribeResponse>;\n realtimeUnsubscribe?(request: RealtimeUnsubscribeRequest): Promise<RealtimeUnsubscribeResponse>;\n setPresence?(request: SetPresenceRequest): Promise<SetPresenceResponse>;\n getPresence?(request: GetPresenceRequest): Promise<GetPresenceResponse>;\n\n // Notifications (optional)\n registerDevice?(request: RegisterDeviceRequest): Promise<RegisterDeviceResponse>;\n unregisterDevice?(request: UnregisterDeviceRequest): Promise<UnregisterDeviceResponse>;\n getNotificationPreferences?(request: GetNotificationPreferencesRequest): Promise<GetNotificationPreferencesResponse>;\n updateNotificationPreferences?(request: UpdateNotificationPreferencesRequest): Promise<UpdateNotificationPreferencesResponse>;\n listNotifications?(request: ListNotificationsRequest): Promise<ListNotificationsResponse>;\n markNotificationsRead?(request: MarkNotificationsReadRequest): Promise<MarkNotificationsReadResponse>;\n markAllNotificationsRead?(request: MarkAllNotificationsReadRequest): Promise<MarkAllNotificationsReadResponse>;\n\n // AI (optional)\n aiNlq?(request: AiNlqRequest): Promise<AiNlqResponse>;\n aiChat?(request: AiChatRequest): Promise<AiChatResponse>;\n aiSuggest?(request: AiSuggestRequest): Promise<AiSuggestResponse>;\n aiInsights?(request: AiInsightsRequest): Promise<AiInsightsResponse>;\n\n // i18n (optional)\n getLocales?(request: GetLocalesRequest): Promise<GetLocalesResponse>;\n getTranslations?(request: GetTranslationsRequest): Promise<GetTranslationsResponse>;\n getFieldLabels?(request: GetFieldLabelsRequest): Promise<GetFieldLabelsResponse>;\n}\n","// Copyright (c) 2025 ObjectStack. Licensed under the Apache-2.0 license.\n\nimport { z } from 'zod';\nimport { SnakeCaseIdentifierSchema } from '../shared/identifiers.zod';\nimport { I18nLabelSchema, AriaPropsSchema } from './i18n.zod';\n\n/**\n * HTTP Method Enum\n */\nexport const HttpMethodSchema = z.enum(['GET', 'POST', 'PUT', 'PATCH', 'DELETE']);\n\n/**\n * HTTP Request Configuration for API Provider\n */\nexport const HttpRequestSchema = z.object({\n url: z.string().describe('API endpoint URL'),\n method: HttpMethodSchema.optional().default('GET').describe('HTTP method'),\n headers: z.record(z.string(), z.string()).optional().describe('Custom HTTP headers'),\n params: z.record(z.string(), z.unknown()).optional().describe('Query parameters'),\n body: z.unknown().optional().describe('Request body for POST/PUT/PATCH'),\n});\n\n/**\n * View Data Source Configuration\n * Supports three modes:\n * 1. 'object': Standard Protocol - Auto-connects to ObjectStack Metadata and Data APIs\n * 2. 'api': Custom API - Explicitly provided API URLs\n * 3. 'value': Static Data - Hardcoded data array\n */\nexport const ViewDataSchema = z.discriminatedUnion('provider', [\n z.object({\n provider: z.literal('object'),\n object: z.string().describe('Target object name'),\n }),\n z.object({\n provider: z.literal('api'),\n read: HttpRequestSchema.optional().describe('Configuration for fetching data'),\n write: HttpRequestSchema.optional().describe('Configuration for submitting data (for forms/editable tables)'),\n }),\n z.object({\n provider: z.literal('value'),\n items: z.array(z.unknown()).describe('Static data array'),\n }),\n]);\n\n/**\n * Column Summary Function Schema\n * Aggregation function for column footer (Airtable-style column summaries)\n */\nexport const ColumnSummarySchema = z.enum([\n 'none',\n 'count',\n 'count_empty',\n 'count_filled',\n 'count_unique',\n 'percent_empty',\n 'percent_filled',\n 'sum',\n 'avg',\n 'min',\n 'max',\n]).describe('Aggregation function for column footer summary');\n\n/**\n * List Column Configuration Schema\n * Detailed configuration for individual list view columns\n */\nexport const ListColumnSchema = z.object({\n field: z.string().describe('Field name (snake_case)'),\n label: I18nLabelSchema.optional().describe('Display label override'),\n width: z.number().positive().optional().describe('Column width in pixels'),\n align: z.enum(['left', 'center', 'right']).optional().describe('Text alignment'),\n hidden: z.boolean().optional().describe('Hide column by default'),\n sortable: z.boolean().optional().describe('Allow sorting by this column'),\n resizable: z.boolean().optional().describe('Allow resizing this column'),\n wrap: z.boolean().optional().describe('Allow text wrapping'),\n type: z.string().optional().describe('Renderer type override (e.g., \"currency\", \"date\")'),\n\n /** Pinning (Airtable-style frozen columns) */\n pinned: z.enum(['left', 'right']).optional().describe('Pin/freeze column to left or right side'),\n\n /** Column Footer Summary (Airtable-style aggregation) */\n summary: ColumnSummarySchema.optional().describe('Footer aggregation function for this column'),\n\n /** Interaction */\n link: z.boolean().optional().describe('Functions as the primary navigation link (triggers View navigation)'),\n action: z.string().optional().describe('Registered Action ID to execute when clicked'),\n});\n\n/**\n * List View Selection Configuration\n */\nexport const SelectionConfigSchema = z.object({\n type: z.enum(['none', 'single', 'multiple']).default('none').describe('Selection mode'),\n});\n\n/**\n * List View Pagination Configuration\n */\nexport const PaginationConfigSchema = z.object({\n pageSize: z.number().int().positive().default(25).describe('Number of records per page'),\n pageSizeOptions: z.array(z.number().int().positive()).optional().describe('Available page size options'),\n});\n\n/**\n * Row Height / Density Schema (Airtable-style)\n * Controls the visual density of rows in a list view.\n */\nexport const RowHeightSchema = z.enum([\n 'compact', // Minimal padding, single line\n 'short', // Reduced padding\n 'medium', // Default padding\n 'tall', // Extra padding, multi-line preview\n 'extra_tall', // Maximum padding, rich content preview\n]).describe('Row height / density setting for list view');\n\n/**\n * Grouping Field Configuration\n * Defines a single grouping level for record grouping.\n */\nexport const GroupingFieldSchema = z.object({\n field: z.string().describe('Field name to group by'),\n order: z.enum(['asc', 'desc']).default('asc').describe('Group sort order'),\n collapsed: z.boolean().default(false).describe('Collapse groups by default'),\n});\n\n/**\n * Grouping Configuration Schema (Airtable-style)\n * Supports multi-level grouping for grid/gallery views.\n */\nexport const GroupingConfigSchema = z.object({\n fields: z.array(GroupingFieldSchema).min(1).describe('Fields to group by (supports up to 3 levels)'),\n}).describe('Record grouping configuration');\n\n/**\n * Gallery View Configuration (Airtable-style)\n * Configures card layout for gallery/card views.\n */\nexport const GalleryConfigSchema = z.object({\n coverField: z.string().optional().describe('Attachment/image field to display as card cover'),\n coverFit: z.enum(['cover', 'contain']).default('cover').describe('Image fit mode for card cover'),\n cardSize: z.enum(['small', 'medium', 'large']).default('medium').describe('Card size in gallery view'),\n titleField: z.string().optional().describe('Field to display as card title'),\n visibleFields: z.array(z.string()).optional().describe('Fields to display on card body'),\n}).describe('Gallery/card view configuration');\n\n/**\n * Timeline View Configuration (Airtable-style)\n * Configures timeline/chronological views.\n */\nexport const TimelineConfigSchema = z.object({\n startDateField: z.string().describe('Field for timeline item start date'),\n endDateField: z.string().optional().describe('Field for timeline item end date'),\n titleField: z.string().describe('Field to display as timeline item title'),\n groupByField: z.string().optional().describe('Field to group timeline rows'),\n colorField: z.string().optional().describe('Field to determine item color'),\n scale: z.enum(['hour', 'day', 'week', 'month', 'quarter', 'year']).default('week').describe('Default timeline scale'),\n}).describe('Timeline view configuration');\n\n/**\n * View Sharing Configuration (Airtable-style)\n * Defines who can see and modify a view.\n */\nexport const ViewSharingSchema = z.object({\n type: z.enum(['personal', 'collaborative']).default('collaborative').describe('View ownership type'),\n lockedBy: z.string().optional().describe('User who locked the view configuration'),\n}).describe('View sharing and access configuration');\n\n/**\n * Row Color Configuration (Airtable-style)\n * Defines how rows are colored based on field values.\n */\nexport const RowColorConfigSchema = z.object({\n field: z.string().describe('Field to derive color from (typically a select/status field)'),\n colors: z.record(z.string(), z.string()).optional().describe('Map of field value to color (hex/token)'),\n}).describe('Row color configuration based on field values');\n\n/**\n * Kanban Settings\n */\nexport const KanbanConfigSchema = z.object({\n groupByField: z.string().describe('Field to group columns by (usually status/select)'),\n summarizeField: z.string().optional().describe('Field to sum at top of column (e.g. amount)'),\n columns: z.array(z.string()).describe('Fields to show on cards'),\n});\n\n/**\n * Calendar Settings\n */\nexport const CalendarConfigSchema = z.object({\n startDateField: z.string(),\n endDateField: z.string().optional(),\n titleField: z.string(),\n colorField: z.string().optional(),\n});\n\n/**\n * Gantt Settings\n */\nexport const GanttConfigSchema = z.object({\n startDateField: z.string(),\n endDateField: z.string(),\n titleField: z.string(),\n progressField: z.string().optional(),\n dependenciesField: z.string().optional(),\n});\n\n/**\n * Navigation Mode Enum\n * Defines how to navigate to the detail view from a list item.\n */\nexport const NavigationModeSchema = z.enum([\n 'page', // Navigate to a new route (default)\n 'drawer', // Open details in a side drawer/panel\n 'modal', // Open details in a modal dialog\n 'split', // Show details side-by-side with the list (master-detail)\n 'popover', // Show details in a popover (lightweight)\n 'new_window', // Open in new browser tab/window\n 'none' // No navigation (read-only list)\n]);\n\n/**\n * Navigation Configuration Schema\n */\nexport const NavigationConfigSchema = z.object({\n mode: NavigationModeSchema.default('page'),\n \n /** Target View Config */\n view: z.string().optional().describe('Name of the form view to use for details (e.g. \"summary_view\", \"edit_form\")'),\n \n /** Interaction Triggers */\n preventNavigation: z.boolean().default(false).describe('Disable standard navigation entirely'),\n openNewTab: z.boolean().default(false).describe('Force open in new tab (applies to page mode)'),\n \n /** Dimensions (for modal/drawer) */\n width: z.union([z.string(), z.number()]).optional().describe('Width of the drawer/modal (e.g. \"600px\", \"50%\")'),\n});\n\n/**\n * List View Schema (Expanded)\n * Defines how a collection of records is displayed to the user.\n * \n * **NAMING CONVENTION:**\n * View names (when provided) are machine identifiers and must be lowercase snake_case.\n * \n * @example Standard Grid\n * {\n * name: \"all_active\",\n * label: \"All Active\",\n * type: \"grid\",\n * columns: [\"name\", \"status\", \"created_at\"],\n * filter: [[\"status\", \"=\", \"active\"]]\n * }\n * \n * @example Kanban Board\n * {\n * type: \"kanban\",\n * columns: [\"name\", \"amount\"],\n * kanban: {\n * groupByField: \"stage\",\n * summarizeField: \"amount\",\n * columns: [\"name\", \"close_date\"]\n * }\n * }\n */\nexport const ListViewSchema = z.object({\n name: SnakeCaseIdentifierSchema.optional().describe('Internal view name (lowercase snake_case)'),\n label: I18nLabelSchema.optional(), // Display label override (supports i18n)\n type: z.enum([\n 'grid', // Standard Data Table\n 'kanban', // Board / Columns\n 'gallery', // Card Deck / Masonry\n 'calendar', // Monthly/Weekly/Daily\n 'timeline', // Chronological Stream (Feed)\n 'gantt', // Project Timeline\n 'map' // Geospatial\n ]).default('grid'),\n \n /** Data Source Configuration */\n data: ViewDataSchema.optional().describe('Data source configuration (defaults to \"object\" provider)'),\n \n /** Shared Query Config */\n columns: z.union([\n z.array(z.string()), // Legacy: simple field names\n z.array(ListColumnSchema), // Enhanced: detailed column config\n ]).describe('Fields to display as columns'),\n filter: z.array(z.unknown()).optional().describe('Filter criteria (JSON Rules)'),\n sort: z.union([\n z.string(), //Legacy \"field desc\"\n z.array(z.object({\n field: z.string(),\n order: z.enum(['asc', 'desc'])\n }))\n ]).optional(),\n \n /** Search & Filter */\n searchableFields: z.array(z.string()).optional().describe('Fields enabled for search'),\n filterableFields: z.array(z.string()).optional().describe('Fields enabled for end-user filtering in the top bar'),\n\n /** Grid Features */\n resizable: z.boolean().optional().describe('Enable column resizing'),\n striped: z.boolean().optional().describe('Striped row styling'),\n bordered: z.boolean().optional().describe('Show borders'),\n\n /** Selection */\n selection: SelectionConfigSchema.optional().describe('Row selection configuration'),\n\n /** Navigation / Interaction */\n navigation: NavigationConfigSchema.optional().describe('Configuration for item click navigation (page, drawer, modal, etc.)'),\n\n /** Pagination */\n pagination: PaginationConfigSchema.optional().describe('Pagination configuration'),\n\n /** Type Specific Config */\n kanban: KanbanConfigSchema.optional(),\n calendar: CalendarConfigSchema.optional(),\n gantt: GanttConfigSchema.optional(),\n gallery: GalleryConfigSchema.optional(),\n timeline: TimelineConfigSchema.optional(),\n\n /** View Metadata (Airtable-style view management) */\n description: I18nLabelSchema.optional().describe('View description for documentation/tooltips'),\n sharing: ViewSharingSchema.optional().describe('View sharing and access configuration'),\n\n /** Row Height / Density (Airtable-style) */\n rowHeight: RowHeightSchema.optional().describe('Row height / density setting'),\n\n /** Record Grouping (Airtable-style) */\n grouping: GroupingConfigSchema.optional().describe('Group records by one or more fields'),\n\n /** Row Color (Airtable-style) */\n rowColor: RowColorConfigSchema.optional().describe('Color rows based on field value'),\n\n /** Field Visibility & Ordering per View (Airtable-style) */\n hiddenFields: z.array(z.string()).optional().describe('Fields to hide in this specific view'),\n fieldOrder: z.array(z.string()).optional().describe('Explicit field display order for this view'),\n\n /** Row & Bulk Actions */\n rowActions: z.array(z.string()).optional().describe('Actions available for individual row items'),\n bulkActions: z.array(z.string()).optional().describe('Actions available when multiple rows are selected'),\n\n /** Performance */\n virtualScroll: z.boolean().optional().describe('Enable virtual scrolling for large datasets'),\n\n /** Conditional Formatting */\n conditionalFormatting: z.array(z.object({\n condition: z.string().describe('Condition expression to evaluate'),\n style: z.record(z.string(), z.string()).describe('CSS styles to apply when condition is true'),\n })).optional().describe('Conditional formatting rules for list rows'),\n\n /** Inline Edit */\n inlineEdit: z.boolean().optional().describe('Allow inline editing of records directly in the list view'),\n\n /** Export */\n exportOptions: z.array(z.enum(['csv', 'xlsx', 'pdf', 'json'])).optional().describe('Available export format options'),\n\n /** Empty State */\n emptyState: z.object({\n title: I18nLabelSchema.optional(),\n message: I18nLabelSchema.optional(),\n icon: z.string().optional(),\n }).optional().describe('Empty state configuration when no records found'),\n\n /** ARIA accessibility attributes */\n aria: AriaPropsSchema.optional().describe('ARIA accessibility attributes for the list view'),\n});\n\n/**\n * Form Field Configuration Schema\n * Detailed configuration for individual form fields\n */\nexport const FormFieldSchema = z.object({\n field: z.string().describe('Field name (snake_case)'),\n label: I18nLabelSchema.optional().describe('Display label override'),\n placeholder: I18nLabelSchema.optional().describe('Placeholder text'),\n helpText: I18nLabelSchema.optional().describe('Help/hint text'),\n readonly: z.boolean().optional().describe('Read-only override'),\n required: z.boolean().optional().describe('Required override'),\n hidden: z.boolean().optional().describe('Hidden override'),\n colSpan: z.number().int().min(1).max(4).optional().describe('Column span in grid layout (1-4)'),\n widget: z.string().optional().describe('Custom widget/component name'),\n dependsOn: z.string().optional().describe('Parent field name for cascading'),\n visibleOn: z.string().optional().describe('Visibility condition expression'),\n});\n\n/**\n * Form Layout Section\n */\nexport const FormSectionSchema = z.object({\n label: I18nLabelSchema.optional(),\n collapsible: z.boolean().default(false),\n collapsed: z.boolean().default(false),\n columns: z.enum(['1', '2', '3', '4']).default('2').transform(val => parseInt(val) as 1 | 2 | 3 | 4),\n fields: z.array(z.union([\n z.string(), // Legacy: simple field name\n FormFieldSchema, // Enhanced: detailed field config\n ])),\n});\n\n/**\n * Form View Schema\n * Defines the layout for creating or editing a single record.\n * \n * @example Simple Sectioned Form\n * {\n * type: \"simple\",\n * sections: [\n * {\n * label: \"General Info\",\n * columns: 2,\n * fields: [\"name\", \"status\"]\n * },\n * {\n * label: \"Details\",\n * fields: [\"description\", { field: \"priority\", widget: \"rating\" }]\n * }\n * ]\n * }\n */\nexport const FormViewSchema = z.object({\n type: z.enum([\n 'simple', // Single column or sections\n 'tabbed', // Tabs\n 'wizard', // Step by step\n 'split', // Master-Detail split\n 'drawer', // Side panel\n 'modal' // Dialog\n ]).default('simple'),\n \n /** Data Source Configuration */\n data: ViewDataSchema.optional().describe('Data source configuration (defaults to \"object\" provider)'),\n \n sections: z.array(FormSectionSchema).optional(), // For simple layout\n groups: z.array(FormSectionSchema).optional(), // Legacy support -> alias to sections\n\n /** ARIA accessibility attributes */\n aria: AriaPropsSchema.optional().describe('ARIA accessibility attributes for the form view'),\n});\n\n/**\n * Master View Schema\n * Can define multiple named views.\n */\n/**\n * View Container Schema\n * Aggregates all view definitions for a specific object or context.\n * \n * @example\n * {\n * list: { type: \"grid\", columns: [\"name\"] },\n * form: { type: \"simple\", fields: [\"name\"] },\n * listViews: {\n * \"all\": { label: \"All\", filter: [] },\n * \"my\": { label: \"Mine\", filter: [[\"owner\", \"=\", \"{user_id}\"]] }\n * }\n * }\n */\nexport const ViewSchema = z.object({\n list: ListViewSchema.optional(), // Default list view\n form: FormViewSchema.optional(), // Default form view\n listViews: z.record(z.string(), ListViewSchema).optional().describe('Additional named list views'),\n formViews: z.record(z.string(), FormViewSchema).optional().describe('Additional named form views'),\n});\n\nexport type View = z.infer<typeof ViewSchema>;\nexport type ListView = z.infer<typeof ListViewSchema>;\nexport type FormView = z.infer<typeof FormViewSchema>;\nexport type FormSection = z.infer<typeof FormSectionSchema>;\nexport type ListColumn = z.infer<typeof ListColumnSchema>;\nexport type FormField = z.infer<typeof FormFieldSchema>;\nexport type SelectionConfig = z.infer<typeof SelectionConfigSchema>;\nexport type NavigationConfig = z.infer<typeof NavigationConfigSchema>;\nexport type PaginationConfig = z.infer<typeof PaginationConfigSchema>;\nexport type ViewData = z.infer<typeof ViewDataSchema>;\nexport type HttpRequest = z.infer<typeof HttpRequestSchema>;\nexport type HttpMethod = z.infer<typeof HttpMethodSchema>;\nexport type ColumnSummary = z.infer<typeof ColumnSummarySchema>;\nexport type RowHeight = z.infer<typeof RowHeightSchema>;\nexport type GroupingConfig = z.infer<typeof GroupingConfigSchema>;\nexport type GalleryConfig = z.infer<typeof GalleryConfigSchema>;\nexport type TimelineConfig = z.infer<typeof TimelineConfigSchema>;\nexport type ViewSharing = z.infer<typeof ViewSharingSchema>;\nexport type RowColorConfig = z.infer<typeof RowColorConfigSchema>;\n","// Copyright (c) 2025 ObjectStack. Licensed under the Apache-2.0 license.\n\nimport { z } from 'zod';\n\n/**\n * I18n Object Schema\n * Structured internationalization label with translation key and parameters.\n * \n * @example\n * ```typescript\n * const label: I18nObject = {\n * key: 'views.task_list.label',\n * defaultValue: 'Task List',\n * params: { count: 5 },\n * };\n * ```\n */\nexport const I18nObjectSchema = z.object({\n /** Translation key (e.g., \"views.task_list.label\", \"apps.crm.description\") */\n key: z.string().describe('Translation key (e.g., \"views.task_list.label\")'),\n\n /** Default value when translation is not available */\n defaultValue: z.string().optional().describe('Fallback value when translation key is not found'),\n\n /** Interpolation parameters for dynamic translations */\n params: z.record(z.string(), z.any()).optional().describe('Interpolation parameters (e.g., { count: 5 })'),\n});\n\nexport type I18nObject = z.infer<typeof I18nObjectSchema>;\n\n/**\n * I18n Label Schema (Union)\n * \n * Supports two modes for backward compatibility:\n * 1. **Plain string** — Direct label text (legacy/simple usage)\n * 2. **I18n object** — Structured translation key with parameters\n * \n * This union type allows gradual migration from hardcoded strings\n * to fully internationalized labels without breaking existing configurations.\n * \n * @example Plain string (backward compatible)\n * ```typescript\n * const label: I18nLabel = \"All Active\";\n * ```\n * \n * @example I18n object\n * ```typescript\n * const label: I18nLabel = {\n * key: \"views.task_list.label\",\n * defaultValue: \"Task List\",\n * };\n * ```\n */\nexport const I18nLabelSchema = z.union([\n z.string(),\n I18nObjectSchema,\n]).describe('Display label: plain string or i18n translation object');\n\nexport type I18nLabel = z.infer<typeof I18nLabelSchema>;\n\n/**\n * ARIA Accessibility Properties Schema\n * \n * Common ARIA attributes for UI components to support screen readers\n * and assistive technologies.\n * \n * Aligned with WAI-ARIA 1.2 specification.\n * \n * @see https://www.w3.org/TR/wai-aria-1.2/\n * \n * @example\n * ```typescript\n * const aria: AriaProps = {\n * ariaLabel: 'Close dialog',\n * ariaDescribedBy: 'dialog-description',\n * role: 'dialog',\n * };\n * ```\n */\nexport const AriaPropsSchema = z.object({\n /** Accessible label for screen readers */\n ariaLabel: I18nLabelSchema.optional().describe('Accessible label for screen readers (WAI-ARIA aria-label)'),\n\n /** ID of element that describes this component */\n ariaDescribedBy: z.string().optional().describe('ID of element providing additional description (WAI-ARIA aria-describedby)'),\n\n /** WAI-ARIA role override */\n role: z.string().optional().describe('WAI-ARIA role attribute (e.g., \"dialog\", \"navigation\", \"alert\")'),\n}).describe('ARIA accessibility attributes');\n\nexport type AriaProps = z.infer<typeof AriaPropsSchema>;\n\n/**\n * Plural Rule Schema\n *\n * Defines plural forms for a translation key, following ICU MessageFormat / i18next conventions.\n * Supports zero, one, two, few, many, other forms per CLDR plural rules.\n *\n * @see https://unicode.org/reports/tr35/tr35-numbers.html#Language_Plural_Rules\n *\n * @example\n * ```typescript\n * const plural: PluralRule = {\n * key: 'items.count',\n * zero: 'No items',\n * one: '{count} item',\n * other: '{count} items',\n * };\n * ```\n */\nexport const PluralRuleSchema = z.object({\n /** Translation key for the plural form */\n key: z.string().describe('Translation key'),\n /** Form for zero quantity */\n zero: z.string().optional().describe('Zero form (e.g., \"No items\")'),\n /** Form for singular (1) */\n one: z.string().optional().describe('Singular form (e.g., \"{count} item\")'),\n /** Form for dual (2) — used in Arabic, Welsh, etc. */\n two: z.string().optional().describe('Dual form (e.g., \"{count} items\" for exactly 2)'),\n /** Form for few (2-4 in Slavic languages) */\n few: z.string().optional().describe('Few form (e.g., for 2-4 in some languages)'),\n /** Form for many (5+ in Slavic languages) */\n many: z.string().optional().describe('Many form (e.g., for 5+ in some languages)'),\n /** Default/fallback form */\n other: z.string().describe('Default plural form (e.g., \"{count} items\")'),\n}).describe('ICU plural rules for a translation key');\n\nexport type PluralRule = z.infer<typeof PluralRuleSchema>;\n\n/**\n * Number Format Schema\n *\n * Defines number formatting rules for localization.\n *\n * @example\n * ```typescript\n * const format: NumberFormat = {\n * style: 'currency',\n * currency: 'USD',\n * minimumFractionDigits: 2,\n * };\n * ```\n */\nexport const NumberFormatSchema = z.object({\n style: z.enum(['decimal', 'currency', 'percent', 'unit']).default('decimal')\n .describe('Number formatting style'),\n currency: z.string().optional().describe('ISO 4217 currency code (e.g., \"USD\", \"EUR\")'),\n unit: z.string().optional().describe('Unit for unit formatting (e.g., \"kilometer\", \"liter\")'),\n minimumFractionDigits: z.number().optional().describe('Minimum number of fraction digits'),\n maximumFractionDigits: z.number().optional().describe('Maximum number of fraction digits'),\n useGrouping: z.boolean().optional().describe('Whether to use grouping separators (e.g., 1,000)'),\n}).describe('Number formatting rules');\n\nexport type NumberFormat = z.infer<typeof NumberFormatSchema>;\n\n/**\n * Date Format Schema\n *\n * Defines date/time formatting rules for localization.\n *\n * @example\n * ```typescript\n * const format: DateFormat = {\n * dateStyle: 'medium',\n * timeStyle: 'short',\n * timeZone: 'America/New_York',\n * };\n * ```\n */\nexport const DateFormatSchema = z.object({\n dateStyle: z.enum(['full', 'long', 'medium', 'short']).optional()\n .describe('Date display style'),\n timeStyle: z.enum(['full', 'long', 'medium', 'short']).optional()\n .describe('Time display style'),\n timeZone: z.string().optional().describe('IANA time zone (e.g., \"America/New_York\")'),\n hour12: z.boolean().optional().describe('Use 12-hour format'),\n}).describe('Date/time formatting rules');\n\nexport type DateFormat = z.infer<typeof DateFormatSchema>;\n\n/**\n * Locale Configuration Schema\n *\n * Defines a complete locale configuration including language code,\n * fallback chain, and formatting preferences.\n *\n * @example\n * ```typescript\n * const locale: LocaleConfig = {\n * code: 'zh-CN',\n * fallbackChain: ['zh-TW', 'en'],\n * direction: 'ltr',\n * numberFormat: { style: 'decimal', useGrouping: true },\n * dateFormat: { dateStyle: 'medium', timeStyle: 'short' },\n * };\n * ```\n */\nexport const LocaleConfigSchema = z.object({\n /** BCP 47 language code (e.g., \"en-US\", \"zh-CN\", \"ar-SA\") */\n code: z.string().describe('BCP 47 language code (e.g., \"en-US\", \"zh-CN\")'),\n\n /** Ordered fallback chain for missing translations */\n fallbackChain: z.array(z.string()).optional()\n .describe('Fallback language codes in priority order (e.g., [\"zh-TW\", \"en\"])'),\n\n /** Text direction */\n direction: z.enum(['ltr', 'rtl']).default('ltr')\n .describe('Text direction: left-to-right or right-to-left'),\n\n /** Default number formatting */\n numberFormat: NumberFormatSchema.optional().describe('Default number formatting rules'),\n\n /** Default date formatting */\n dateFormat: DateFormatSchema.optional().describe('Default date/time formatting rules'),\n}).describe('Locale configuration');\n\nexport type LocaleConfig = z.infer<typeof LocaleConfigSchema>;\n","// Copyright (c) 2025 ObjectStack. Licensed under the Apache-2.0 license.\n\nimport { z } from 'zod';\nimport { SnakeCaseIdentifierSchema } from '../shared/identifiers.zod';\nimport { RowLevelSecurityPolicySchema } from './rls.zod';\n\n/**\n * Entity (Object) Level Permissions\n * Defines CRUD + VAMA (View All / Modify All) + Lifecycle access.\n * \n * Refined with enterprise data lifecycle controls:\n * - Transfer (Ownership change)\n * - Restore (Soft delete recovery)\n * - Purge (Hard delete / Compliance)\n */\nexport const ObjectPermissionSchema = z.object({\n /** C: Create */\n allowCreate: z.boolean().default(false).describe('Create permission'),\n /** R: Read (Owned records or Shared records) */\n allowRead: z.boolean().default(false).describe('Read permission'),\n /** U: Edit (Owned records or Shared records) */\n allowEdit: z.boolean().default(false).describe('Edit permission'),\n /** D: Delete (Owned records or Shared records) */\n allowDelete: z.boolean().default(false).describe('Delete permission'),\n \n /** Lifecycle Operations */\n allowTransfer: z.boolean().default(false).describe('Change record ownership'),\n allowRestore: z.boolean().default(false).describe('Restore from trash (Undelete)'),\n allowPurge: z.boolean().default(false).describe('Permanently delete (Hard Delete/GDPR)'),\n\n /** \n * View All Records: Super-user read access. \n * Bypasses Sharing Rules and Ownership checks.\n * Equivalent to Microsoft Dataverse \"Organization\" level read access.\n */\n viewAllRecords: z.boolean().default(false).describe('View All Data (Bypass Sharing)'),\n \n /** \n * Modify All Records: Super-user write access. \n * Bypasses Sharing Rules and Ownership checks.\n * Equivalent to Microsoft Dataverse \"Organization\" level write access.\n */\n modifyAllRecords: z.boolean().default(false).describe('Modify All Data (Bypass Sharing)'),\n});\n\n/**\n * Field Level Security (FLS)\n */\nexport const FieldPermissionSchema = z.object({\n /** Can see this field */\n readable: z.boolean().default(true).describe('Field read access'),\n /** Can edit this field */\n editable: z.boolean().default(false).describe('Field edit access'),\n});\n\n/**\n * Permission Set Schema\n * Defines a collection of permissions that can be assigned to users.\n * \n * DIFFERENTIATION:\n * - Profile: The ONE primary functional definition of a user (e.g. Standard User).\n * - Permission Set: Add-on capabilities assigned to users (e.g. Export Reports).\n * - Role: (Defined in src/system/role.zod.ts) Defines data visibility hierarchy.\n * \n * **NAMING CONVENTION:**\n * Permission set names MUST be lowercase snake_case to prevent security issues.\n * \n * @example Good permission set names\n * - 'read_only'\n * - 'system_admin'\n * - 'standard_user'\n * - 'api_access'\n * \n * @example Bad permission set names (will be rejected)\n * - 'ReadOnly' (camelCase)\n * - 'SystemAdmin' (mixed case)\n * - 'Read Only' (spaces)\n */\nexport const PermissionSetSchema = z.object({\n /** Unique permission set name */\n name: SnakeCaseIdentifierSchema.describe('Permission set unique name (lowercase snake_case)'),\n \n /** Display label */\n label: z.string().optional().describe('Display label'),\n \n /** Is this a Profile? (Base set for a user) */\n isProfile: z.boolean().default(false).describe('Whether this is a user profile'),\n \n /** Object Permissions Map: <entity_name> -> permissions */\n objects: z.record(z.string(), ObjectPermissionSchema).describe('Entity permissions'),\n \n /** Field Permissions Map: <entity_name>.<field_name> -> permissions */\n fields: z.record(z.string(), FieldPermissionSchema).optional().describe('Field level security'),\n \n /** System permissions (e.g., \"manage_users\") */\n systemPermissions: z.array(z.string()).optional().describe('System level capabilities'),\n \n /** \n * Row-Level Security Rules\n * \n * Row-level security policies that filter records based on user context.\n * These rules are applied in addition to object-level permissions.\n * \n * Uses the canonical RLS protocol from rls.zod.ts for comprehensive\n * row-level security features including PostgreSQL-style USING and CHECK clauses.\n * \n * @see {@link RowLevelSecurityPolicySchema} for full RLS specification\n * @see {@link file://./rls.zod.ts} for comprehensive RLS documentation\n * \n * @example Multi-tenant isolation\n * ```typescript\n * rls: [{\n * name: 'tenant_filter',\n * object: 'account',\n * operation: 'select',\n * using: 'tenant_id = current_user.tenant_id'\n * }]\n * ```\n */\n rowLevelSecurity: z.array(RowLevelSecurityPolicySchema).optional()\n .describe('Row-level security policies (see rls.zod.ts for full spec)'),\n \n /**\n * Context-Based Access Control Variables\n * \n * Custom context variables that can be referenced in RLS rules.\n * These variables are evaluated at runtime based on the user's session.\n * \n * Common context variables:\n * - `current_user.id` - Current user ID\n * - `current_user.tenant_id` - User's tenant/organization ID\n * - `current_user.department` - User's department\n * - `current_user.role` - User's role\n * - `current_user.region` - User's geographic region\n * \n * @example Custom context\n * ```typescript\n * contextVariables: {\n * allowed_regions: ['US', 'EU'],\n * access_level: 2,\n * custom_attribute: 'value'\n * }\n * ```\n */\n contextVariables: z.record(z.string(), z.unknown()).optional().describe('Context variables for RLS evaluation'),\n});\n\nexport type PermissionSet = z.infer<typeof PermissionSetSchema>;\nexport type ObjectPermission = z.infer<typeof ObjectPermissionSchema>;\nexport type FieldPermission = z.infer<typeof FieldPermissionSchema>;\n","// Copyright (c) 2025 ObjectStack. Licensed under the Apache-2.0 license.\n\nimport { z } from 'zod';\n\n/**\n * # Row-Level Security (RLS) Protocol\n * \n * Implements fine-grained record-level access control inspired by PostgreSQL RLS\n * and Salesforce Criteria-Based Sharing Rules.\n * \n * ## Overview\n * \n * Row-Level Security (RLS) allows you to control which rows users can access\n * in database tables based on their identity and role. Unlike object-level\n * permissions (CRUD), RLS provides record-level filtering.\n * \n * ## Use Cases\n * \n * 1. **Multi-Tenant Data Isolation**\n * - Users only see records from their organization\n * - `using: \"tenant_id = current_user.tenant_id\"`\n * \n * 2. **Ownership-Based Access**\n * - Users only see records they own\n * - `using: \"owner_id = current_user.id\"`\n * \n * 3. **Department-Based Access**\n * - Users only see records from their department\n * - `using: \"department = current_user.department\"`\n * \n * 4. **Regional Access Control**\n * - Sales reps only see accounts in their territory\n * - `using: \"region IN (current_user.assigned_regions)\"`\n * \n * 5. **Time-Based Access**\n * - Users can only access active records\n * - `using: \"status = 'active' AND expiry_date > NOW()\"`\n * \n * ## PostgreSQL RLS Comparison\n * \n * PostgreSQL RLS Example:\n * ```sql\n * CREATE POLICY tenant_isolation ON accounts\n * FOR SELECT\n * USING (tenant_id = current_setting('app.current_tenant_id')::uuid);\n * \n * CREATE POLICY account_insert ON accounts\n * FOR INSERT\n * WITH CHECK (tenant_id = current_setting('app.current_tenant_id')::uuid);\n * ```\n * \n * ObjectStack RLS Equivalent:\n * ```typescript\n * {\n * name: 'tenant_isolation',\n * object: 'account',\n * operation: 'select',\n * using: 'tenant_id = current_user.tenant_id'\n * }\n * ```\n * \n * ## Salesforce Sharing Rules Comparison\n * \n * Salesforce uses \"Sharing Rules\" and \"Role Hierarchy\" for record-level access.\n * ObjectStack RLS provides similar functionality with more flexibility.\n * \n * Salesforce:\n * - Criteria-Based Sharing: Share records matching criteria with users/roles\n * - Owner-Based Sharing: Share records based on owner's role\n * - Manual Sharing: Individual record sharing\n * \n * ObjectStack RLS:\n * - More flexible formula-based conditions\n * - Direct SQL-like syntax\n * - Supports complex logic with AND/OR/NOT\n * \n * ## Best Practices\n * \n * 1. **Always Define SELECT Policy**: Control what users can view\n * 2. **Define INSERT/UPDATE CHECK Policies**: Prevent data leakage\n * 3. **Use Role-Based Policies**: Apply different rules to different roles\n * 4. **Test Thoroughly**: RLS can have complex interactions\n * 5. **Monitor Performance**: Complex RLS policies can impact query performance\n * \n * ## Security Considerations\n * \n * 1. **Defense in Depth**: RLS is one layer; use with object permissions\n * 2. **Default Deny**: If no policy matches, access is denied\n * 3. **Policy Precedence**: More permissive policy wins (OR logic)\n * 4. **Context Variables**: Ensure current_user context is always set\n * \n * @see https://www.postgresql.org/docs/current/ddl-rowsecurity.html\n * @see https://help.salesforce.com/s/articleView?id=sf.security_sharing_rules.htm\n */\n\n/**\n * RLS Operation Enum\n * Specifies which database operation this policy applies to.\n * \n * - **select**: Controls which rows can be read (SELECT queries)\n * - **insert**: Controls which rows can be inserted (INSERT statements)\n * - **update**: Controls which rows can be updated (UPDATE statements)\n * - **delete**: Controls which rows can be deleted (DELETE statements)\n * - **all**: Shorthand for all operations (equivalent to defining 4 separate policies)\n */\nexport const RLSOperation = z.enum(['select', 'insert', 'update', 'delete', 'all']);\n\nexport type RLSOperation = z.infer<typeof RLSOperation>;\n\n/**\n * Row-Level Security Policy Schema\n * \n * Defines a single RLS policy that filters records based on conditions.\n * Multiple policies can be defined for the same object, and they are\n * combined with OR logic (union of results).\n * \n * @example Multi-Tenant Isolation\n * ```typescript\n * {\n * name: 'tenant_isolation',\n * label: 'Multi-Tenant Data Isolation',\n * object: 'account',\n * operation: 'select',\n * using: 'tenant_id = current_user.tenant_id',\n * enabled: true\n * }\n * ```\n * \n * @example Owner-Based Access\n * ```typescript\n * {\n * name: 'owner_access',\n * label: 'Users Can View Their Own Records',\n * object: 'opportunity',\n * operation: 'select',\n * using: 'owner_id = current_user.id',\n * enabled: true\n * }\n * ```\n * \n * @example Manager Can View Team Records\n * ```typescript\n * {\n * name: 'manager_team_access',\n * label: 'Managers Can View Team Records',\n * object: 'task',\n * operation: 'select',\n * using: 'assigned_to_id IN (SELECT id FROM users WHERE manager_id = current_user.id)',\n * roles: ['manager', 'director'],\n * enabled: true\n * }\n * ```\n * \n * @example Prevent Cross-Tenant Data Insertion\n * ```typescript\n * {\n * name: 'tenant_insert_check',\n * label: 'Prevent Cross-Tenant Data Creation',\n * object: 'account',\n * operation: 'insert',\n * check: 'tenant_id = current_user.tenant_id',\n * enabled: true\n * }\n * ```\n * \n * @example Regional Sales Access\n * ```typescript\n * {\n * name: 'regional_sales_access',\n * label: 'Sales Reps Access Regional Accounts',\n * object: 'account',\n * operation: 'select',\n * using: 'region = current_user.region OR region IS NULL',\n * roles: ['sales_rep'],\n * enabled: true\n * }\n * ```\n * \n * @example Time-Based Access Control\n * ```typescript\n * {\n * name: 'active_records_only',\n * label: 'Users Only Access Active Records',\n * object: 'contract',\n * operation: 'select',\n * using: 'status = \"active\" AND start_date <= NOW() AND end_date >= NOW()',\n * enabled: true\n * }\n * ```\n * \n * @example Hierarchical Access (Role-Based)\n * ```typescript\n * {\n * name: 'executive_full_access',\n * label: 'Executives See All Records',\n * object: 'account',\n * operation: 'all',\n * using: '1 = 1', // Always true - see everything\n * roles: ['ceo', 'cfo', 'cto'],\n * enabled: true\n * }\n * ```\n */\nexport const RowLevelSecurityPolicySchema = z.object({\n /**\n * Unique identifier for this policy.\n * Must be unique within the object.\n * Use snake_case following ObjectStack naming conventions.\n * \n * @example \"tenant_isolation\", \"owner_access\", \"manager_team_view\"\n */\n name: z.string()\n .regex(/^[a-z_][a-z0-9_]*$/)\n .describe('Policy unique identifier (snake_case)'),\n\n /**\n * Human-readable label for the policy.\n * Used in admin UI and logs.\n * \n * @example \"Multi-Tenant Data Isolation\", \"Owner-Based Access\"\n */\n label: z.string()\n .optional()\n .describe('Human-readable policy label'),\n\n /**\n * Description explaining what this policy does and why.\n * Helps with governance and compliance.\n * \n * @example \"Ensures users can only access records from their own tenant organization\"\n */\n description: z.string()\n .optional()\n .describe('Policy description and business justification'),\n\n /**\n * Target object (table) this policy applies to.\n * Must reference a valid ObjectStack object name.\n * \n * @example \"account\", \"opportunity\", \"contact\", \"custom_object\"\n */\n object: z.string()\n .describe('Target object name'),\n\n /**\n * Database operation(s) this policy applies to.\n * \n * - **select**: Controls read access (SELECT queries)\n * - **insert**: Controls insert access (INSERT statements)\n * - **update**: Controls update access (UPDATE statements)\n * - **delete**: Controls delete access (DELETE statements)\n * - **all**: Applies to all operations\n * \n * @example \"select\" - Most common, controls what users can view\n * @example \"all\" - Apply same rule to all operations\n */\n operation: RLSOperation\n .describe('Database operation this policy applies to'),\n\n /**\n * USING clause - Filter condition for SELECT/UPDATE/DELETE.\n * \n * This is a SQL-like expression evaluated for each row.\n * Only rows where this expression returns TRUE are accessible.\n * \n * **Note**: For INSERT-only policies, USING is not required (only CHECK is needed).\n * For SELECT/UPDATE/DELETE operations, USING is required.\n * \n * **Security Note**: RLS conditions are executed at the database level with\n * parameterized queries. The implementation must use prepared statements\n * to prevent SQL injection. Never concatenate user input directly into\n * RLS conditions.\n * \n * **SQL Dialect**: Compatible with PostgreSQL SQL syntax. Implementations\n * may adapt to other databases (MySQL, SQL Server, etc.) but should maintain\n * semantic equivalence.\n * \n * Available context variables:\n * - `current_user.id` - Current user's ID\n * - `current_user.tenant_id` - Current user's tenant (maps to `tenantId` in RLSUserContext)\n * - `current_user.role` - Current user's role\n * - `current_user.department` - Current user's department\n * - `current_user.*` - Any custom user field\n * - `NOW()` - Current timestamp\n * - `CURRENT_DATE` - Current date\n * - `CURRENT_TIME` - Current time\n * \n * **Context Variable Mapping**: The RLSUserContext schema uses camelCase (e.g., `tenantId`),\n * but expressions use snake_case with `current_user.` prefix (e.g., `current_user.tenant_id`).\n * Implementations must handle this mapping.\n * \n * Supported operators:\n * - Comparison: =, !=, <, >, <=, >=, <> (not equal)\n * - Logical: AND, OR, NOT\n * - NULL checks: IS NULL, IS NOT NULL\n * - Set operations: IN, NOT IN\n * - String: LIKE, NOT LIKE, ILIKE (case-insensitive)\n * - Pattern matching: ~ (regex), !~ (not regex)\n * - Subqueries: (SELECT ...)\n * - Array operations: ANY, ALL\n * \n * **Prohibited**: Dynamic SQL, DDL statements, DML statements (INSERT/UPDATE/DELETE)\n * \n * @example \"tenant_id = current_user.tenant_id\"\n * @example \"owner_id = current_user.id OR created_by = current_user.id\"\n * @example \"department IN (SELECT department FROM user_departments WHERE user_id = current_user.id)\"\n * @example \"status = 'active' AND expiry_date > NOW()\"\n */\n using: z.string()\n .optional()\n .describe('Filter condition for SELECT/UPDATE/DELETE (PostgreSQL SQL WHERE clause syntax with parameterized context variables). Optional for INSERT-only policies.'),\n\n /**\n * CHECK clause - Validation for INSERT/UPDATE operations.\n * \n * Similar to USING but applies to new/modified rows.\n * Prevents users from creating/updating rows they wouldn't be able to see.\n * \n * **Default Behavior**: If not specified, implementations should use the\n * USING clause as the CHECK clause. This ensures data integrity by preventing\n * users from creating records they cannot view.\n * \n * Use cases:\n * - Prevent cross-tenant data creation\n * - Enforce mandatory field values\n * - Validate data integrity rules\n * - Restrict certain operations (e.g., only allow creating \"draft\" status)\n * \n * @example \"tenant_id = current_user.tenant_id\"\n * @example \"status IN ('draft', 'pending')\" - Only allow certain statuses\n * @example \"created_by = current_user.id\" - Must be the creator\n */\n check: z.string()\n .optional()\n .describe('Validation condition for INSERT/UPDATE (defaults to USING clause if not specified - enforced at application level)'),\n\n /**\n * Restrict this policy to specific roles.\n * If specified, only users with these roles will have this policy applied.\n * If omitted, policy applies to all users (except those with bypassRLS permission).\n * \n * Role names must match defined roles in the system.\n * \n * @example [\"sales_rep\", \"account_manager\"]\n * @example [\"employee\"] - Apply to all employees\n * @example [\"guest\"] - Special restrictions for guests\n */\n roles: z.array(z.string())\n .optional()\n .describe('Roles this policy applies to (omit for all roles)'),\n\n /**\n * Whether this policy is currently active.\n * Disabled policies are not evaluated.\n * Useful for temporary policy changes without deletion.\n * \n * @default true\n */\n enabled: z.boolean()\n .default(true)\n .describe('Whether this policy is active'),\n\n /**\n * Policy priority for conflict resolution.\n * Higher numbers = higher priority.\n * When multiple policies apply, the most permissive wins (OR logic).\n * Priority is only used for ordering evaluation (performance).\n * \n * @default 0\n */\n priority: z.number()\n .int()\n .default(0)\n .describe('Policy evaluation priority (higher = evaluated first)'),\n\n /**\n * Tags for policy categorization and reporting.\n * Useful for governance, compliance, and auditing.\n * \n * @example [\"compliance\", \"gdpr\", \"pci\"]\n * @example [\"multi-tenant\", \"security\"]\n */\n tags: z.array(z.string())\n .optional()\n .describe('Policy categorization tags'),\n}).superRefine((data, ctx) => {\n // Ensure at least one of USING or CHECK is provided\n if (!data.using && !data.check) {\n ctx.addIssue({\n code: z.ZodIssueCode.custom,\n message: 'At least one of \"using\" or \"check\" must be specified. For SELECT/UPDATE/DELETE operations, provide \"using\". For INSERT operations, provide \"check\".',\n });\n }\n \n // For non-insert operations, USING should typically be present\n // This is a soft warning through documentation, not enforced here\n // since 'all' and mixed operation types are valid\n});\n\n/**\n * RLS Audit Event Schema\n * \n * Records a single RLS policy evaluation event for compliance and debugging.\n */\nexport const RLSAuditEventSchema = z.object({\n /** ISO 8601 timestamp of the evaluation */\n timestamp: z.string()\n .describe('ISO 8601 timestamp of the evaluation'),\n\n /** ID of the user whose access was evaluated */\n userId: z.string()\n .describe('User ID whose access was evaluated'),\n\n /** Database operation being performed */\n operation: z.enum(['select', 'insert', 'update', 'delete'])\n .describe('Database operation being performed'),\n\n /** Target object (table) name */\n object: z.string()\n .describe('Target object name'),\n\n /** Name of the RLS policy evaluated */\n policyName: z.string()\n .describe('Name of the RLS policy evaluated'),\n\n /** Whether access was granted */\n granted: z.boolean()\n .describe('Whether access was granted'),\n\n /** Time taken to evaluate the policy in milliseconds */\n evaluationDurationMs: z.number()\n .describe('Policy evaluation duration in milliseconds'),\n\n /** Which USING/CHECK clause matched */\n matchedCondition: z.string()\n .optional()\n .describe('Which USING/CHECK clause matched'),\n\n /** Number of rows affected by the operation */\n rowCount: z.number()\n .optional()\n .describe('Number of rows affected'),\n\n /** Additional metadata for the audit event */\n metadata: z.record(z.string(), z.unknown())\n .optional()\n .describe('Additional audit event metadata'),\n});\n\nexport type RLSAuditEvent = z.infer<typeof RLSAuditEventSchema>;\n\n/**\n * RLS Audit Configuration Schema\n * \n * Controls how RLS policy evaluations are logged and monitored.\n */\nexport const RLSAuditConfigSchema = z.object({\n /** Enable RLS audit logging */\n enabled: z.boolean()\n .describe('Enable RLS audit logging'),\n\n /** Which evaluations to log */\n logLevel: z.enum(['all', 'denied_only', 'granted_only', 'none'])\n .describe('Which evaluations to log'),\n\n /** Where to send audit logs */\n destination: z.enum(['system_log', 'audit_trail', 'external'])\n .describe('Audit log destination'),\n\n /** Sampling rate for high-traffic environments (0-1) */\n sampleRate: z.number()\n .min(0)\n .max(1)\n .describe('Sampling rate (0-1) for high-traffic environments'),\n\n /** Number of days to retain audit logs */\n retentionDays: z.number()\n .int()\n .default(90)\n .describe('Audit log retention period in days'),\n\n /** Whether to include row data in audit logs (security-sensitive) */\n includeRowData: z.boolean()\n .default(false)\n .describe('Include row data in audit logs (security-sensitive)'),\n\n /** Alert when access is denied */\n alertOnDenied: z.boolean()\n .default(true)\n .describe('Send alerts when access is denied'),\n});\n\nexport type RLSAuditConfig = z.infer<typeof RLSAuditConfigSchema>;\n\n/**\n * RLS Configuration Schema\n * \n * Global configuration for the Row-Level Security system.\n * Defines how RLS is enforced across the entire platform.\n */\nexport const RLSConfigSchema = z.object({\n /**\n * Global RLS enable/disable flag.\n * When false, all RLS policies are ignored (use with caution!).\n * \n * @default true\n */\n enabled: z.boolean()\n .default(true)\n .describe('Enable RLS enforcement globally'),\n\n /**\n * Default behavior when no policies match.\n * \n * - **deny**: Deny access (secure default)\n * - **allow**: Allow access (permissive mode, not recommended)\n * \n * @default \"deny\"\n */\n defaultPolicy: z.enum(['deny', 'allow'])\n .default('deny')\n .describe('Default action when no policies match'),\n\n /**\n * Whether to allow superusers to bypass RLS.\n * Superusers include system administrators and service accounts.\n * \n * @default true\n */\n allowSuperuserBypass: z.boolean()\n .default(true)\n .describe('Allow superusers to bypass RLS'),\n\n /**\n * List of roles that can bypass RLS.\n * Users with these roles see all records regardless of policies.\n * \n * @example [\"system_admin\", \"data_auditor\"]\n */\n bypassRoles: z.array(z.string())\n .optional()\n .describe('Roles that bypass RLS (see all data)'),\n\n /**\n * Whether to log RLS policy evaluations.\n * Useful for debugging and auditing.\n * Can impact performance if enabled globally.\n * \n * @default false\n */\n logEvaluations: z.boolean()\n .default(false)\n .describe('Log RLS policy evaluations for debugging'),\n\n /**\n * Cache RLS policy evaluation results.\n * Can improve performance for frequently accessed records.\n * Cache is invalidated when policies change or user context changes.\n * \n * @default true\n */\n cacheResults: z.boolean()\n .default(true)\n .describe('Cache RLS evaluation results'),\n\n /**\n * Cache TTL in seconds.\n * How long to cache RLS evaluation results.\n * \n * @default 300 (5 minutes)\n */\n cacheTtlSeconds: z.number()\n .int()\n .positive()\n .default(300)\n .describe('Cache TTL in seconds'),\n\n /**\n * Performance optimization: Pre-fetch user context.\n * Load user context once per request instead of per-query.\n * \n * @default true\n */\n prefetchUserContext: z.boolean()\n .default(true)\n .describe('Pre-fetch user context for performance'),\n\n /**\n * Audit logging configuration for RLS evaluations.\n */\n audit: RLSAuditConfigSchema\n .optional()\n .describe('RLS audit logging configuration'),\n});\n\n/**\n * User Context Schema\n * \n * Represents the current user's context for RLS evaluation.\n * This data is used to evaluate USING and CHECK clauses.\n */\nexport const RLSUserContextSchema = z.object({\n /**\n * User ID\n */\n id: z.string()\n .describe('User ID'),\n\n /**\n * User email\n */\n email: z.string()\n .email()\n .optional()\n .describe('User email'),\n\n /**\n * Tenant/Organization ID\n */\n tenantId: z.string()\n .optional()\n .describe('Tenant/Organization ID'),\n\n /**\n * User role(s)\n */\n role: z.union([\n z.string(),\n z.array(z.string()),\n ])\n .optional()\n .describe('User role(s)'),\n\n /**\n * User department\n */\n department: z.string()\n .optional()\n .describe('User department'),\n\n /**\n * Additional custom attributes\n * Can include any custom user fields for RLS evaluation\n */\n attributes: z.record(z.string(), z.unknown())\n .optional()\n .describe('Additional custom user attributes'),\n});\n\n/**\n * RLS Policy Evaluation Result\n * \n * Result of evaluating an RLS policy for a specific record.\n * Used for debugging and audit logging.\n */\nexport const RLSEvaluationResultSchema = z.object({\n /**\n * Policy name that was evaluated\n */\n policyName: z.string()\n .describe('Policy name'),\n\n /**\n * Whether access was granted\n */\n granted: z.boolean()\n .describe('Whether access was granted'),\n\n /**\n * Evaluation duration in milliseconds\n */\n durationMs: z.number()\n .optional()\n .describe('Evaluation duration in milliseconds'),\n\n /**\n * Error message if evaluation failed\n */\n error: z.string()\n .optional()\n .describe('Error message if evaluation failed'),\n\n /**\n * Evaluated USING clause result\n */\n usingResult: z.boolean()\n .optional()\n .describe('USING clause evaluation result'),\n\n /**\n * Evaluated CHECK clause result (for INSERT/UPDATE)\n */\n checkResult: z.boolean()\n .optional()\n .describe('CHECK clause evaluation result'),\n});\n\n/**\n * Type exports\n */\nexport type RowLevelSecurityPolicy = z.infer<typeof RowLevelSecurityPolicySchema>;\nexport type RLSConfig = z.infer<typeof RLSConfigSchema>;\nexport type RLSUserContext = z.infer<typeof RLSUserContextSchema>;\nexport type RLSEvaluationResult = z.infer<typeof RLSEvaluationResultSchema>;\n\n/**\n * Helper factory for creating RLS policies\n */\nexport const RLS = {\n /**\n * Create a simple owner-based policy\n */\n ownerPolicy: (object: string, ownerField: string = 'owner_id'): RowLevelSecurityPolicy => ({\n name: `${object}_owner_access`,\n label: `Owner Access for ${object}`,\n object,\n operation: 'all',\n using: `${ownerField} = current_user.id`,\n enabled: true,\n priority: 0,\n }),\n\n /**\n * Create a tenant isolation policy\n */\n tenantPolicy: (object: string, tenantField: string = 'tenant_id'): RowLevelSecurityPolicy => ({\n name: `${object}_tenant_isolation`,\n label: `Tenant Isolation for ${object}`,\n object,\n operation: 'all',\n using: `${tenantField} = current_user.tenant_id`,\n check: `${tenantField} = current_user.tenant_id`,\n enabled: true,\n priority: 0,\n }),\n\n /**\n * Create a role-based policy\n */\n rolePolicy: (object: string, roles: string[], condition: string): RowLevelSecurityPolicy => ({\n name: `${object}_${roles.join('_')}_access`,\n label: `${roles.join(', ')} Access for ${object}`,\n object,\n operation: 'select',\n using: condition,\n roles,\n enabled: true,\n priority: 0,\n }),\n\n /**\n * Create a permissive policy (allow all for specific roles)\n */\n allowAllPolicy: (object: string, roles: string[]): RowLevelSecurityPolicy => ({\n name: `${object}_${roles.join('_')}_full_access`,\n label: `Full Access for ${roles.join(', ')}`,\n object,\n operation: 'all',\n using: '1 = 1', // Always true\n roles,\n enabled: true,\n priority: 0,\n }),\n} as const;\n","// Copyright (c) 2025 ObjectStack. Licensed under the Apache-2.0 license.\n\nimport { z } from 'zod';\nimport { SnakeCaseIdentifierSchema } from '../shared/identifiers.zod';\n\n/**\n * Trigger events for workflow automation\n */\nexport const WorkflowTriggerType = z.enum([\n 'on_create', // When record is created\n 'on_update', // When record is updated\n 'on_create_or_update', // Both\n 'on_delete', // When record is deleted\n 'schedule' // Time-based (cron)\n]);\n\n/**\n * Schema for Workflow Field Update Action\n * @example\n * {\n * name: \"update_status\",\n * type: \"field_update\",\n * field: \"status\",\n * value: \"approved\"\n * }\n */\nexport const FieldUpdateActionSchema = z.object({\n name: z.string().describe('Action name'),\n type: z.literal('field_update'),\n field: z.string().describe('Field to update'),\n value: z.unknown().describe('Value or Formula to set'),\n});\n\n/**\n * Schema for Workflow Email Alert Action\n * @example\n * {\n * name: \"send_approval_email\",\n * type: \"email_alert\",\n * template: \"approval_request_email\",\n * recipients: [\"user_id_123\", \"manager_field\"]\n * }\n */\nexport const EmailAlertActionSchema = z.object({\n name: z.string().describe('Action name'),\n type: z.literal('email_alert'),\n template: z.string().describe('Email template ID/DevName'),\n recipients: z.array(z.string()).describe('List of recipient emails or user IDs'),\n});\n\n/**\n * Schema for Connector Action Reference\n * Executes a capability defined in an integration connector.\n * Replaces hardcoded vendor actions (Slack, Twilio, etc).\n * \n * @example Send Slack Message\n * {\n * name: \"notify_slack\",\n * type: \"connector_action\",\n * connectorId: \"slack\",\n * actionId: \"post_message\",\n * input: {\n * channel: \"#general\",\n * text: \"New deal closed: {name}\"\n * }\n * }\n */\nexport const ConnectorActionRefSchema = z.object({\n name: z.string().describe('Action name'),\n type: z.literal('connector_action'),\n connectorId: z.string().describe('Target Connector ID (e.g. slack, twilio)'),\n actionId: z.string().describe('Target Action ID (e.g. send_message)'),\n input: z.record(z.string(), z.unknown()).describe('Input parameters matching the action schema'),\n});\n\n/**\n * Schema for HTTP Callout Action\n * Makes a REST API call to an external service.\n * @example\n * {\n * name: \"sync_to_erp\",\n * type: \"http_call\",\n * url: \"https://erp.api/orders\",\n * method: \"POST\",\n * headers: { \"Authorization\": \"Bearer {token}\" },\n * body: \"{ ... }\"\n * }\n */\nexport const HttpCallActionSchema = z.object({\n name: z.string().describe('Action name'),\n type: z.literal('http_call'),\n url: z.string().describe('Target URL'),\n method: z.enum(['GET', 'POST', 'PUT', 'DELETE', 'PATCH']).default('POST').describe('HTTP Method'),\n headers: z.record(z.string(), z.string()).optional().describe('HTTP Headers'),\n body: z.string().optional().describe('Request body (JSON or text)'),\n});\n\n/**\n * Schema for Workflow Task Creation Action\n * @example\n * {\n * name: \"create_followup_task\",\n * type: \"task_creation\",\n * taskObject: \"tasks\",\n * subject: \"Follow up with client\",\n * dueDate: \"TODAY() + 3\"\n * }\n */\nexport const TaskCreationActionSchema = z.object({\n name: z.string().describe('Action name'),\n type: z.literal('task_creation'),\n taskObject: z.string().describe('Task object name (e.g., \"task\", \"project_task\")'),\n subject: z.string().describe('Task subject/title'),\n description: z.string().optional().describe('Task description'),\n assignedTo: z.string().optional().describe('User ID or field reference for assignee'),\n dueDate: z.string().optional().describe('Due date (ISO string or formula)'),\n priority: z.string().optional().describe('Task priority'),\n relatedTo: z.string().optional().describe('Related record ID or field reference'),\n additionalFields: z.record(z.string(), z.unknown()).optional().describe('Additional custom fields'),\n});\n\n/**\n * Schema for Workflow Push Notification Action\n */\nexport const PushNotificationActionSchema = z.object({\n name: z.string().describe('Action name'),\n type: z.literal('push_notification'),\n title: z.string().describe('Notification title'),\n body: z.string().describe('Notification body text'),\n recipients: z.array(z.string()).describe('User IDs or device tokens'),\n data: z.record(z.string(), z.unknown()).optional().describe('Additional data payload'),\n badge: z.number().optional().describe('Badge count (iOS)'),\n sound: z.string().optional().describe('Notification sound'),\n clickAction: z.string().optional().describe('Action/URL when notification is clicked'),\n});\n\n/**\n * Schema for Workflow Custom Script Action\n */\nexport const CustomScriptActionSchema = z.object({\n name: z.string().describe('Action name'),\n type: z.literal('custom_script'),\n language: z.enum(['javascript', 'typescript', 'python']).default('javascript').describe('Script language'),\n code: z.string().describe('Script code to execute'),\n timeout: z.number().default(30000).describe('Execution timeout in milliseconds'),\n context: z.record(z.string(), z.unknown()).optional().describe('Additional context variables'),\n});\n\n/**\n * Universal Workflow Action Schema\n * Union of all supported action types.\n */\nexport const WorkflowActionSchema = z.discriminatedUnion('type', [\n FieldUpdateActionSchema,\n EmailAlertActionSchema,\n HttpCallActionSchema,\n ConnectorActionRefSchema,\n TaskCreationActionSchema,\n PushNotificationActionSchema,\n CustomScriptActionSchema,\n]);\n\nexport type WorkflowAction = z.infer<typeof WorkflowActionSchema>;\n\n/**\n * Time Trigger Definition\n * Schedules actions to run relative to a specific time or date field.\n */\nexport const TimeTriggerSchema = z.object({\n id: z.string().optional().describe('Unique identifier'),\n \n /** Timing Logic */\n timeLength: z.number().int().describe('Duration amount (e.g. 1, 30)'),\n timeUnit: z.enum(['minutes', 'hours', 'days']).describe('Unit of time'),\n \n /** Reference Point */\n offsetDirection: z.enum(['before', 'after']).describe('Before or After the reference date'),\n offsetFrom: z.enum(['trigger_date', 'date_field']).describe('Basis for calculation'),\n dateField: z.string().optional().describe('Date field to calculate from (required if offsetFrom is date_field)'),\n \n /** Actions */\n actions: z.array(WorkflowActionSchema).describe('Actions to execute at the scheduled time'),\n});\n\n/**\n * Schema for Workflow Rules (Automation)\n * \n * **NAMING CONVENTION:**\n * Workflow names are machine identifiers and must be lowercase snake_case.\n * \n * @example Good workflow names\n * - 'send_welcome_email'\n * - 'update_lead_status'\n * - 'notify_manager_on_close'\n * - 'calculate_discount'\n * \n * @example Bad workflow names (will be rejected)\n * - 'SendWelcomeEmail' (PascalCase)\n * - 'updateLeadStatus' (camelCase)\n * - 'Send Welcome Email' (spaces)\n * \n * @example Complete Workflow\n * {\n * name: \"new_lead_process\",\n * objectName: \"lead\",\n * triggerType: \"on_create\",\n * criteria: \"amount > 1000\",\n * active: true,\n * actions: [\n * {\n * name: \"set_status\",\n * type: \"field_update\",\n * field: \"status\",\n * value: \"new\"\n * },\n * {\n * name: \"notify_team\",\n * type: \"connector_action\",\n * connectorId: \"slack\",\n * actionId: \"post_message\",\n * input: { channel: \"#sales\", text: \"New high value lead!\" }\n * }\n * ],\n * timeTriggers: [\n * {\n * timeLength: 2,\n * timeUnit: \"days\",\n * offsetDirection: \"after\",\n * offsetFrom: \"trigger_date\",\n * actions: [\n * {\n * name: \"followup_check\",\n * type: \"task_creation\",\n * taskObject: \"task\",\n * subject: \"Follow up lead\",\n * dueDate: \"TODAY()\"\n * }\n * ]\n * }\n * ]\n * }\n */\nexport const WorkflowRuleSchema = z.object({\n /** Machine name */\n name: SnakeCaseIdentifierSchema.describe('Unique workflow name (lowercase snake_case)'),\n \n /** Target Object */\n objectName: z.string().describe('Target Object'),\n \n /** When to evaluate the rule */\n triggerType: WorkflowTriggerType.describe('When to evaluate'),\n \n /** \n * Condition to start the workflow.\n * If empty, runs on every trigger event.\n */\n criteria: z.string().optional().describe('Formula condition. If TRUE, actions execute.'),\n \n /** Actions to execute immediately */\n actions: z.array(WorkflowActionSchema).optional().describe('Immediate actions'),\n \n /** \n * Time-Dependent Actions \n * Actions scheduled to run in the future.\n */\n timeTriggers: z.array(TimeTriggerSchema).optional().describe('Scheduled actions relative to trigger or date field'),\n \n /** Active status */\n active: z.boolean().default(true).describe('Whether this workflow is active'),\n \n /** Recursion Control */\n reevaluateOnChange: z.boolean().default(false).describe('Re-evaluate rule if field updates change the record validity'),\n});\n\nexport type WorkflowRule = z.infer<typeof WorkflowRuleSchema>;\nexport type TimeTrigger = z.infer<typeof TimeTriggerSchema>;\n","// Copyright (c) 2025 ObjectStack. Licensed under the Apache-2.0 license.\n\nimport { z } from 'zod';\n\n/**\n * Translation Schema\n * Supports i18n for labels, messages, and options.\n * Example structure:\n * ```json\n * {\n * \"en\": { \"objects\": { \"account\": { \"label\": \"Account\" } } },\n * \"zh-CN\": { \"objects\": { \"account\": { \"label\": \"客户\" } } }\n * }\n * ```\n */\nexport const TranslationDataSchema = z.object({\n /** Object translations */\n objects: z.record(z.string(), z.object({\n label: z.string().describe('Translated singular label'),\n pluralLabel: z.string().optional().describe('Translated plural label'),\n fields: z.record(z.string(), z.object({\n label: z.string().optional().describe('Translated field label'),\n help: z.string().optional().describe('Translated help text'),\n options: z.record(z.string(), z.string()).optional().describe('Option value to translated label map'),\n })).optional().describe('Field-level translations'),\n })).optional().describe('Object translations keyed by object name'),\n \n /** App/Menu translations */\n apps: z.record(z.string(), z.object({\n label: z.string().describe('Translated app label'),\n description: z.string().optional().describe('Translated app description'),\n })).optional().describe('App translations keyed by app name'),\n\n /** UI Messages */\n messages: z.record(z.string(), z.string()).optional().describe('UI message translations keyed by message ID'),\n}).describe('Translation data for objects, apps, and UI messages');\n\nexport const LocaleSchema = z.string().describe('BCP-47 Language Tag (e.g. en-US, zh-CN)');\n\nexport const TranslationBundleSchema = z.record(LocaleSchema, TranslationDataSchema).describe('Map of locale codes to translation data');\n\nexport type TranslationBundle = z.infer<typeof TranslationBundleSchema>;\n","// Copyright (c) 2025 ObjectStack. Licensed under the Apache-2.0 license.\n\nimport { z } from 'zod';\nimport { ManifestSchema } from './manifest.zod';\n\n/**\n * # Package Registry Protocol\n * \n * Defines the runtime state and lifecycle operations for installed packages.\n * \n * ## Key Distinction: Package vs App\n * - **Package (Manifest)**: The unit of installation — a deployable artifact containing\n * metadata (objects, actions, flows, etc.) and optionally one or more Apps.\n * - **App (AppSchema)**: A UI navigation shell defined inside a package.\n * \n * A package may contain:\n * - Zero apps (pure functionality plugin, e.g. a storage driver)\n * - One app (typical business application)\n * - Multiple apps (suite of applications)\n * \n * ## Architecture Alignment\n * - **Salesforce**: Managed Packages with install/uninstall lifecycle\n * - **VS Code**: Extension marketplace with enable/disable per-workspace\n * - **Kubernetes**: Helm charts with release state tracking\n * - **npm**: Package registry with install/uninstall/version management\n */\n\n// ==========================================\n// Package Status & Lifecycle\n// ==========================================\n\n/**\n * Package installation status.\n */\nexport const PackageStatusEnum = z.enum([\n 'installed', // Successfully installed and enabled\n 'disabled', // Installed but disabled (metadata not active)\n 'installing', // Installation in progress\n 'uninstalling', // Removal in progress\n 'error', // Installation or runtime error\n]);\nexport type PackageStatus = z.infer<typeof PackageStatusEnum>;\n\n/**\n * Installed Package Schema\n * \n * Wraps a ManifestSchema with runtime lifecycle state.\n * This is the \"row\" in the installed packages table.\n */\nexport const InstalledPackageSchema = z.object({\n /** \n * The full package manifest (source of truth for package definition).\n */\n manifest: ManifestSchema,\n\n /**\n * Current lifecycle status.\n */\n status: PackageStatusEnum.default('installed'),\n\n /**\n * Whether the package is currently enabled (active).\n * When disabled, the package's metadata is not loaded into the registry.\n */\n enabled: z.boolean().default(true),\n\n /**\n * ISO 8601 timestamp of when the package was installed.\n */\n installedAt: z.string().datetime().optional(),\n\n /**\n * ISO 8601 timestamp of last update.\n */\n updatedAt: z.string().datetime().optional(),\n\n /**\n * ISO 8601 timestamp of when the package was last enabled/disabled.\n */\n statusChangedAt: z.string().datetime().optional(),\n\n /**\n * Error message if status is 'error'.\n */\n errorMessage: z.string().optional(),\n\n /**\n * Configuration values set by the user for this package.\n * Keys correspond to the package's `configuration.properties`.\n */\n settings: z.record(z.string(), z.unknown()).optional(),\n});\nexport type InstalledPackage = z.infer<typeof InstalledPackageSchema>;\n\n// ==========================================\n// Package Registry Request/Response Schemas\n// ==========================================\n\n/**\n * List Packages Request\n */\nexport const ListPackagesRequestSchema = z.object({\n /** Filter by status */\n status: PackageStatusEnum.optional(),\n /** Filter by package type */\n type: ManifestSchema.shape.type.optional(),\n /** Filter by enabled state */\n enabled: z.boolean().optional(),\n});\nexport type ListPackagesRequest = z.infer<typeof ListPackagesRequestSchema>;\n\n/**\n * List Packages Response\n */\nexport const ListPackagesResponseSchema = z.object({\n packages: z.array(InstalledPackageSchema),\n total: z.number(),\n});\nexport type ListPackagesResponse = z.infer<typeof ListPackagesResponseSchema>;\n\n/**\n * Get Package Request\n */\nexport const GetPackageRequestSchema = z.object({\n /** Package ID (reverse domain identifier from manifest) */\n id: z.string(),\n});\nexport type GetPackageRequest = z.infer<typeof GetPackageRequestSchema>;\n\n/**\n * Get Package Response\n */\nexport const GetPackageResponseSchema = z.object({\n package: InstalledPackageSchema,\n});\nexport type GetPackageResponse = z.infer<typeof GetPackageResponseSchema>;\n\n/**\n * Install Package Request\n * \n * Accepts a full manifest to install. In a production system,\n * this might also accept a package ID to fetch from a marketplace.\n */\nexport const InstallPackageRequestSchema = z.object({\n /** The package manifest to install */\n manifest: ManifestSchema,\n /** Optional: user-provided settings at install time */\n settings: z.record(z.string(), z.unknown()).optional(),\n /** Whether to enable immediately after install (default: true) */\n enableOnInstall: z.boolean().default(true),\n});\nexport type InstallPackageRequest = z.infer<typeof InstallPackageRequestSchema>;\n\n/**\n * Install Package Response\n */\nexport const InstallPackageResponseSchema = z.object({\n package: InstalledPackageSchema,\n message: z.string().optional(),\n});\nexport type InstallPackageResponse = z.infer<typeof InstallPackageResponseSchema>;\n\n/**\n * Uninstall Package Request\n */\nexport const UninstallPackageRequestSchema = z.object({\n /** Package ID to uninstall */\n id: z.string(),\n});\nexport type UninstallPackageRequest = z.infer<typeof UninstallPackageRequestSchema>;\n\n/**\n * Uninstall Package Response\n */\nexport const UninstallPackageResponseSchema = z.object({\n id: z.string(),\n success: z.boolean(),\n message: z.string().optional(),\n});\nexport type UninstallPackageResponse = z.infer<typeof UninstallPackageResponseSchema>;\n\n/**\n * Enable Package Request\n */\nexport const EnablePackageRequestSchema = z.object({\n /** Package ID to enable */\n id: z.string(),\n});\nexport type EnablePackageRequest = z.infer<typeof EnablePackageRequestSchema>;\n\n/**\n * Enable Package Response\n */\nexport const EnablePackageResponseSchema = z.object({\n package: InstalledPackageSchema,\n message: z.string().optional(),\n});\nexport type EnablePackageResponse = z.infer<typeof EnablePackageResponseSchema>;\n\n/**\n * Disable Package Request\n */\nexport const DisablePackageRequestSchema = z.object({\n /** Package ID to disable */\n id: z.string(),\n});\nexport type DisablePackageRequest = z.infer<typeof DisablePackageRequestSchema>;\n\n/**\n * Disable Package Response\n */\nexport const DisablePackageResponseSchema = z.object({\n package: InstalledPackageSchema,\n message: z.string().optional(),\n});\nexport type DisablePackageResponse = z.infer<typeof DisablePackageResponseSchema>;\n","// Copyright (c) 2025 ObjectStack. Licensed under the Apache-2.0 license.\n\nimport { z } from 'zod';\nimport { PluginCapabilityManifestSchema } from './plugin-capability.zod';\nimport { PluginLoadingConfigSchema } from './plugin-loading.zod';\nimport { CORE_PLUGIN_TYPES } from './plugin.zod';\nimport { DatasetSchema } from '../data/dataset.zod';\n\n/**\n * Schema for the ObjectStack Manifest.\n * This defines the structure of a package configuration in the ObjectStack ecosystem.\n * All packages (apps, plugins, drivers, modules) must conform to this schema.\n * \n * @example App Package\n * ```yaml\n * id: com.acme.crm\n * version: 1.0.0\n * type: app\n * name: Acme CRM\n * description: Customer Relationship Management system\n * permissions:\n * - system.user.read\n * - system.object.create\n * objects:\n * - \"./src/objects/*.object.yml\"\n * ```\n */\nexport const ManifestSchema = z.object({\n /** \n * Unique package identifier using reverse domain notation.\n * Must be unique across the entire ecosystem.\n * \n * @example \"com.steedos.crm\"\n * @example \"org.apache.superset\"\n */\n id: z.string().describe('Unique package identifier (reverse domain style)'),\n \n /**\n * Short namespace identifier for metadata scoping.\n * Used as a prefix for objects and other metadata to prevent naming collisions\n * across packages from different vendors.\n * \n * Rules:\n * - 2-20 characters, lowercase letters, digits, and underscores only.\n * - Must be unique within a running instance.\n * - Platform-reserved namespaces (no prefix applied): \"base\", \"system\".\n * - FQN (Fully Qualified Name) = `{namespace}__{short_name}` (double underscore separator).\n * \n * @example \"crm\" → objects become crm__account, crm__deal\n * @example \"todo\" → objects become todo__task\n * @example \"base\" → objects keep short name (platform reserved)\n */\n namespace: z.string()\n .regex(/^[a-z][a-z0-9_]{1,19}$/, 'Namespace must be 2-20 chars, lowercase alphanumeric + underscore')\n .optional()\n .describe('Short namespace identifier for metadata scoping (e.g. \"crm\", \"todo\")'),\n \n /** \n * Package version following semantic versioning (major.minor.patch).\n * \n * @example \"1.0.0\"\n * @example \"2.1.0-beta.1\"\n */\n version: z.string().regex(/^\\d+\\.\\d+\\.\\d+$/).describe('Package version (semantic versioning)'),\n \n /** \n * Type of the package in the ObjectStack ecosystem.\n * - plugin: General-purpose functionality extension (Runtime: standard)\n * - app: Business application package\n * - driver: Connectivity adapter\n * - server: Protocol gateway (Hono, GraphQL)\n * - ui: Frontend package (Static/SPA)\n * - theme: UI Theme\n * - agent: AI Agent\n * - module: Reusable code library/shared module\n * - objectql: Core engine\n * - adapter: Host adapter (Express, Fastify)\n */\n type: z.enum([\n 'plugin', \n ...CORE_PLUGIN_TYPES,\n 'module', \n 'gateway', // Deprecated: use 'server'\n 'adapter'\n ]).describe('Type of package'),\n \n /** \n * Human-readable name of the package.\n * Displayed in the UI for users.\n * \n * @example \"Project Management\"\n */\n name: z.string().describe('Human-readable package name'),\n \n /** \n * Brief description of the package functionality.\n * Displayed in the marketplace and plugin manager.\n */\n description: z.string().optional().describe('Package description'),\n \n /** \n * Array of permission strings that the package requires.\n * These form the \"Scope\" requested by the package at installation.\n * \n * @example [\"system.user.read\", \"system.data.write\"]\n */\n permissions: z.array(z.string()).optional().describe('Array of required permission strings'),\n \n /** \n * Glob patterns specifying ObjectQL schemas files.\n * Matches `*.object.yml` or `*.object.ts` files to load business objects.\n * \n * @example [\"./src/objects/*.object.yml\"]\n */\n objects: z.array(z.string()).optional().describe('Glob patterns for ObjectQL schemas files'),\n\n /**\n * Defines system level DataSources.\n * Matches `*.datasource.yml` files.\n * \n * @example [\"./src/datasources/*.datasource.mongo.yml\"]\n */\n datasources: z.array(z.string()).optional().describe('Glob patterns for Datasource definitions'),\n\n /**\n * Package Dependencies.\n * Map of package IDs to version requirements.\n * \n * @example { \"@steedos/plugin-auth\": \"^2.0.0\" }\n */\n dependencies: z.record(z.string(), z.string()).optional().describe('Package dependencies'),\n\n /**\n * Plugin Configuration Schema.\n * Defines the settings this plugin exposes to the user via UI/ENV.\n * Uses a simplified JSON Schema format.\n * \n * @example\n * {\n * \"title\": \"Stripe Config\",\n * \"properties\": {\n * \"apiKey\": { \"type\": \"string\", \"secret\": true },\n * \"currency\": { \"type\": \"string\", \"default\": \"USD\" }\n * }\n * }\n */\n configuration: z.object({\n title: z.string().optional(),\n properties: z.record(z.string(), z.object({\n type: z.enum(['string', 'number', 'boolean', 'array', 'object']).describe('Data type of the setting'),\n default: z.unknown().optional().describe('Default value'),\n description: z.string().optional().describe('Tooltip description'),\n required: z.boolean().optional().describe('Is this setting required?'),\n secret: z.boolean().optional().describe('If true, value is encrypted/masked (e.g. API Keys)'),\n enum: z.array(z.string()).optional().describe('Allowed values for select inputs'),\n })).describe('Map of configuration keys to their definitions')\n }).optional().describe('Plugin configuration settings'),\n\n /**\n * Contribution Points (VS Code Style).\n * formalized way to extend the platform capabilities.\n */\n contributes: z.object({\n /**\n * Register new Metadata Kinds (CRDs).\n * Enables the system to parse and validate new file types.\n * Example: Registering a BI plugin to handle *.report.ts\n */\n kinds: z.array(z.object({\n id: z.string().describe('The generic identifier of the kind (e.g., \"sys.bi.report\")'),\n globs: z.array(z.string()).describe('File patterns to watch (e.g., [\"**/*.report.ts\"])'),\n description: z.string().optional().describe('Description of what this kind represents'),\n })).optional().describe('New Metadata Types to recognize'),\n\n /**\n * Register System Hooks.\n * Declares that this plugin listens to specific system events.\n */\n events: z.array(z.string()).optional().describe('Events this plugin listens to'),\n\n /**\n * Register UI Menus.\n */\n menus: z.record(z.string(), z.array(z.object({\n id: z.string(),\n label: z.string(),\n command: z.string().optional(),\n }))).optional().describe('UI Menu contributions'),\n\n /**\n * Register Custom Themes.\n */\n themes: z.array(z.object({\n id: z.string(),\n label: z.string(),\n path: z.string(),\n })).optional().describe('Theme contributions'),\n\n /**\n * Register Translations.\n * Path to translation files (e.g. \"locales/en.json\").\n */\n translations: z.array(z.object({\n locale: z.string(),\n path: z.string(),\n })).optional().describe('Translation resources'),\n\n /**\n * Register Server Actions.\n * Invocable functions exposed to Flows or API.\n */\n actions: z.array(z.object({\n name: z.string().describe('Unique action name'),\n label: z.string().optional(),\n description: z.string().optional(),\n input: z.unknown().optional().describe('Input validation schema'),\n output: z.unknown().optional().describe('Output schema'),\n })).optional().describe('Exposed server actions'),\n\n /**\n * Register Storage Drivers.\n * Enables connecting to new types of datasources.\n */\n drivers: z.array(z.object({\n id: z.string().describe('Driver unique identifier (e.g. \"postgres\", \"mongo\")'),\n label: z.string().describe('Human readable name'),\n description: z.string().optional(),\n })).optional().describe('Driver contributions'),\n\n /**\n * Register Custom Field Types.\n * Extends the data model with new widget types.\n */\n fieldTypes: z.array(z.object({\n name: z.string().describe('Unique field type name (e.g. \"vector\")'),\n label: z.string().describe('Display label'),\n description: z.string().optional(),\n })).optional().describe('Field Type contributions'),\n \n /**\n * Register Custom Query Operators/Functions.\n * Extends ObjectQL with new functions (e.g. distance()).\n */\n functions: z.array(z.object({\n name: z.string().describe('Function name (e.g. \"distance\")'),\n description: z.string().optional(),\n args: z.array(z.string()).optional().describe('Argument types'),\n returnType: z.string().optional(),\n })).optional().describe('Query Function contributions'),\n\n /**\n * Register API Route Namespaces.\n * Declares the API endpoints this plugin provides to the HttpDispatcher.\n * The kernel routes matching prefixes to this plugin's handler.\n * \n * @example\n * routes: [\n * { prefix: '/api/v1/ai', service: 'ai', methods: ['aiNlq', 'aiChat'] }\n * ]\n */\n routes: z.array(z.object({\n /** URL path prefix (e.g. \"/api/v1/ai\") */\n prefix: z.string().regex(/^\\//).describe('API path prefix'),\n /** Service name this plugin provides */\n service: z.string().describe('Service name this plugin provides'),\n /** Protocol method names implemented */\n methods: z.array(z.string()).optional()\n .describe('Protocol method names implemented (e.g. [\"aiNlq\", \"aiChat\"])'),\n })).optional().describe('API route contributions to HttpDispatcher'),\n\n /**\n * Register CLI Commands.\n * Allows plugins to extend the ObjectStack CLI with custom commands.\n * Each command entry declares metadata; the actual Commander.js command\n * is resolved at runtime by importing the plugin's module.\n * \n * The plugin package must export a `commands` array of Commander.js `Command` instances\n * from its main entry point or from the path specified in `module`.\n * \n * @example\n * ```yaml\n * commands:\n * - name: marketplace\n * description: \"Manage marketplace apps\"\n * module: \"./cli\" # optional, defaults to package main\n * - name: deploy\n * description: \"Deploy to cloud\"\n * ```\n */\n commands: z.array(z.object({\n /** CLI command name (e.g., \"marketplace\", \"deploy\"). Must be a valid CLI identifier. */\n name: z.string()\n .regex(/^[a-z][a-z0-9-]*$/, 'Command name must be lowercase alphanumeric with hyphens')\n .describe('CLI command name'),\n /** Brief description shown in `os --help` */\n description: z.string().optional().describe('Command description for help text'),\n /** \n * Optional module path (relative to package root) that exports the Commander.js commands.\n * If omitted, the CLI will import from the package's main entry point.\n * The module must export a `commands` array of Commander.js `Command` instances,\n * or a single `Command` instance as default export.\n */\n module: z.string().optional().describe('Module path exporting Commander.js commands'),\n })).optional().describe('CLI command contributions'),\n }).optional().describe('Platform contributions'),\n\n /** \n * Initial data seeding configuration.\n * Defines default records to be inserted when the package is installed.\n * \n * Uses the standard DatasetSchema which supports idempotent upsert via\n * `externalId`, environment scoping via `env`, and multiple conflict\n * resolution modes.\n * \n * @deprecated Prefer using the top-level `data` field on the Stack Definition\n * (defineStack({ data: [...] })) for better visibility and metadata registration.\n * This field is retained for backward compatibility with manifest-only packages.\n */\n data: z.array(DatasetSchema).optional().describe('Initial seed data (prefer top-level data field)'),\n\n /**\n * Plugin Capability Manifest.\n * Declares protocols implemented, interfaces provided, dependencies, and extension points.\n * This enables plugin interoperability and automatic discovery.\n */\n capabilities: PluginCapabilityManifestSchema.optional()\n .describe('Plugin capability declarations for interoperability'),\n\n /** \n * Extension points contributed by this package.\n * Allows packages to extend UI components, add functionality, etc.\n */\n extensions: z.record(z.string(), z.unknown()).optional().describe('Extension points and contributions'),\n\n /**\n * Plugin Loading Configuration.\n * Configures how the plugin is loaded, initialized, and managed at runtime.\n * Includes strategies for lazy loading, code splitting, caching, and hot reload.\n */\n loading: PluginLoadingConfigSchema.optional()\n .describe('Plugin loading and runtime behavior configuration'),\n});\n\n/**\n * TypeScript type inferred from the ManifestSchema.\n * Use this type for type-safe manifest handling in TypeScript code.\n */\nexport type ObjectStackManifest = z.infer<typeof ManifestSchema>;\nexport type ObjectStackManifestInput = z.input<typeof ManifestSchema>;\n\n","// Copyright (c) 2025 ObjectStack. Licensed under the Apache-2.0 license.\n\nimport { z } from 'zod';\n\n/**\n * # Plugin Capability Protocol\n * \n * Defines the standard way plugins declare their capabilities, implementations,\n * and conformance levels to ensure interoperability across vendors.\n * \n * Based on the Protocol-Oriented Architecture pattern similar to:\n * - Kubernetes CRDs (Custom Resource Definitions)\n * - OSGi Service Registry\n * - Eclipse Extension Points\n */\n\n/**\n * Capability Conformance Level\n * Indicates how completely a plugin implements a given protocol.\n */\nexport const CapabilityConformanceLevelSchema = z.enum([\n 'full', // Complete implementation of all protocol features\n 'partial', // Subset implementation with specific features listed\n 'experimental', // Unstable/preview implementation\n 'deprecated', // Still supported but scheduled for removal\n]).describe('Level of protocol conformance');\n\n/**\n * Protocol Version Schema\n * Uses semantic versioning to track protocol evolution.\n */\nexport const ProtocolVersionSchema = z.object({\n major: z.number().int().min(0),\n minor: z.number().int().min(0),\n patch: z.number().int().min(0),\n}).describe('Semantic version of the protocol');\n\n/**\n * Protocol Reference\n * Uniquely identifies a protocol/interface that a plugin can implement.\n * \n * Examples:\n * - com.objectstack.protocol.storage.v1\n * - com.objectstack.protocol.auth.oauth2.v2\n * - com.acme.protocol.payment.stripe.v1\n */\nexport const ProtocolReferenceSchema = z.object({\n /**\n * Protocol identifier using reverse domain notation.\n * Format: {domain}.protocol.{category}.{name}[.{subcategory}].v{major}\n */\n id: z.string()\n .regex(/^([a-z][a-z0-9]*\\.)+protocol\\.[a-z][a-z0-9._]*\\.v\\d+$/)\n .describe('Unique protocol identifier (e.g., com.objectstack.protocol.storage.v1)'),\n \n /**\n * Human-readable protocol name\n */\n label: z.string(),\n \n /**\n * Protocol version\n */\n version: ProtocolVersionSchema,\n \n /**\n * Detailed protocol specification URL or file reference\n */\n specification: z.string().optional().describe('URL or path to protocol specification'),\n \n /**\n * Brief description of what this protocol defines\n */\n description: z.string().optional(),\n});\n\n/**\n * Protocol Feature\n * Represents a specific capability within a protocol.\n */\nexport const ProtocolFeatureSchema = z.object({\n name: z.string().describe('Feature identifier within the protocol'),\n enabled: z.boolean().default(true),\n description: z.string().optional(),\n sinceVersion: z.string().optional().describe('Version when this feature was added'),\n deprecatedSince: z.string().optional().describe('Version when deprecated'),\n});\n\n/**\n * Plugin Capability Declaration\n * Documents what protocols a plugin implements and to what extent.\n */\nexport const PluginCapabilitySchema = z.object({\n /**\n * The protocol being implemented\n */\n protocol: ProtocolReferenceSchema,\n \n /**\n * Conformance level\n */\n conformance: CapabilityConformanceLevelSchema.default('full'),\n \n /**\n * Specific features implemented (required if conformance is 'partial')\n */\n implementedFeatures: z.array(z.string()).optional().describe('List of implemented feature names'),\n \n /**\n * Optional feature flags indicating advanced capabilities\n */\n features: z.array(ProtocolFeatureSchema).optional(),\n \n /**\n * Custom metadata for vendor-specific information\n */\n metadata: z.record(z.string(), z.unknown()).optional(),\n \n /**\n * Testing/Certification status\n */\n certified: z.boolean().default(false).describe('Has passed official conformance tests'),\n certificationDate: z.string().datetime().optional(),\n});\n\n/**\n * Plugin Interface Declaration\n * Defines the contract for services this plugin provides to other plugins.\n */\nexport const PluginInterfaceSchema = z.object({\n /**\n * Unique interface identifier\n * Format: {plugin-id}.interface.{name}\n */\n id: z.string()\n .regex(/^([a-z][a-z0-9]*\\.)+interface\\.[a-z][a-z0-9._]+$/)\n .describe('Unique interface identifier'),\n \n /**\n * Interface name\n */\n name: z.string(),\n \n /**\n * Description of what this interface provides\n */\n description: z.string().optional(),\n \n /**\n * Interface version\n */\n version: ProtocolVersionSchema,\n \n /**\n * Methods exposed by this interface\n */\n methods: z.array(z.object({\n name: z.string().describe('Method name'),\n description: z.string().optional(),\n parameters: z.array(z.object({\n name: z.string(),\n type: z.string().describe('Type notation (e.g., string, number, User)'),\n required: z.boolean().default(true),\n description: z.string().optional(),\n })).optional(),\n returnType: z.string().optional().describe('Return value type'),\n async: z.boolean().default(false).describe('Whether method returns a Promise'),\n })),\n \n /**\n * Events emitted by this interface\n */\n events: z.array(z.object({\n name: z.string().describe('Event name'),\n description: z.string().optional(),\n payload: z.string().optional().describe('Event payload type'),\n })).optional(),\n \n /**\n * Stability level\n */\n stability: z.enum(['stable', 'beta', 'alpha', 'experimental']).default('stable'),\n});\n\n/**\n * Plugin Dependency Declaration\n * Specifies what other plugins or capabilities this plugin requires.\n */\nexport const PluginDependencySchema = z.object({\n /**\n * Plugin ID using reverse domain notation\n */\n pluginId: z.string()\n .regex(/^([a-z][a-z0-9]*\\.)+[a-z][a-z0-9-]+$/)\n .describe('Required plugin identifier'),\n \n /**\n * Version constraint (supports semver ranges)\n * Examples: \"1.0.0\", \"^1.2.3\", \">=2.0.0 <3.0.0\"\n */\n version: z.string().describe('Semantic version constraint'),\n \n /**\n * Whether this dependency is optional\n */\n optional: z.boolean().default(false),\n \n /**\n * Reason for the dependency\n */\n reason: z.string().optional(),\n \n /**\n * Minimum required capabilities from the dependency\n */\n requiredCapabilities: z.array(z.string()).optional().describe('Protocol IDs the dependency must support'),\n});\n\n/**\n * Extension Point Declaration\n * Defines hooks where other plugins can extend this plugin's functionality.\n */\nexport const ExtensionPointSchema = z.object({\n /**\n * Extension point identifier\n */\n id: z.string()\n .regex(/^([a-z][a-z0-9]*\\.)+extension\\.[a-z][a-z0-9._]+$/)\n .describe('Unique extension point identifier'),\n \n /**\n * Extension point name\n */\n name: z.string(),\n \n /**\n * Description\n */\n description: z.string().optional(),\n \n /**\n * Type of extension point\n */\n type: z.enum([\n 'action', // Plugins can register executable actions\n 'hook', // Plugins can listen to lifecycle events\n 'widget', // Plugins can contribute UI widgets\n 'provider', // Plugins can provide data/services\n 'transformer', // Plugins can transform data\n 'validator', // Plugins can validate data\n 'decorator', // Plugins can enhance/wrap functionality\n ]),\n \n /**\n * Expected interface contract for extensions\n */\n contract: z.object({\n input: z.string().optional().describe('Input type/schema'),\n output: z.string().optional().describe('Output type/schema'),\n signature: z.string().optional().describe('Function signature if applicable'),\n }).optional(),\n \n /**\n * Cardinality\n */\n cardinality: z.enum(['single', 'multiple']).default('multiple')\n .describe('Whether multiple extensions can register to this point'),\n});\n\n/**\n * Complete Plugin Capability Manifest\n * This is included in the main plugin manifest to declare all capabilities.\n */\nexport const PluginCapabilityManifestSchema = z.object({\n /**\n * Protocols this plugin implements\n */\n implements: z.array(PluginCapabilitySchema).optional()\n .describe('List of protocols this plugin conforms to'),\n \n /**\n * Interfaces this plugin exposes to other plugins\n */\n provides: z.array(PluginInterfaceSchema).optional()\n .describe('Services/APIs this plugin offers to others'),\n \n /**\n * Dependencies on other plugins\n */\n requires: z.array(PluginDependencySchema).optional()\n .describe('Required plugins and their capabilities'),\n \n /**\n * Extension points this plugin defines\n */\n extensionPoints: z.array(ExtensionPointSchema).optional()\n .describe('Points where other plugins can extend this plugin'),\n \n /**\n * Extensions this plugin contributes to other plugins\n */\n extensions: z.array(z.object({\n targetPluginId: z.string().describe('Plugin ID being extended'),\n extensionPointId: z.string().describe('Extension point identifier'),\n implementation: z.string().describe('Path to implementation module'),\n priority: z.number().int().default(100).describe('Registration priority (lower = higher priority)'),\n })).optional().describe('Extensions contributed to other plugins'),\n});\n\n// Export types\nexport type CapabilityConformanceLevel = z.infer<typeof CapabilityConformanceLevelSchema>;\nexport type ProtocolVersion = z.infer<typeof ProtocolVersionSchema>;\nexport type ProtocolReference = z.infer<typeof ProtocolReferenceSchema>;\nexport type ProtocolFeature = z.infer<typeof ProtocolFeatureSchema>;\nexport type PluginCapability = z.infer<typeof PluginCapabilitySchema>;\nexport type PluginInterface = z.infer<typeof PluginInterfaceSchema>;\nexport type PluginDependency = z.infer<typeof PluginDependencySchema>;\nexport type ExtensionPoint = z.infer<typeof ExtensionPointSchema>;\nexport type PluginCapabilityManifest = z.infer<typeof PluginCapabilityManifestSchema>;\n","// Copyright (c) 2025 ObjectStack. Licensed under the Apache-2.0 license.\n\nimport { z } from 'zod';\n\n/**\n * # Plugin Loading Protocol\n * \n * Defines the enhanced plugin loading mechanism for the microkernel architecture.\n * Inspired by industry best practices from:\n * - Kubernetes CRDs and Operators\n * - OSGi Dynamic Module System\n * - Eclipse Plugin Framework\n * - Webpack Module Federation\n * \n * This protocol enables:\n * - Lazy loading and code splitting\n * - Dynamic imports and parallel initialization\n * - Capability-based discovery\n * - Hot reload in development\n * - Advanced caching strategies\n */\n\n/**\n * Plugin Loading Strategy\n * Determines how and when a plugin is loaded into memory\n */\nexport const PluginLoadingStrategySchema = z.enum([\n 'eager', // Load immediately during bootstrap (critical plugins)\n 'lazy', // Load on first use (feature plugins)\n 'parallel', // Load in parallel with other plugins\n 'deferred', // Load after initial bootstrap complete\n 'on-demand', // Load only when explicitly requested\n]).describe('Plugin loading strategy');\n\n/**\n * Plugin Preloading Configuration\n * Configures preloading behavior for faster activation\n */\nexport const PluginPreloadConfigSchema = z.object({\n /**\n * Enable preloading for this plugin\n */\n enabled: z.boolean().default(false),\n \n /**\n * Preload priority (lower = higher priority)\n */\n priority: z.number().int().min(0).default(100),\n \n /**\n * Resources to preload\n */\n resources: z.array(z.enum([\n 'metadata', // Plugin manifest and metadata\n 'dependencies', // Plugin dependencies\n 'assets', // Static assets (icons, translations)\n 'code', // JavaScript code chunks\n 'services', // Service definitions\n ])).optional(),\n \n /**\n * Conditions for preloading\n */\n conditions: z.object({\n /**\n * Preload only on specific routes\n */\n routes: z.array(z.string()).optional(),\n \n /**\n * Preload only for specific user roles\n */\n roles: z.array(z.string()).optional(),\n \n /**\n * Preload based on device type\n */\n deviceType: z.array(z.enum(['desktop', 'mobile', 'tablet'])).optional(),\n \n /**\n * Network connection quality threshold\n */\n minNetworkSpeed: z.enum(['slow-2g', '2g', '3g', '4g']).optional(),\n }).optional(),\n}).describe('Plugin preloading configuration');\n\n/**\n * Plugin Code Splitting Configuration\n * Configures how plugin code is split for optimal loading\n */\nexport const PluginCodeSplittingSchema = z.object({\n /**\n * Enable code splitting for this plugin\n */\n enabled: z.boolean().default(true),\n \n /**\n * Split strategy\n */\n strategy: z.enum([\n 'route', // Split by UI routes\n 'feature', // Split by feature modules\n 'size', // Split by bundle size threshold\n 'custom', // Custom split points defined by plugin\n ]).default('feature'),\n \n /**\n * Chunk naming strategy\n */\n chunkNaming: z.enum(['hashed', 'named', 'sequential']).default('hashed'),\n \n /**\n * Maximum chunk size in KB\n */\n maxChunkSize: z.number().int().min(10).optional().describe('Max chunk size in KB'),\n \n /**\n * Shared dependencies optimization\n */\n sharedDependencies: z.object({\n enabled: z.boolean().default(true),\n /**\n * Minimum times a module must be shared before extraction\n */\n minChunks: z.number().int().min(1).default(2),\n }).optional(),\n}).describe('Plugin code splitting configuration');\n\n/**\n * Plugin Dynamic Import Configuration\n * Configures dynamic import behavior for runtime module loading\n */\nexport const PluginDynamicImportSchema = z.object({\n /**\n * Enable dynamic imports\n */\n enabled: z.boolean().default(true),\n \n /**\n * Import mode\n */\n mode: z.enum([\n 'async', // Asynchronous import (recommended)\n 'sync', // Synchronous import (blocking)\n 'eager', // Eager evaluation\n 'lazy', // Lazy evaluation\n ]).default('async'),\n \n /**\n * Prefetch strategy\n */\n prefetch: z.boolean().default(false).describe('Prefetch module in idle time'),\n \n /**\n * Preload strategy\n */\n preload: z.boolean().default(false).describe('Preload module in parallel with parent'),\n \n /**\n * Webpack magic comments support\n */\n webpackChunkName: z.string().optional().describe('Custom chunk name for webpack'),\n \n /**\n * Import timeout in milliseconds\n */\n timeout: z.number().int().min(100).default(30000).describe('Dynamic import timeout (ms)'),\n \n /**\n * Retry configuration on import failure\n */\n retry: z.object({\n enabled: z.boolean().default(true),\n maxAttempts: z.number().int().min(1).max(10).default(3),\n backoffMs: z.number().int().min(0).default(1000).describe('Exponential backoff base delay'),\n }).optional(),\n}).describe('Plugin dynamic import configuration');\n\n/**\n * Plugin Initialization Configuration\n * Configures how plugin initialization is executed\n */\nexport const PluginInitializationSchema = z.object({\n /**\n * Initialization mode\n */\n mode: z.enum([\n 'sync', // Synchronous initialization\n 'async', // Asynchronous initialization\n 'parallel', // Parallel with other plugins\n 'sequential', // Must complete before next plugin\n ]).default('async'),\n \n /**\n * Initialization timeout in milliseconds\n */\n timeout: z.number().int().min(100).default(30000),\n \n /**\n * Startup priority (lower = higher priority, earlier initialization)\n */\n priority: z.number().int().min(0).default(100),\n \n /**\n * Whether to continue bootstrap if this plugin fails\n */\n critical: z.boolean().default(false).describe('If true, kernel bootstrap fails if plugin fails'),\n \n /**\n * Retry configuration on initialization failure\n */\n retry: z.object({\n enabled: z.boolean().default(false),\n maxAttempts: z.number().int().min(1).max(5).default(3),\n backoffMs: z.number().int().min(0).default(1000),\n }).optional(),\n \n /**\n * Health check interval for monitoring\n */\n healthCheckInterval: z.number().int().min(0).optional().describe('Health check interval in ms (0 = disabled)'),\n}).describe('Plugin initialization configuration');\n\n/**\n * Plugin Dependency Resolution Configuration\n * Advanced dependency resolution using semantic versioning\n */\nexport const PluginDependencyResolutionSchema = z.object({\n /**\n * Dependency resolution strategy\n */\n strategy: z.enum([\n 'strict', // Exact version match required\n 'compatible', // Semver compatible versions (^)\n 'latest', // Always use latest compatible\n 'pinned', // Lock to specific version\n ]).default('compatible'),\n \n /**\n * Peer dependency handling\n */\n peerDependencies: z.object({\n /**\n * Whether to resolve peer dependencies\n */\n resolve: z.boolean().default(true),\n \n /**\n * Action on missing peer dependency\n */\n onMissing: z.enum(['error', 'warn', 'ignore']).default('warn'),\n \n /**\n * Action on peer version mismatch\n */\n onMismatch: z.enum(['error', 'warn', 'ignore']).default('warn'),\n }).optional(),\n \n /**\n * Optional dependency handling\n */\n optionalDependencies: z.object({\n /**\n * Whether to attempt loading optional dependencies\n */\n load: z.boolean().default(true),\n \n /**\n * Action on optional dependency load failure\n */\n onFailure: z.enum(['warn', 'ignore']).default('warn'),\n }).optional(),\n \n /**\n * Conflict resolution\n */\n conflictResolution: z.enum([\n 'fail', // Fail on any version conflict\n 'latest', // Use latest version\n 'oldest', // Use oldest version\n 'manual', // Require manual resolution\n ]).default('latest'),\n \n /**\n * Circular dependency handling\n */\n circularDependencies: z.enum([\n 'error', // Throw error on circular dependency\n 'warn', // Warn but continue\n 'allow', // Allow circular dependencies\n ]).default('warn'),\n}).describe('Plugin dependency resolution configuration');\n\n/**\n * Plugin Hot Reload Configuration\n * Enables hot module replacement for development and production environments.\n * \n * Production mode adds safety features: health validation, rollback on failure,\n * connection draining, and concurrency control for zero-downtime reloads.\n */\nexport const PluginHotReloadSchema = z.object({\n /**\n * Enable hot reload\n */\n enabled: z.boolean().default(false),\n \n /**\n * Target environment for hot reload behavior\n */\n environment: z.enum([\n 'development', // Fast reload with relaxed safety (file watchers, no health validation)\n 'staging', // Production-like reload with validation but relaxed rollback\n 'production', // Full safety: health validation, rollback, connection draining\n ]).default('development').describe('Target environment controlling safety level'),\n \n /**\n * Hot reload strategy\n */\n strategy: z.enum([\n 'full', // Full plugin reload (destroy and reinitialize)\n 'partial', // Partial reload (update changed modules only)\n 'state-preserve', // Preserve plugin state during reload\n ]).default('full'),\n \n /**\n * Files to watch for changes\n */\n watchPatterns: z.array(z.string()).optional().describe('Glob patterns for files to watch'),\n \n /**\n * Files to ignore\n */\n ignorePatterns: z.array(z.string()).optional().describe('Glob patterns for files to ignore'),\n \n /**\n * Debounce delay in milliseconds\n */\n debounceMs: z.number().int().min(0).default(300),\n \n /**\n * Whether to preserve state during reload\n */\n preserveState: z.boolean().default(false),\n \n /**\n * State serialization\n */\n stateSerialization: z.object({\n enabled: z.boolean().default(false),\n /**\n * Path to state serialization handler\n */\n handler: z.string().optional(),\n }).optional(),\n \n /**\n * Hooks for hot reload lifecycle\n */\n hooks: z.object({\n beforeReload: z.string().optional().describe('Function to call before reload'),\n afterReload: z.string().optional().describe('Function to call after reload'),\n onError: z.string().optional().describe('Function to call on reload error'),\n }).optional(),\n \n /**\n * Production safety configuration\n * Applied when environment is 'staging' or 'production'\n */\n productionSafety: z.object({\n /**\n * Validate plugin health before completing reload\n */\n healthValidation: z.boolean().default(true)\n .describe('Run health checks after reload before accepting traffic'),\n \n /**\n * Automatically rollback to previous version on reload failure\n */\n rollbackOnFailure: z.boolean().default(true)\n .describe('Auto-rollback if reloaded plugin fails health check'),\n \n /**\n * Maximum time to wait for health validation after reload (ms)\n */\n healthTimeout: z.number().int().min(1000).default(30000)\n .describe('Health check timeout after reload in ms'),\n \n /**\n * Drain active connections before reload\n */\n drainConnections: z.boolean().default(true)\n .describe('Gracefully drain active requests before reloading'),\n \n /**\n * Maximum time to wait for connection draining (ms)\n */\n drainTimeout: z.number().int().min(0).default(15000)\n .describe('Max wait time for connection draining in ms'),\n \n /**\n * Maximum number of concurrent plugin reloads\n */\n maxConcurrentReloads: z.number().int().min(1).default(1)\n .describe('Limit concurrent reloads to prevent system instability'),\n \n /**\n * Minimum interval between reloads of the same plugin (ms)\n */\n minReloadInterval: z.number().int().min(1000).default(5000)\n .describe('Cooldown period between reloads of the same plugin'),\n }).optional(),\n}).describe('Plugin hot reload configuration');\n\n/**\n * Plugin Caching Configuration\n * Configures caching strategy for faster subsequent loads\n */\nexport const PluginCachingSchema = z.object({\n /**\n * Enable caching\n */\n enabled: z.boolean().default(true),\n \n /**\n * Cache storage type\n */\n storage: z.enum([\n 'memory', // In-memory cache (fastest, not persistent)\n 'disk', // Disk cache (persistent)\n 'indexeddb', // Browser IndexedDB (persistent, browser only)\n 'hybrid', // Memory + Disk hybrid\n ]).default('memory'),\n \n /**\n * Cache key strategy\n */\n keyStrategy: z.enum([\n 'version', // Cache by plugin version\n 'hash', // Cache by content hash\n 'timestamp', // Cache by last modified timestamp\n ]).default('version'),\n \n /**\n * Cache TTL in seconds\n */\n ttl: z.number().int().min(0).optional().describe('Time to live in seconds (0 = infinite)'),\n \n /**\n * Maximum cache size in MB\n */\n maxSize: z.number().int().min(1).optional().describe('Max cache size in MB'),\n \n /**\n * Cache invalidation triggers\n */\n invalidateOn: z.array(z.enum([\n 'version-change',\n 'dependency-change',\n 'manual',\n 'error',\n ])).optional(),\n \n /**\n * Compression\n */\n compression: z.object({\n enabled: z.boolean().default(false),\n algorithm: z.enum(['gzip', 'brotli', 'deflate']).default('gzip'),\n }).optional(),\n}).describe('Plugin caching configuration');\n\n/**\n * Plugin Sandboxing Configuration\n * Security isolation for plugins with configurable scope.\n * \n * Supports isolation beyond automation scripts: any plugin can be sandboxed\n * with process-level isolation and inter-plugin communication (IPC).\n */\nexport const PluginSandboxingSchema = z.object({\n /**\n * Enable sandboxing\n */\n enabled: z.boolean().default(false),\n \n /**\n * Isolation scope - which plugins are subject to sandboxing\n */\n scope: z.enum([\n 'automation-only', // Sandbox automation/scripting plugins only (current behavior)\n 'untrusted-only', // Sandbox plugins below a trust threshold\n 'all-plugins', // Sandbox all plugins (maximum isolation)\n ]).default('automation-only').describe('Which plugins are subject to isolation'),\n \n /**\n * Sandbox isolation level\n */\n isolationLevel: z.enum([\n 'none', // No isolation\n 'process', // Separate process (Node.js worker threads)\n 'vm', // VM context isolation\n 'iframe', // iframe isolation (browser)\n 'web-worker', // Web Worker (browser)\n ]).default('none'),\n \n /**\n * Allowed capabilities\n */\n allowedCapabilities: z.array(z.string()).optional().describe('List of allowed capability IDs'),\n \n /**\n * Resource quotas\n */\n resourceQuotas: z.object({\n /**\n * Maximum memory usage in MB\n */\n maxMemoryMB: z.number().int().min(1).optional(),\n \n /**\n * Maximum CPU time in milliseconds\n */\n maxCpuTimeMs: z.number().int().min(100).optional(),\n \n /**\n * Maximum number of file descriptors\n */\n maxFileDescriptors: z.number().int().min(1).optional(),\n \n /**\n * Maximum network bandwidth in KB/s\n */\n maxNetworkKBps: z.number().int().min(1).optional(),\n }).optional(),\n \n /**\n * Permissions\n */\n permissions: z.object({\n /**\n * Allowed API access\n */\n allowedAPIs: z.array(z.string()).optional(),\n \n /**\n * Allowed file system paths\n */\n allowedPaths: z.array(z.string()).optional(),\n \n /**\n * Allowed network endpoints\n */\n allowedEndpoints: z.array(z.string()).optional(),\n \n /**\n * Allowed environment variables\n */\n allowedEnvVars: z.array(z.string()).optional(),\n }).optional(),\n \n /**\n * Inter-Plugin Communication (IPC) configuration\n * Enables isolated plugins to communicate with the kernel and other plugins\n */\n ipc: z.object({\n /**\n * Enable IPC for sandboxed plugins\n */\n enabled: z.boolean().default(true)\n .describe('Allow sandboxed plugins to communicate via IPC'),\n \n /**\n * IPC transport mechanism\n */\n transport: z.enum([\n 'message-port', // MessagePort (worker threads / Web Workers)\n 'unix-socket', // Unix domain sockets (process isolation)\n 'tcp', // TCP sockets (container isolation)\n 'memory', // Shared memory channel (in-process VM)\n ]).default('message-port')\n .describe('IPC transport for cross-boundary communication'),\n \n /**\n * Maximum message size in bytes\n */\n maxMessageSize: z.number().int().min(1024).default(1048576)\n .describe('Maximum IPC message size in bytes (default 1MB)'),\n \n /**\n * Message timeout in milliseconds\n */\n timeout: z.number().int().min(100).default(30000)\n .describe('IPC message response timeout in ms'),\n \n /**\n * Allowed service calls through IPC\n */\n allowedServices: z.array(z.string()).optional()\n .describe('Service names the sandboxed plugin may invoke via IPC'),\n }).optional(),\n}).describe('Plugin sandboxing configuration');\n\n/**\n * Plugin Performance Monitoring Configuration\n * Telemetry and performance tracking\n */\nexport const PluginPerformanceMonitoringSchema = z.object({\n /**\n * Enable performance monitoring\n */\n enabled: z.boolean().default(false),\n \n /**\n * Metrics to collect\n */\n metrics: z.array(z.enum([\n 'load-time',\n 'init-time',\n 'memory-usage',\n 'cpu-usage',\n 'api-calls',\n 'error-rate',\n 'cache-hit-rate',\n ])).optional(),\n \n /**\n * Sampling rate (0-1, where 1 = 100%)\n */\n samplingRate: z.number().min(0).max(1).default(1),\n \n /**\n * Reporting interval in seconds\n */\n reportingInterval: z.number().int().min(1).default(60),\n \n /**\n * Performance budget thresholds\n */\n budgets: z.object({\n /**\n * Maximum load time in milliseconds\n */\n maxLoadTimeMs: z.number().int().min(0).optional(),\n \n /**\n * Maximum init time in milliseconds\n */\n maxInitTimeMs: z.number().int().min(0).optional(),\n \n /**\n * Maximum memory usage in MB\n */\n maxMemoryMB: z.number().int().min(0).optional(),\n }).optional(),\n \n /**\n * Action on budget violation\n */\n onBudgetViolation: z.enum(['warn', 'error', 'ignore']).default('warn'),\n}).describe('Plugin performance monitoring configuration');\n\n/**\n * Complete Plugin Loading Configuration\n * Combines all loading-related configurations\n */\nexport const PluginLoadingConfigSchema = z.object({\n /**\n * Loading strategy\n */\n strategy: PluginLoadingStrategySchema.default('lazy'),\n \n /**\n * Preloading configuration\n */\n preload: PluginPreloadConfigSchema.optional(),\n \n /**\n * Code splitting configuration\n */\n codeSplitting: PluginCodeSplittingSchema.optional(),\n \n /**\n * Dynamic import configuration\n */\n dynamicImport: PluginDynamicImportSchema.optional(),\n \n /**\n * Initialization configuration\n */\n initialization: PluginInitializationSchema.optional(),\n \n /**\n * Dependency resolution configuration\n */\n dependencyResolution: PluginDependencyResolutionSchema.optional(),\n \n /**\n * Hot reload configuration (development and production)\n */\n hotReload: PluginHotReloadSchema.optional(),\n \n /**\n * Caching configuration\n */\n caching: PluginCachingSchema.optional(),\n \n /**\n * Sandboxing configuration\n */\n sandboxing: PluginSandboxingSchema.optional(),\n \n /**\n * Performance monitoring\n */\n monitoring: PluginPerformanceMonitoringSchema.optional(),\n}).describe('Complete plugin loading configuration');\n\n/**\n * Plugin Loading Event\n * Emitted during plugin loading lifecycle\n */\nexport const PluginLoadingEventSchema = z.object({\n /**\n * Event type\n */\n type: z.enum([\n 'load-started',\n 'load-completed',\n 'load-failed',\n 'init-started',\n 'init-completed',\n 'init-failed',\n 'preload-started',\n 'preload-completed',\n 'cache-hit',\n 'cache-miss',\n 'hot-reload',\n 'dynamic-load', // Plugin loaded at runtime\n 'dynamic-unload', // Plugin unloaded at runtime\n 'dynamic-discover', // Plugin discovered via registry\n ]),\n \n /**\n * Plugin identifier\n */\n pluginId: z.string(),\n \n /**\n * Timestamp\n */\n timestamp: z.number().int().min(0),\n \n /**\n * Duration in milliseconds\n */\n durationMs: z.number().int().min(0).optional(),\n \n /**\n * Additional metadata\n */\n metadata: z.record(z.string(), z.unknown()).optional(),\n \n /**\n * Error if event represents a failure\n */\n error: z.object({\n message: z.string(),\n code: z.string().optional(),\n stack: z.string().optional(),\n }).optional(),\n}).describe('Plugin loading lifecycle event');\n\n/**\n * Plugin Loading State\n * Tracks the current loading state of a plugin\n */\nexport const PluginLoadingStateSchema = z.object({\n /**\n * Plugin identifier\n */\n pluginId: z.string(),\n \n /**\n * Current state\n */\n state: z.enum([\n 'pending', // Not yet loaded\n 'loading', // Currently loading\n 'loaded', // Code loaded, not initialized\n 'initializing', // Currently initializing\n 'ready', // Fully initialized and ready\n 'failed', // Failed to load or initialize\n 'reloading', // Hot reloading in progress\n 'unloading', // Being unloaded at runtime\n 'unloaded', // Successfully unloaded (dynamic loading)\n ]),\n \n /**\n * Load progress (0-100)\n */\n progress: z.number().min(0).max(100).default(0),\n \n /**\n * Loading start time\n */\n startedAt: z.number().int().min(0).optional(),\n \n /**\n * Loading completion time\n */\n completedAt: z.number().int().min(0).optional(),\n \n /**\n * Last error\n */\n lastError: z.string().optional(),\n \n /**\n * Retry count\n */\n retryCount: z.number().int().min(0).default(0),\n}).describe('Plugin loading state');\n\n// Export types\nexport type PluginLoadingStrategy = z.infer<typeof PluginLoadingStrategySchema>;\nexport type PluginPreloadConfig = z.infer<typeof PluginPreloadConfigSchema>;\nexport type PluginCodeSplitting = z.infer<typeof PluginCodeSplittingSchema>;\nexport type PluginDynamicImport = z.infer<typeof PluginDynamicImportSchema>;\nexport type PluginInitialization = z.infer<typeof PluginInitializationSchema>;\nexport type PluginDependencyResolution = z.infer<typeof PluginDependencyResolutionSchema>;\nexport type PluginHotReload = z.infer<typeof PluginHotReloadSchema>;\nexport type PluginCaching = z.infer<typeof PluginCachingSchema>;\nexport type PluginSandboxing = z.infer<typeof PluginSandboxingSchema>;\nexport type PluginPerformanceMonitoring = z.infer<typeof PluginPerformanceMonitoringSchema>;\nexport type PluginLoadingConfig = z.infer<typeof PluginLoadingConfigSchema>;\nexport type PluginLoadingEvent = z.infer<typeof PluginLoadingEventSchema>;\nexport type PluginLoadingState = z.infer<typeof PluginLoadingStateSchema>;\n","// Copyright (c) 2025 ObjectStack. Licensed under the Apache-2.0 license.\n\nimport { z } from 'zod';\n\n// Service method interfaces use z.function() instead of z.any() for type safety.\n// Generic data fields use z.unknown() for type safety.\nexport const PluginContextSchema = z.object({\n ql: z.object({\n object: z.function().describe('Get object handle for method chaining'),\n query: z.function().describe('Execute a query'),\n }).passthrough().describe('ObjectQL Engine Interface'),\n\n os: z.object({\n getCurrentUser: z.function().describe('Get the current authenticated user'),\n getConfig: z.function().describe('Get platform configuration'),\n }).passthrough().describe('ObjectStack Kernel Interface'),\n\n logger: z.object({\n debug: z.function().describe('Log debug message'),\n info: z.function().describe('Log info message'),\n warn: z.function().describe('Log warning message'),\n error: z.function().describe('Log error message'),\n }).passthrough().describe('Logger Interface'),\n\n storage: z.object({\n get: z.function().describe('Get a value from storage'),\n set: z.function().describe('Set a value in storage'),\n delete: z.function().describe('Delete a value from storage'),\n }).passthrough().describe('Storage Interface'),\n\n i18n: z.object({\n t: z.function().describe('Translate a key'),\n getLocale: z.function().describe('Get current locale'),\n }).passthrough().describe('Internationalization Interface'),\n\n metadata: z.record(z.string(), z.unknown()),\n events: z.record(z.string(), z.unknown()),\n \n app: z.object({\n router: z.object({\n get: z.function().describe('Register GET route handler'),\n post: z.function().describe('Register POST route handler'),\n use: z.function().describe('Register middleware'),\n }).passthrough()\n }).passthrough().describe('App Framework Interface'),\n\n drivers: z.object({\n register: z.function().describe('Register a driver'),\n }).passthrough().describe('Driver Registry'),\n});\n\nexport type PluginContextData = z.infer<typeof PluginContextSchema>;\nexport type PluginContext = PluginContextData;\n\nexport const PluginLifecycleSchema = z.object({\n onInstall: z.function().optional().describe('Called when plugin is installed'),\n \n onEnable: z.function().optional().describe('Called when plugin is enabled'),\n \n onDisable: z.function().optional().describe('Called when plugin is disabled'),\n \n onUninstall: z.function().optional().describe('Called when plugin is uninstalled'),\n \n onUpgrade: z.function().optional().describe('Called when plugin is upgraded'),\n});\n\nexport type PluginLifecycleHooks = z.infer<typeof PluginLifecycleSchema>;\n\n/**\n * Shared Plugin Types\n * These are the specialized plugin types common between Manifest (Package) and Plugin (Runtime).\n */\nexport const CORE_PLUGIN_TYPES = [\n 'ui', // Frontend: Serves static assets/SPA (e.g. Console, Studio)\n 'driver', // Connectivity: Database or Storage adapters (e.g. SQL, S3)\n 'server', // Protocol: HTTP/RPC Servers (e.g. Hono, GraphQL)\n 'app', // Business: Vertical Solution Bundle (Metadata + Logic)\n 'theme', // Appearance: UI Overrides & CSS Variables\n 'agent', // AI: Autonomous Agent & Tool Definitions\n 'objectql' // Core: ObjectQL Engine Data Provider\n] as const;\n\nexport const PluginSchema = PluginLifecycleSchema.extend({\n id: z.string().min(1).optional().describe('Unique Plugin ID (e.g. com.example.crm)'),\n type: z.enum([\n 'standard', // Default: General purpose backend logic (Service, Hook, etc.)\n ...CORE_PLUGIN_TYPES\n ]).default('standard').optional().describe('Plugin Type categorization for runtime behavior'),\n \n staticPath: z.string().optional().describe('Absolute path to static assets (Required for type=\"ui-plugin\")'),\n slug: z.string().regex(/^[a-z0-9-_]+$/).optional().describe('URL path segment (Required for type=\"ui-plugin\")'),\n default: z.boolean().optional().describe('Serve at root path (Only one \"ui-plugin\" can be default)'),\n \n version: z.string().regex(/^\\d+\\.\\d+\\.\\d+$/).optional().describe('Semantic Version'),\n description: z.string().optional(),\n author: z.string().optional(),\n homepage: z.string().url().optional(),\n});\n\nexport type PluginDefinition = z.infer<typeof PluginSchema>;\n\n/**\n * Define an ObjectStack Plugin\n * Helper function for creating type-safe plugin definitions\n * @deprecated Move to @objectstack/core. Will be removed from spec in v2.0.0\n */\nexport function definePlugin(config: PluginDefinition): PluginDefinition {\n return config;\n}\n","// Copyright (c) 2025 ObjectStack. Licensed under the Apache-2.0 license.\n\nimport { z } from 'zod';\n\n/**\n * Data Import Strategy\n * Defines how the engine handles existing records.\n */\nexport const DatasetMode = z.enum([\n 'insert', // Try to insert, fail on duplicate\n 'update', // Only update found records, ignore new\n 'upsert', // Create new or Update existing (Standard)\n 'replace', // Delete ALL records in object then insert (Dangerous - use for cache tables)\n 'ignore' // Try to insert, silently skip duplicates\n]);\n\n/**\n * Dataset Schema (Seed Data / Fixtures)\n * \n * Standardized format for transporting data.\n * Used for:\n * 1. System Bootstrapping (Admin accounts, Standard Roles)\n * 2. Reference Data (Countries, Currencies)\n * 3. Demo/Test Data\n */\nexport const DatasetSchema = z.object({\n /** \n * Target Object \n * The machine name of the object to populate.\n */\n object: z.string().regex(/^[a-z_][a-z0-9_]*$/).describe('Target Object Name'),\n\n /** \n * Idempotency Key (The \"Upsert\" Key)\n * The field used to check if a record already exists.\n * Best Practice: Use a natural key like 'code', 'slug', 'username' or 'external_id'.\n * Standard: '_id' (internal ID) is rarely used for portable seed data.\n */\n externalId: z.string().default('name').describe('Field match for uniqueness check'),\n\n /** \n * Import Strategy\n */\n mode: DatasetMode.default('upsert').describe('Conflict resolution strategy'),\n\n /**\n * Environment Scope\n * - 'all': Always load\n * - 'dev': Only for development/demo\n * - 'test': Only for CI/CD tests\n */\n env: z.array(z.enum(['prod', 'dev', 'test'])).default(['prod', 'dev', 'test']).describe('Applicable environments'),\n\n /** \n * The Payload\n * Array of raw JSON objects matching the Object Schema.\n */\n records: z.array(z.record(z.string(), z.unknown())).describe('Data records'),\n});\n\n/** Parsed/output type — all defaults are applied (env, mode, externalId always present) */\nexport type Dataset = z.infer<typeof DatasetSchema>;\n\n/** Input type — fields with defaults (env, mode, externalId) are optional */\nexport type DatasetInput = z.input<typeof DatasetSchema>;\n\nexport type DatasetImportMode = z.infer<typeof DatasetMode>;\n","// Copyright (c) 2025 ObjectStack. Licensed under the Apache-2.0 license.\n\nimport { z } from 'zod';\nimport { HttpMethod } from '../shared/http.zod';\n\n/**\n * REST API Server Protocol\n * \n * Defines the REST API server configuration for automatically generating\n * RESTful CRUD endpoints, metadata endpoints, and batch operations.\n * \n * Features:\n * - Automatic CRUD endpoint generation from Object definitions\n * - Standard REST conventions (GET, POST, PUT, PATCH, DELETE)\n * - Metadata API endpoints\n * - Batch operation endpoints\n * - OpenAPI/Swagger documentation generation\n * \n * Architecture alignment:\n * - Salesforce: REST API with Object CRUD\n * - Microsoft Dynamics: Web API with entity operations\n * - Strapi: Auto-generated REST endpoints\n */\n\n// ==========================================\n// REST API Configuration\n// ==========================================\n\n/**\n * REST API Configuration Schema\n * Core configuration for REST API server\n * \n * @example\n * {\n * \"version\": \"v1\",\n * \"basePath\": \"/api\",\n * \"enableCrud\": true,\n * \"enableMetadata\": true,\n * \"enableBatch\": true,\n * \"documentation\": {\n * \"enabled\": true,\n * \"title\": \"ObjectStack API\"\n * }\n * }\n */\nexport const RestApiConfigSchema = z.object({\n /**\n * API version identifier\n */\n version: z.string().regex(/^[a-zA-Z0-9_\\-\\.]+$/).default('v1').describe('API version (e.g., v1, v2, 2024-01)'),\n \n /**\n * Base path for all API routes\n */\n basePath: z.string().default('/api').describe('Base URL path for API'),\n \n /**\n * Full API path (combines basePath and version)\n */\n apiPath: z.string().optional().describe('Full API path (defaults to {basePath}/{version})'),\n \n /**\n * Enable automatic CRUD endpoints\n */\n enableCrud: z.boolean().default(true).describe('Enable automatic CRUD endpoint generation'),\n \n /**\n * Enable metadata endpoints\n */\n enableMetadata: z.boolean().default(true).describe('Enable metadata API endpoints'),\n \n /**\n * Enable UI API endpoints\n */\n enableUi: z.boolean().default(true).describe('Enable UI API endpoints (Views, Menus, Layouts)'),\n \n /**\n * Enable batch operation endpoints\n */\n enableBatch: z.boolean().default(true).describe('Enable batch operation endpoints'),\n \n /**\n * Enable discovery endpoint\n */\n enableDiscovery: z.boolean().default(true).describe('Enable API discovery endpoint'),\n \n /**\n * API documentation configuration\n */\n documentation: z.object({\n enabled: z.boolean().default(true).describe('Enable API documentation'),\n title: z.string().default('ObjectStack API').describe('API documentation title'),\n description: z.string().optional().describe('API description'),\n version: z.string().optional().describe('Documentation version'),\n termsOfService: z.string().optional().describe('Terms of service URL'),\n contact: z.object({\n name: z.string().optional(),\n url: z.string().optional(),\n email: z.string().optional(),\n }).optional(),\n license: z.object({\n name: z.string(),\n url: z.string().optional(),\n }).optional(),\n }).optional().describe('OpenAPI/Swagger documentation config'),\n \n /**\n * Response format configuration\n */\n responseFormat: z.object({\n envelope: z.boolean().default(true).describe('Wrap responses in standard envelope'),\n includeMetadata: z.boolean().default(true).describe('Include response metadata (timestamp, requestId)'),\n includePagination: z.boolean().default(true).describe('Include pagination info in list responses'),\n }).optional().describe('Response format options'),\n});\n\nexport type RestApiConfig = z.infer<typeof RestApiConfigSchema>;\nexport type RestApiConfigInput = z.input<typeof RestApiConfigSchema>;\n\n// ==========================================\n// CRUD Endpoint Configuration\n// ==========================================\n\n/**\n * CRUD Operation Type Enum\n */\nexport const CrudOperation = z.enum([\n 'create', // POST /api/v1/data/{object}\n 'read', // GET /api/v1/data/{object}/:id\n 'update', // PATCH /api/v1/data/{object}/:id\n 'delete', // DELETE /api/v1/data/{object}/:id\n 'list', // GET /api/v1/data/{object}\n]);\n\nexport type CrudOperation = z.infer<typeof CrudOperation>;\n\n/**\n * CRUD Endpoint Pattern Schema\n * Defines the URL pattern for CRUD operations\n * \n * @example\n * {\n * \"create\": { \"method\": \"POST\", \"path\": \"/data/{object}\" },\n * \"read\": { \"method\": \"GET\", \"path\": \"/data/{object}/:id\" },\n * \"update\": { \"method\": \"PATCH\", \"path\": \"/data/{object}/:id\" },\n * \"delete\": { \"method\": \"DELETE\", \"path\": \"/data/{object}/:id\" },\n * \"list\": { \"method\": \"GET\", \"path\": \"/data/{object}\" }\n * }\n */\nexport const CrudEndpointPatternSchema = z.object({\n /**\n * HTTP method\n */\n method: HttpMethod.describe('HTTP method'),\n \n /**\n * URL path pattern (relative to API base)\n */\n path: z.string().describe('URL path pattern'),\n \n /**\n * Operation summary for documentation\n */\n summary: z.string().optional().describe('Operation summary'),\n \n /**\n * Operation description\n */\n description: z.string().optional().describe('Operation description'),\n});\n\nexport type CrudEndpointPattern = z.infer<typeof CrudEndpointPatternSchema>;\n\n/**\n * CRUD Endpoints Configuration Schema\n * Configuration for automatic CRUD endpoint generation\n */\nexport const CrudEndpointsConfigSchema = z.object({\n /**\n * Enable/disable specific CRUD operations\n */\n operations: z.object({\n create: z.boolean().default(true).describe('Enable create operation'),\n read: z.boolean().default(true).describe('Enable read operation'),\n update: z.boolean().default(true).describe('Enable update operation'),\n delete: z.boolean().default(true).describe('Enable delete operation'),\n list: z.boolean().default(true).describe('Enable list operation'),\n }).optional().describe('Enable/disable operations'),\n \n /**\n * Custom endpoint patterns (override defaults)\n */\n patterns: z.record(CrudOperation, CrudEndpointPatternSchema.optional()).optional()\n .describe('Custom URL patterns for operations'),\n \n /**\n * Path prefix for data operations\n */\n dataPrefix: z.string().default('/data').describe('URL prefix for data endpoints'),\n \n /**\n * Object name parameter style\n */\n objectParamStyle: z.enum(['path', 'query']).default('path')\n .describe('How object name is passed (path param or query param)'),\n});\n\nexport type CrudEndpointsConfig = z.infer<typeof CrudEndpointsConfigSchema>;\nexport type CrudEndpointsConfigInput = z.input<typeof CrudEndpointsConfigSchema>;\n\n// ==========================================\n// Metadata Endpoint Configuration\n// ==========================================\n\n/**\n * Metadata Endpoint Configuration Schema\n * Configuration for metadata API endpoints\n * \n * @example\n * {\n * \"prefix\": \"/meta\",\n * \"enableCache\": true,\n * \"endpoints\": {\n * \"types\": true,\n * \"objects\": true,\n * \"fields\": true\n * }\n * }\n */\nexport const MetadataEndpointsConfigSchema = z.object({\n /**\n * Path prefix for metadata operations\n */\n prefix: z.string().default('/meta').describe('URL prefix for metadata endpoints'),\n \n /**\n * Enable HTTP caching for metadata\n */\n enableCache: z.boolean().default(true).describe('Enable HTTP cache headers (ETag, Last-Modified)'),\n \n /**\n * Cache TTL in seconds\n */\n cacheTtl: z.number().int().default(3600).describe('Cache TTL in seconds'),\n \n /**\n * Enable specific metadata endpoints\n */\n endpoints: z.object({\n types: z.boolean().default(true).describe('GET /meta - List all metadata types'),\n items: z.boolean().default(true).describe('GET /meta/:type - List items of type'),\n item: z.boolean().default(true).describe('GET /meta/:type/:name - Get specific item'),\n schema: z.boolean().default(true).describe('GET /meta/:type/:name/schema - Get JSON schema'),\n }).optional().describe('Enable/disable specific endpoints'),\n});\n\nexport type MetadataEndpointsConfig = z.infer<typeof MetadataEndpointsConfigSchema>;\nexport type MetadataEndpointsConfigInput = z.input<typeof MetadataEndpointsConfigSchema>;\n\n// ==========================================\n// Batch Operation Endpoint Configuration\n// ==========================================\n\n/**\n * Batch Operation Endpoint Configuration Schema\n * Configuration for batch/bulk operation endpoints\n * \n * @example\n * {\n * \"maxBatchSize\": 200,\n * \"enableBatchEndpoint\": true,\n * \"enableCreateMany\": true,\n * \"enableUpdateMany\": true,\n * \"enableDeleteMany\": true\n * }\n */\nexport const BatchEndpointsConfigSchema = z.object({\n /**\n * Maximum batch size\n */\n maxBatchSize: z.number().int().min(1).max(1000).default(200)\n .describe('Maximum records per batch operation'),\n \n /**\n * Enable generic batch endpoint\n */\n enableBatchEndpoint: z.boolean().default(true)\n .describe('Enable POST /data/:object/batch endpoint'),\n \n /**\n * Enable specific batch operations\n */\n operations: z.object({\n createMany: z.boolean().default(true).describe('Enable POST /data/:object/createMany'),\n updateMany: z.boolean().default(true).describe('Enable POST /data/:object/updateMany'),\n deleteMany: z.boolean().default(true).describe('Enable POST /data/:object/deleteMany'),\n upsertMany: z.boolean().default(true).describe('Enable POST /data/:object/upsertMany'),\n }).optional().describe('Enable/disable specific batch operations'),\n \n /**\n * Transaction mode default\n */\n defaultAtomic: z.boolean().default(true)\n .describe('Default atomic/transaction mode for batch operations'),\n});\n\nexport type BatchEndpointsConfig = z.infer<typeof BatchEndpointsConfigSchema>;\nexport type BatchEndpointsConfigInput = z.input<typeof BatchEndpointsConfigSchema>;\n\n// ==========================================\n// Route Generation Configuration\n// ==========================================\n\n/**\n * Route Generation Configuration Schema\n * Controls automatic route generation for objects\n */\nexport const RouteGenerationConfigSchema = z.object({\n /**\n * Objects to include (if empty, include all)\n */\n includeObjects: z.array(z.string()).optional()\n .describe('Specific objects to generate routes for (empty = all)'),\n \n /**\n * Objects to exclude\n */\n excludeObjects: z.array(z.string()).optional()\n .describe('Objects to exclude from route generation'),\n \n /**\n * Object name transformations\n */\n nameTransform: z.enum(['none', 'plural', 'kebab-case', 'camelCase']).default('none')\n .describe('Transform object names in URLs'),\n \n /**\n * Custom route overrides per object\n */\n overrides: z.record(z.string(), z.object({\n enabled: z.boolean().optional().describe('Enable/disable routes for this object'),\n basePath: z.string().optional().describe('Custom base path'),\n operations: z.record(CrudOperation, z.boolean()).optional()\n .describe('Enable/disable specific operations'),\n })).optional().describe('Per-object route customization'),\n});\n\nexport type RouteGenerationConfig = z.infer<typeof RouteGenerationConfigSchema>;\nexport type RouteGenerationConfigInput = z.input<typeof RouteGenerationConfigSchema>;\n\n// ==========================================\n// OpenAPI 3.1 Webhooks & Callbacks\n// ==========================================\n\n/**\n * Webhook Event Schema\n * Defines an event that can trigger a webhook delivery\n */\nexport const WebhookEventSchema = z.object({\n name: z.string().regex(/^[a-z_][a-z0-9_]*$/).describe('Webhook event identifier (snake_case)'),\n description: z.string().describe('Human-readable event description'),\n method: HttpMethod.default('POST').describe('HTTP method for webhook delivery'),\n payloadSchema: z.string().describe('JSON Schema $ref for the webhook payload'),\n headers: z.record(z.string(), z.string()).optional().describe('Custom headers to include in webhook delivery'),\n security: z.array(\n z.enum(['hmac_sha256', 'basic', 'bearer', 'api_key'])\n ).describe('Supported authentication methods for webhook verification'),\n});\n\nexport type WebhookEvent = z.infer<typeof WebhookEventSchema>;\n\n/**\n * Webhook Configuration Schema\n * Top-level webhook configuration for the REST API\n */\nexport const WebhookConfigSchema = z.object({\n enabled: z.boolean().default(false).describe('Enable webhook support'),\n events: z.array(WebhookEventSchema).describe('Registered webhook events'),\n deliveryConfig: z.object({\n maxRetries: z.number().int().default(3).describe('Maximum delivery retry attempts'),\n retryIntervalMs: z.number().int().default(5000).describe('Milliseconds between retry attempts'),\n timeoutMs: z.number().int().default(30000).describe('Delivery request timeout in milliseconds'),\n signatureHeader: z.string().default('X-Signature-256').describe('Header name for webhook signature'),\n }).describe('Webhook delivery configuration'),\n registrationEndpoint: z.string().default('/webhooks').describe('URL path for webhook registration'),\n});\n\nexport type WebhookConfig = z.infer<typeof WebhookConfigSchema>;\n\n/**\n * Callback Schema\n * OpenAPI 3.1 callback definition for asynchronous API responses\n */\nexport const CallbackSchema = z.object({\n name: z.string().regex(/^[a-z_][a-z0-9_]*$/).describe('Callback identifier (snake_case)'),\n expression: z.string().describe('Runtime expression (e.g., {$request.body#/callbackUrl})'),\n method: HttpMethod.describe('HTTP method for callback request'),\n url: z.string().describe('Callback URL template with runtime expressions'),\n});\n\nexport type Callback = z.infer<typeof CallbackSchema>;\n\n/**\n * OpenAPI 3.1 Extensions Schema\n * Extensions specific to OpenAPI 3.1 specification\n */\nexport const OpenApi31ExtensionsSchema = z.object({\n webhooks: z.record(z.string(), WebhookEventSchema).optional()\n .describe('OpenAPI 3.1 webhooks (top-level webhook definitions)'),\n callbacks: z.record(z.string(), z.array(CallbackSchema)).optional()\n .describe('OpenAPI 3.1 callbacks (async response definitions)'),\n jsonSchemaDialect: z.string().default('https://json-schema.org/draft/2020-12/schema')\n .describe('JSON Schema dialect for schema definitions'),\n pathItemReferences: z.boolean().default(false)\n .describe('Allow $ref in path items (OpenAPI 3.1 feature)'),\n});\n\nexport type OpenApi31Extensions = z.infer<typeof OpenApi31ExtensionsSchema>;\n\n// ==========================================\n// Complete REST Server Configuration\n// ==========================================\n\n/**\n * REST Server Configuration Schema\n * Complete configuration for REST API server with auto-generated endpoints\n * \n * @example\n * {\n * \"api\": {\n * \"version\": \"v1\",\n * \"basePath\": \"/api\",\n * \"enableCrud\": true,\n * \"enableMetadata\": true,\n * \"enableBatch\": true\n * },\n * \"crud\": {\n * \"dataPrefix\": \"/data\"\n * },\n * \"metadata\": {\n * \"prefix\": \"/meta\",\n * \"enableCache\": true\n * },\n * \"batch\": {\n * \"maxBatchSize\": 200\n * },\n * \"routes\": {\n * \"excludeObjects\": [\"system_log\"]\n * }\n * }\n */\nexport const RestServerConfigSchema = z.object({\n /**\n * API configuration\n */\n api: RestApiConfigSchema.optional().describe('REST API configuration'),\n \n /**\n * CRUD endpoints configuration\n */\n crud: CrudEndpointsConfigSchema.optional().describe('CRUD endpoints configuration'),\n \n /**\n * Metadata endpoints configuration\n */\n metadata: MetadataEndpointsConfigSchema.optional().describe('Metadata endpoints configuration'),\n \n /**\n * Batch endpoints configuration\n */\n batch: BatchEndpointsConfigSchema.optional().describe('Batch endpoints configuration'),\n \n /**\n * Route generation configuration\n */\n routes: RouteGenerationConfigSchema.optional().describe('Route generation configuration'),\n \n /**\n * OpenAPI 3.1 extensions (webhooks, callbacks)\n */\n openApi31: OpenApi31ExtensionsSchema.optional().describe('OpenAPI 3.1 extensions configuration'),\n});\n\nexport type RestServerConfig = z.infer<typeof RestServerConfigSchema>;\nexport type RestServerConfigInput = z.input<typeof RestServerConfigSchema>;\n\n// ==========================================\n// Endpoint Registry\n// ==========================================\n\n/**\n * Generated Endpoint Schema\n * Represents a generated REST endpoint\n */\nexport const GeneratedEndpointSchema = z.object({\n /**\n * Endpoint identifier\n */\n id: z.string().describe('Unique endpoint identifier'),\n \n /**\n * HTTP method\n */\n method: HttpMethod.describe('HTTP method'),\n \n /**\n * Full URL path\n */\n path: z.string().describe('Full URL path'),\n \n /**\n * Object this endpoint operates on\n */\n object: z.string().describe('Object name (snake_case)'),\n \n /**\n * Operation type\n */\n operation: z.union([CrudOperation, z.string()]).describe('Operation type'),\n \n /**\n * Handler reference\n */\n handler: z.string().describe('Handler function identifier'),\n \n /**\n * Endpoint metadata\n */\n metadata: z.object({\n summary: z.string().optional(),\n description: z.string().optional(),\n tags: z.array(z.string()).optional(),\n deprecated: z.boolean().optional(),\n }).optional(),\n});\n\nexport type GeneratedEndpoint = z.infer<typeof GeneratedEndpointSchema>;\n\n/**\n * Endpoint Registry Schema\n * Registry of all generated endpoints\n */\nexport const EndpointRegistrySchema = z.object({\n /**\n * Generated endpoints\n */\n endpoints: z.array(GeneratedEndpointSchema).describe('All generated endpoints'),\n \n /**\n * Total endpoint count\n */\n total: z.number().int().describe('Total number of endpoints'),\n \n /**\n * Endpoints by object\n */\n byObject: z.record(z.string(), z.array(GeneratedEndpointSchema)).optional()\n .describe('Endpoints grouped by object'),\n \n /**\n * Endpoints by operation\n */\n byOperation: z.record(z.string(), z.array(GeneratedEndpointSchema)).optional()\n .describe('Endpoints grouped by operation'),\n});\n\nexport type EndpointRegistry = z.infer<typeof EndpointRegistrySchema>;\n\n// ==========================================\n// Helper Functions\n// ==========================================\n\n/**\n * Helper to create REST API configuration\n */\nexport const RestApiConfig = Object.assign(RestApiConfigSchema, {\n create: <T extends z.input<typeof RestApiConfigSchema>>(config: T) => config,\n});\n\n/**\n * Helper to create REST server configuration\n */\nexport const RestServerConfig = Object.assign(RestServerConfigSchema, {\n create: <T extends z.input<typeof RestServerConfigSchema>>(config: T) => config,\n});\n","// Copyright (c) 2025 ObjectStack. Licensed under the Apache-2.0 license.\n\nimport { z } from 'zod';\nimport { HttpMethod, RateLimitConfigSchema } from '../shared/http.zod';\nimport { SnakeCaseIdentifierSchema } from '../shared/identifiers.zod';\n\n/**\n * Unified API Registry Protocol\n * \n * Provides a centralized registry for managing all API endpoints across different\n * API types (REST, GraphQL, OData, WebSocket, Auth, File, Plugin-registered).\n * \n * This enables:\n * - Unified API discovery and documentation (similar to Swagger/OpenAPI)\n * - API testing interfaces\n * - API governance and monitoring\n * - Plugin API registration\n * - Multi-protocol support\n * \n * Architecture Alignment:\n * - Kubernetes: Service Discovery & API Server\n * - AWS API Gateway: Unified API Management\n * - Kong Gateway: Plugin-based API Management\n * \n * @example API Registry Entry\n * ```typescript\n * const apiEntry: ApiRegistryEntry = {\n * id: 'customer_crud',\n * name: 'Customer CRUD API',\n * type: 'rest',\n * version: 'v1',\n * basePath: '/api/v1/data/customer',\n * endpoints: [...],\n * metadata: {\n * owner: 'sales_team',\n * tags: ['customer', 'crm']\n * }\n * }\n * ```\n */\n\n// ==========================================\n// API Type Enumeration\n// ==========================================\n\n/**\n * API Protocol Type\n * \n * Defines the different types of APIs supported by ObjectStack.\n */\nexport const ApiProtocolType = z.enum([\n 'rest', // RESTful API (CRUD operations)\n 'graphql', // GraphQL API (flexible queries)\n 'odata', // OData v4 API (enterprise integration)\n 'websocket', // WebSocket API (real-time)\n 'file', // File/Storage API (uploads/downloads)\n 'auth', // Authentication/Authorization API\n 'metadata', // Metadata/Schema API\n 'plugin', // Plugin-registered custom API\n 'webhook', // Webhook endpoints\n 'rpc', // JSON-RPC or similar\n]);\n\nexport type ApiProtocolType = z.infer<typeof ApiProtocolType>;\n\n// ==========================================\n// API Endpoint Registration\n// ==========================================\n\n/**\n * HTTP Status Code\n */\nexport const HttpStatusCode = z.union([\n z.number().int().min(100).max(599),\n z.enum(['2xx', '3xx', '4xx', '5xx']), // Pattern matching\n]);\n\nexport type HttpStatusCode = z.infer<typeof HttpStatusCode>;\n\n// ==========================================\n// Schema Reference Types\n// ==========================================\n\n/**\n * ObjectQL Reference Schema\n * \n * Allows referencing ObjectStack data objects instead of static JSON schemas.\n * When an API parameter or response references an ObjectQL object, the schema\n * is dynamically derived from the object definition, enabling automatic updates\n * when the object schema changes.\n * \n * **IMPORTANT - Schema Resolution Responsibility:**\n * The API Registry STORES these references as metadata but does NOT resolve them.\n * Schema resolution (expanding references into actual JSON Schema) is performed by:\n * - **API Gateway**: For runtime request/response validation\n * - **OpenAPI Generator**: For Swagger/OpenAPI documentation\n * - **GraphQL Schema Builder**: For GraphQL type generation\n * - **Documentation Tools**: For developer documentation\n * \n * This separation allows the Registry to remain lightweight and focused on\n * registration/discovery, while specialized tools handle schema transformation.\n * \n * **Benefits:**\n * - Auto-updating API documentation when object schemas change\n * - Consistent type definitions across API and database\n * - Reduced duplication and maintenance\n * - Registry remains protocol-agnostic and lightweight\n * \n * @example Reference Customer object\n * ```json\n * {\n * \"objectId\": \"customer\",\n * \"includeFields\": [\"id\", \"name\", \"email\"],\n * \"excludeFields\": [\"internal_notes\"]\n * }\n * ```\n */\nexport const ObjectQLReferenceSchema = z.object({\n /** Referenced object name (snake_case) */\n objectId: SnakeCaseIdentifierSchema.describe('Object name to reference'),\n \n /** Include only specific fields (optional) */\n includeFields: z.array(z.string()).optional()\n .describe('Include only these fields in the schema'),\n \n /** Exclude specific fields (optional) */\n excludeFields: z.array(z.string()).optional()\n .describe('Exclude these fields from the schema'),\n \n /** Include related objects via lookup fields */\n includeRelated: z.array(z.string()).optional()\n .describe('Include related objects via lookup fields'),\n});\n\nexport type ObjectQLReference = z.infer<typeof ObjectQLReferenceSchema>;\n\n/**\n * Schema Definition\n * \n * Unified schema definition that supports both:\n * 1. Static JSON Schema (traditional approach)\n * 2. Dynamic ObjectQL reference (linked to object definitions)\n * \n * When using ObjectQL references, the API documentation and validation\n * automatically update when object schemas change, eliminating the need\n * to manually sync API schemas with data models.\n */\nexport const SchemaDefinition = z.union([\n z.unknown().describe('Static JSON Schema definition'),\n z.object({\n $ref: ObjectQLReferenceSchema.describe('Dynamic reference to ObjectQL object'),\n }).describe('Dynamic ObjectQL reference'),\n]);\n\nexport type SchemaDefinition = z.infer<typeof SchemaDefinition>;\n\n// ==========================================\n// API Parameter & Response Schemas\n// ==========================================\n\n/**\n * API Parameter Schema\n * \n * Defines a single API parameter (path, query, header, or body).\n * \n * **Enhancement: Dynamic Schema Linking**\n * - Supports both static JSON Schema and dynamic ObjectQL references\n * - When using ObjectQL references, parameter validation automatically updates\n * when the referenced object schema changes\n * \n * @example Static schema\n * ```json\n * {\n * \"name\": \"customer_id\",\n * \"in\": \"path\",\n * \"schema\": {\n * \"type\": \"string\",\n * \"format\": \"uuid\"\n * }\n * }\n * ```\n * \n * @example Dynamic ObjectQL reference\n * ```json\n * {\n * \"name\": \"customer\",\n * \"in\": \"body\",\n * \"schema\": {\n * \"$ref\": {\n * \"objectId\": \"customer\",\n * \"excludeFields\": [\"internal_notes\"]\n * }\n * }\n * }\n * ```\n */\nexport const ApiParameterSchema = z.object({\n /** Parameter name */\n name: z.string().describe('Parameter name'),\n \n /** Parameter location */\n in: z.enum(['path', 'query', 'header', 'body', 'cookie']).describe('Parameter location'),\n \n /** Parameter description */\n description: z.string().optional().describe('Parameter description'),\n \n /** Required flag */\n required: z.boolean().default(false).describe('Whether parameter is required'),\n \n /** Parameter type/schema - supports static or dynamic (ObjectQL) schemas */\n schema: z.union([\n z.object({\n type: z.enum(['string', 'number', 'integer', 'boolean', 'array', 'object']).describe('Parameter type'),\n format: z.string().optional().describe('Format (e.g., date-time, email, uuid)'),\n enum: z.array(z.unknown()).optional().describe('Allowed values'),\n default: z.unknown().optional().describe('Default value'),\n items: z.unknown().optional().describe('Array item schema'),\n properties: z.record(z.string(), z.unknown()).optional().describe('Object properties'),\n }).describe('Static JSON Schema'),\n z.object({\n $ref: ObjectQLReferenceSchema,\n }).describe('Dynamic ObjectQL reference'),\n ]).describe('Parameter schema definition'),\n \n /** Example value */\n example: z.unknown().optional().describe('Example value'),\n});\n\nexport type ApiParameter = z.infer<typeof ApiParameterSchema>;\n\n/**\n * API Response Schema\n * \n * Defines an API response for a specific status code.\n * \n * **Enhancement: Dynamic Schema Linking**\n * - Response schema can reference ObjectQL objects\n * - When object definitions change, response documentation auto-updates\n * \n * @example Response with ObjectQL reference\n * ```json\n * {\n * \"statusCode\": 200,\n * \"description\": \"Customer retrieved successfully\",\n * \"schema\": {\n * \"$ref\": {\n * \"objectId\": \"customer\",\n * \"excludeFields\": [\"password_hash\"]\n * }\n * }\n * }\n * ```\n */\nexport const ApiResponseSchema = z.object({\n /** HTTP status code */\n statusCode: HttpStatusCode.describe('HTTP status code'),\n \n /** Response description */\n description: z.string().describe('Response description'),\n \n /** Response content type */\n contentType: z.string().default('application/json').describe('Response content type'),\n \n /** Response schema - supports static or dynamic (ObjectQL) schemas */\n schema: z.union([\n z.unknown().describe('Static JSON Schema'),\n z.object({\n $ref: ObjectQLReferenceSchema,\n }).describe('Dynamic ObjectQL reference'),\n ]).optional().describe('Response body schema'),\n \n /** Response headers */\n headers: z.record(z.string(), z.object({\n description: z.string().optional(),\n schema: z.unknown(),\n })).optional().describe('Response headers'),\n \n /** Example response */\n example: z.unknown().optional().describe('Example response'),\n});\n\nexport type ApiResponse = z.infer<typeof ApiResponseSchema>;\nexport type ApiResponseInput = z.input<typeof ApiResponseSchema>;\n\n/**\n * API Endpoint Registration Schema\n * \n * Represents a single API endpoint registration with complete metadata.\n * \n * **Enhancements:**\n * 1. **RBAC Integration**: `requiredPermissions` field for automatic permission checking\n * 2. **Dynamic Schema Linking**: Parameters and responses can reference ObjectQL objects\n * 3. **Route Priority**: `priority` field for conflict resolution\n * 4. **Protocol Config**: `protocolConfig` for protocol-specific extensions\n * \n * @example REST Endpoint with RBAC\n * ```json\n * {\n * \"id\": \"get_customer_by_id\",\n * \"method\": \"GET\",\n * \"path\": \"/api/v1/data/customer/:id\",\n * \"summary\": \"Get customer by ID\",\n * \"requiredPermissions\": [\"customer.read\"],\n * \"parameters\": [\n * {\n * \"name\": \"id\",\n * \"in\": \"path\",\n * \"required\": true,\n * \"schema\": { \"type\": \"string\" }\n * }\n * ],\n * \"responses\": [\n * {\n * \"statusCode\": 200,\n * \"description\": \"Customer found\",\n * \"schema\": {\n * \"$ref\": {\n * \"objectId\": \"customer\"\n * }\n * }\n * }\n * ],\n * \"priority\": 100\n * }\n * ```\n * \n * @example Plugin Endpoint with Protocol Config\n * ```json\n * {\n * \"id\": \"grpc_service_method\",\n * \"path\": \"/grpc/ServiceName/MethodName\",\n * \"summary\": \"gRPC service method\",\n * \"protocolConfig\": {\n * \"subProtocol\": \"grpc\",\n * \"serviceName\": \"CustomerService\",\n * \"methodName\": \"GetCustomer\"\n * },\n * \"priority\": 50\n * }\n * ```\n */\nexport const ApiEndpointRegistrationSchema = z.object({\n /** Unique endpoint identifier */\n id: z.string().describe('Unique endpoint identifier'),\n \n /** HTTP method (for HTTP-based APIs) */\n method: HttpMethod.optional().describe('HTTP method'),\n \n /** URL path pattern */\n path: z.string().describe('URL path pattern'),\n \n /** Short summary */\n summary: z.string().optional().describe('Short endpoint summary'),\n \n /** Detailed description */\n description: z.string().optional().describe('Detailed endpoint description'),\n \n /** Operation ID (OpenAPI) */\n operationId: z.string().optional().describe('Unique operation identifier'),\n \n /** Tags for grouping */\n tags: z.array(z.string()).optional().default([]).describe('Tags for categorization'),\n \n /** Parameters */\n parameters: z.array(ApiParameterSchema).optional().default([]).describe('Endpoint parameters'),\n \n /** Request body schema */\n requestBody: z.object({\n description: z.string().optional(),\n required: z.boolean().default(false),\n contentType: z.string().default('application/json'),\n schema: z.unknown().optional(),\n example: z.unknown().optional(),\n }).optional().describe('Request body specification'),\n \n /** Response definitions */\n responses: z.array(ApiResponseSchema).optional().default([]).describe('Possible responses'),\n \n /** Rate Limiting */\n rateLimit: RateLimitConfigSchema.optional().describe('Endpoint specific rate limiting'),\n\n /** Security Requirements */\n security: z.array(z.record(z.string(), z.array(z.string()))).optional().describe('Security requirements (e.g. [{\"bearerAuth\": []}])'),\n \n /**\n * Required Permissions (RBAC Integration)\n * \n * Array of permission names required to access this endpoint.\n * The gateway layer automatically validates these permissions before\n * allowing the request to proceed, eliminating the need for permission\n * checks in individual API handlers.\n * \n * **Format:** `<object>.<operation>` or system permission name\n * \n * **Object Permissions:**\n * - `customer.read` - Read customer records\n * - `customer.create` - Create customer records\n * - `customer.edit` - Update customer records\n * - `customer.delete` - Delete customer records\n * - `customer.viewAll` - View all customer records (bypass sharing)\n * - `customer.modifyAll` - Modify all customer records (bypass sharing)\n * \n * **System Permissions:**\n * - `manage_users` - User management\n * - `view_setup` - Access to system setup\n * - `customize_application` - Modify metadata\n * - `api_enabled` - API access\n * \n * @example Object-level permissions\n * ```json\n * {\n * \"requiredPermissions\": [\"customer.read\"]\n * }\n * ```\n * \n * @example Multiple permissions (ALL required)\n * ```json\n * {\n * \"requiredPermissions\": [\"customer.read\", \"account.read\"]\n * }\n * ```\n * \n * @example System permission\n * ```json\n * {\n * \"requiredPermissions\": [\"manage_users\"]\n * }\n * ```\n * \n * @see {@link file://../../permission/permission.zod.ts} for permission definitions\n */\n requiredPermissions: z.array(z.string()).optional().default([])\n .describe('Required RBAC permissions (e.g., \"customer.read\", \"manage_users\")'),\n \n /**\n * Route Priority\n * \n * Priority level for route conflict resolution. Higher priority routes\n * are registered first and take precedence when multiple routes match\n * the same path pattern.\n * \n * **Default:** 100 (medium priority)\n * **Range:** 0-1000 (higher = more important)\n * \n * **Use Cases:**\n * - Core system APIs: 900-1000\n * - Plugin APIs: 100-500\n * - Custom/override APIs: 500-900\n * - Fallback routes: 0-100\n * \n * @example High priority core endpoint\n * ```json\n * {\n * \"path\": \"/api/v1/data/:object/:id\",\n * \"priority\": 950\n * }\n * ```\n * \n * @example Medium priority plugin endpoint\n * ```json\n * {\n * \"path\": \"/api/v1/custom/action\",\n * \"priority\": 300\n * }\n * ```\n */\n priority: z.number().int().min(0).max(1000).optional().default(100)\n .describe('Route priority for conflict resolution (0-1000, higher = more important)'),\n \n /**\n * Protocol-Specific Configuration\n * \n * Allows plugins and custom APIs to define protocol-specific metadata\n * that can be used for specialized handling or documentation generation.\n * \n * **Examples:**\n * - gRPC: Service and method names\n * - tRPC: Procedure type (query/mutation)\n * - WebSocket: Event names and handlers\n * - Custom protocols: Any metadata needed\n * \n * @example gRPC configuration\n * ```json\n * {\n * \"protocolConfig\": {\n * \"subProtocol\": \"grpc\",\n * \"serviceName\": \"CustomerService\",\n * \"methodName\": \"GetCustomer\",\n * \"streaming\": false\n * }\n * }\n * ```\n * \n * @example tRPC configuration\n * ```json\n * {\n * \"protocolConfig\": {\n * \"subProtocol\": \"trpc\",\n * \"procedureType\": \"query\",\n * \"router\": \"customer\"\n * }\n * }\n * ```\n * \n * @example WebSocket configuration\n * ```json\n * {\n * \"protocolConfig\": {\n * \"subProtocol\": \"websocket\",\n * \"eventName\": \"customer.updated\",\n * \"direction\": \"server-to-client\"\n * }\n * }\n * ```\n */\n protocolConfig: z.record(z.string(), z.unknown()).optional()\n .describe('Protocol-specific configuration for custom protocols (gRPC, tRPC, etc.)'),\n \n /** Deprecation flag */\n deprecated: z.boolean().default(false).describe('Whether endpoint is deprecated'),\n \n /** External documentation */\n externalDocs: z.object({\n description: z.string().optional(),\n url: z.string().url(),\n }).optional().describe('External documentation link'),\n});\n\nexport type ApiEndpointRegistration = z.infer<typeof ApiEndpointRegistrationSchema>;\nexport type ApiEndpointRegistrationInput = z.input<typeof ApiEndpointRegistrationSchema>;\n\n// ==========================================\n// API Registry Entry\n// ==========================================\n\n/**\n * API Metadata Schema\n * \n * Additional metadata for an API registration.\n */\nexport const ApiMetadataSchema = z.object({\n /** API owner/team */\n owner: z.string().optional().describe('Owner team or person'),\n \n /** API status */\n status: z.enum(['active', 'deprecated', 'experimental', 'beta']).default('active')\n .describe('API lifecycle status'),\n \n /** Categorization tags */\n tags: z.array(z.string()).optional().default([]).describe('Classification tags'),\n \n /** Plugin source (if plugin-registered) */\n pluginSource: z.string().optional().describe('Source plugin name'),\n \n /** Custom metadata */\n custom: z.record(z.string(), z.unknown()).optional().describe('Custom metadata fields'),\n});\n\nexport type ApiMetadata = z.infer<typeof ApiMetadataSchema>;\nexport type ApiMetadataInput = z.input<typeof ApiMetadataSchema>;\n\n/**\n * API Registry Entry Schema\n * \n * Complete registration entry for an API in the unified registry.\n * \n * @example REST API Entry\n * ```json\n * {\n * \"id\": \"customer_api\",\n * \"name\": \"Customer Management API\",\n * \"type\": \"rest\",\n * \"version\": \"v1\",\n * \"basePath\": \"/api/v1/data/customer\",\n * \"description\": \"CRUD operations for customer records\",\n * \"endpoints\": [...],\n * \"metadata\": {\n * \"owner\": \"sales_team\",\n * \"status\": \"active\",\n * \"tags\": [\"customer\", \"crm\"]\n * }\n * }\n * ```\n * \n * @example Plugin API Entry\n * ```json\n * {\n * \"id\": \"payment_webhook\",\n * \"name\": \"Payment Webhook API\",\n * \"type\": \"plugin\",\n * \"version\": \"1.0.0\",\n * \"basePath\": \"/plugins/payment/webhook\",\n * \"endpoints\": [...],\n * \"metadata\": {\n * \"pluginSource\": \"payment_gateway_plugin\",\n * \"status\": \"active\"\n * }\n * }\n * ```\n */\nexport const ApiRegistryEntrySchema = z.object({\n /** Unique API identifier */\n id: z.string().regex(/^[a-z_][a-z0-9_]*$/).describe('Unique API identifier (snake_case)'),\n \n /** Human-readable name */\n name: z.string().describe('API display name'),\n \n /** API protocol type */\n type: ApiProtocolType.describe('API protocol type'),\n \n /** API version */\n version: z.string().describe('API version (e.g., v1, 2024-01)'),\n \n /** Base URL path */\n basePath: z.string().describe('Base URL path for this API'),\n \n /** API description */\n description: z.string().optional().describe('API description'),\n \n /** Endpoints in this API */\n endpoints: z.array(ApiEndpointRegistrationSchema).describe('Registered endpoints'),\n \n /** OpenAPI/GraphQL/OData specific configuration */\n config: z.record(z.string(), z.unknown()).optional().describe('Protocol-specific configuration'),\n \n /** API metadata */\n metadata: ApiMetadataSchema.optional().describe('Additional metadata'),\n \n /** Terms of service URL */\n termsOfService: z.string().url().optional().describe('Terms of service URL'),\n \n /** Contact information */\n contact: z.object({\n name: z.string().optional(),\n url: z.string().url().optional(),\n email: z.string().email().optional(),\n }).optional().describe('Contact information'),\n \n /** License information */\n license: z.object({\n name: z.string(),\n url: z.string().url().optional(),\n }).optional().describe('License information'),\n});\n\nexport type ApiRegistryEntry = z.infer<typeof ApiRegistryEntrySchema>;\nexport type ApiRegistryEntryInput = z.input<typeof ApiRegistryEntrySchema>;\n\n// ==========================================\n// API Registry\n// ==========================================\n\n/**\n * Route Conflict Resolution Strategy\n * \n * Defines how to handle conflicts when multiple endpoints register\n * the same or overlapping URL patterns.\n */\nexport const ConflictResolutionStrategy = z.enum([\n 'error', // Throw error on conflict (safest, default)\n 'priority', // Use priority field to resolve (highest priority wins)\n 'first-wins', // First registered endpoint wins\n 'last-wins', // Last registered endpoint wins (override mode)\n]);\n\nexport type ConflictResolutionStrategy = z.infer<typeof ConflictResolutionStrategy>;\n\n/**\n * API Registry Schema\n * \n * Central registry containing all registered APIs.\n * \n * **Enhancement: Route Conflict Detection**\n * - `conflictResolution`: Strategy for handling route conflicts\n * - Prevents silent overwrites and unexpected routing behavior\n * \n * @example\n * ```json\n * {\n * \"version\": \"1.0.0\",\n * \"conflictResolution\": \"priority\",\n * \"apis\": [\n * { \"id\": \"customer_api\", \"type\": \"rest\", ... },\n * { \"id\": \"graphql_api\", \"type\": \"graphql\", ... },\n * { \"id\": \"file_upload_api\", \"type\": \"file\", ... }\n * ],\n * \"totalApis\": 3,\n * \"totalEndpoints\": 47\n * }\n * ```\n * \n * @example Priority-based conflict resolution\n * ```json\n * {\n * \"conflictResolution\": \"priority\",\n * \"apis\": [\n * {\n * \"id\": \"core_api\",\n * \"endpoints\": [\n * {\n * \"path\": \"/api/v1/data/:object\",\n * \"priority\": 950\n * }\n * ]\n * },\n * {\n * \"id\": \"plugin_api\",\n * \"endpoints\": [\n * {\n * \"path\": \"/api/v1/data/custom\",\n * \"priority\": 300\n * }\n * ]\n * }\n * ]\n * }\n * ```\n */\nexport const ApiRegistrySchema = z.object({\n /** Registry version */\n version: z.string().describe('Registry version'),\n \n /**\n * Conflict Resolution Strategy\n * \n * Defines how to handle route conflicts when multiple endpoints\n * register the same or overlapping URL patterns.\n * \n * **Strategies:**\n * - `error`: Throw error on conflict (safest, prevents silent overwrites)\n * - `priority`: Use endpoint priority field (highest priority wins)\n * - `first-wins`: First registered endpoint wins (stable, predictable)\n * - `last-wins`: Last registered endpoint wins (allows overrides)\n * \n * **Default:** `error`\n * \n * **Best Practices:**\n * - Use `error` in production to catch configuration issues\n * - Use `priority` when mixing core and plugin APIs\n * - Use `last-wins` for development/testing overrides\n * \n * @example Prevent accidental conflicts\n * ```json\n * {\n * \"conflictResolution\": \"error\"\n * }\n * ```\n * \n * @example Allow plugin overrides with priority\n * ```json\n * {\n * \"conflictResolution\": \"priority\"\n * }\n * ```\n */\n conflictResolution: ConflictResolutionStrategy.optional().default('error')\n .describe('Strategy for handling route conflicts'),\n \n /** Registered APIs */\n apis: z.array(ApiRegistryEntrySchema).describe('All registered APIs'),\n \n /** Total API count */\n totalApis: z.number().int().describe('Total number of registered APIs'),\n \n /** Total endpoint count across all APIs */\n totalEndpoints: z.number().int().describe('Total number of endpoints'),\n \n /** APIs grouped by type */\n byType: z.record(ApiProtocolType, z.array(ApiRegistryEntrySchema)).optional()\n .describe('APIs grouped by protocol type'),\n \n /** APIs grouped by status */\n byStatus: z.record(z.string(), z.array(ApiRegistryEntrySchema)).optional()\n .describe('APIs grouped by status'),\n \n /** Last updated timestamp */\n updatedAt: z.string().datetime().optional().describe('Last registry update time'),\n});\n\nexport type ApiRegistry = z.infer<typeof ApiRegistrySchema>;\n\n// ==========================================\n// API Discovery & Query\n// ==========================================\n\n/**\n * API Discovery Query Schema\n * \n * Query parameters for discovering/filtering APIs in the registry.\n * \n * @example\n * ```json\n * {\n * \"type\": \"rest\",\n * \"tags\": [\"customer\"],\n * \"status\": \"active\"\n * }\n * ```\n */\nexport const ApiDiscoveryQuerySchema = z.object({\n /** Filter by API type */\n type: ApiProtocolType.optional().describe('Filter by API protocol type'),\n \n /** Filter by tags */\n tags: z.array(z.string()).optional().describe('Filter by tags (ANY match)'),\n \n /** Filter by status */\n status: z.enum(['active', 'deprecated', 'experimental', 'beta']).optional()\n .describe('Filter by lifecycle status'),\n \n /** Filter by plugin source */\n pluginSource: z.string().optional().describe('Filter by plugin name'),\n \n /** Search in name/description */\n search: z.string().optional().describe('Full-text search in name/description'),\n \n /** Filter by version */\n version: z.string().optional().describe('Filter by specific version'),\n});\n\nexport type ApiDiscoveryQuery = z.infer<typeof ApiDiscoveryQuerySchema>;\n\n/**\n * API Discovery Response Schema\n * \n * Response for API discovery queries.\n */\nexport const ApiDiscoveryResponseSchema = z.object({\n /** Matching APIs */\n apis: z.array(ApiRegistryEntrySchema).describe('Matching API entries'),\n \n /** Total matches */\n total: z.number().int().describe('Total matching APIs'),\n \n /** Applied filters */\n filters: ApiDiscoveryQuerySchema.optional().describe('Applied query filters'),\n});\n\nexport type ApiDiscoveryResponse = z.infer<typeof ApiDiscoveryResponseSchema>;\n\n// ==========================================\n// Helper Functions\n// ==========================================\n\n/**\n * Helper to create API endpoint registration\n */\nexport const ApiEndpointRegistration = Object.assign(ApiEndpointRegistrationSchema, {\n create: <T extends z.input<typeof ApiEndpointRegistrationSchema>>(config: T) => config,\n});\n\n/**\n * Helper to create API registry entry\n */\nexport const ApiRegistryEntry = Object.assign(ApiRegistryEntrySchema, {\n create: <T extends z.input<typeof ApiRegistryEntrySchema>>(config: T) => config,\n});\n\n/**\n * Helper to create API registry\n */\nexport const ApiRegistry = Object.assign(ApiRegistrySchema, {\n create: <T extends z.input<typeof ApiRegistrySchema>>(config: T) => config,\n});\n","// Copyright (c) 2025 ObjectStack. Licensed under the Apache-2.0 license.\n\nimport { z } from 'zod';\n\n/**\n * API Documentation & Testing Interface Protocol\n * \n * Provides schemas for generating interactive API documentation and testing\n * interfaces similar to Swagger UI, GraphQL Playground, Postman, etc.\n * \n * Features:\n * - OpenAPI/Swagger specification generation\n * - Interactive API testing playground\n * - API versioning and changelog\n * - Code generation templates\n * - Mock server configuration\n * \n * Architecture Alignment:\n * - Swagger UI: Interactive API documentation\n * - Postman: API testing collections\n * - GraphQL Playground: GraphQL-specific testing\n * - Redoc: Documentation rendering\n * \n * @example Documentation Config\n * ```typescript\n * const docConfig: ApiDocumentationConfig = {\n * enabled: true,\n * title: 'ObjectStack API',\n * version: '1.0.0',\n * servers: [{ url: 'https://api.example.com', description: 'Production' }],\n * ui: {\n * type: 'swagger-ui',\n * theme: 'light',\n * enableTryItOut: true\n * }\n * }\n * ```\n */\n\n// ==========================================\n// OpenAPI Specification\n// ==========================================\n\n/**\n * OpenAPI Server Schema\n * \n * Server configuration for OpenAPI specification.\n */\nexport const OpenApiServerSchema = z.object({\n /** Server URL */\n url: z.string().url().describe('Server base URL'),\n \n /** Server description */\n description: z.string().optional().describe('Server description'),\n \n /** Server variables */\n variables: z.record(z.string(), z.object({\n default: z.string(),\n description: z.string().optional(),\n enum: z.array(z.string()).optional(),\n })).optional().describe('URL template variables'),\n});\n\nexport type OpenApiServer = z.infer<typeof OpenApiServerSchema>;\n\n/**\n * OpenAPI Security Scheme Schema\n * \n * Security scheme definition for OpenAPI.\n */\nexport const OpenApiSecuritySchemeSchema = z.object({\n /** Security scheme type */\n type: z.enum(['apiKey', 'http', 'oauth2', 'openIdConnect']).describe('Security type'),\n \n /** Scheme name */\n scheme: z.string().optional().describe('HTTP auth scheme (bearer, basic, etc.)'),\n \n /** Bearer format */\n bearerFormat: z.string().optional().describe('Bearer token format (e.g., JWT)'),\n \n /** API key name */\n name: z.string().optional().describe('API key parameter name'),\n \n /** API key location */\n in: z.enum(['header', 'query', 'cookie']).optional().describe('API key location'),\n \n /** OAuth flows */\n flows: z.object({\n implicit: z.unknown().optional(),\n password: z.unknown().optional(),\n clientCredentials: z.unknown().optional(),\n authorizationCode: z.unknown().optional(),\n }).optional().describe('OAuth2 flows'),\n \n /** OpenID Connect URL */\n openIdConnectUrl: z.string().url().optional().describe('OpenID Connect discovery URL'),\n \n /** Description */\n description: z.string().optional().describe('Security scheme description'),\n});\n\nexport type OpenApiSecurityScheme = z.infer<typeof OpenApiSecuritySchemeSchema>;\n\n/**\n * OpenAPI Specification Schema\n * \n * Complete OpenAPI 3.0 specification structure.\n * \n * @see https://swagger.io/specification/\n * \n * @example\n * ```json\n * {\n * \"openapi\": \"3.0.0\",\n * \"info\": {\n * \"title\": \"ObjectStack API\",\n * \"version\": \"1.0.0\",\n * \"description\": \"ObjectStack unified API\"\n * },\n * \"servers\": [\n * { \"url\": \"https://api.example.com\" }\n * ],\n * \"paths\": { ... },\n * \"components\": { ... }\n * }\n * ```\n */\nexport const OpenApiSpecSchema = z.object({\n /** OpenAPI version */\n openapi: z.string().default('3.0.0').describe('OpenAPI specification version'),\n \n /** API information */\n info: z.object({\n title: z.string().describe('API title'),\n version: z.string().describe('API version'),\n description: z.string().optional().describe('API description'),\n termsOfService: z.string().url().optional().describe('Terms of service URL'),\n contact: z.object({\n name: z.string().optional(),\n url: z.string().url().optional(),\n email: z.string().email().optional(),\n }).optional(),\n license: z.object({\n name: z.string(),\n url: z.string().url().optional(),\n }).optional(),\n }).describe('API metadata'),\n \n /** Servers */\n servers: z.array(OpenApiServerSchema).optional().default([]).describe('API servers'),\n \n /** API paths */\n paths: z.record(z.string(), z.unknown()).describe('API paths and operations'),\n \n /** Reusable components */\n components: z.object({\n schemas: z.record(z.string(), z.unknown()).optional(),\n responses: z.record(z.string(), z.unknown()).optional(),\n parameters: z.record(z.string(), z.unknown()).optional(),\n examples: z.record(z.string(), z.unknown()).optional(),\n requestBodies: z.record(z.string(), z.unknown()).optional(),\n headers: z.record(z.string(), z.unknown()).optional(),\n securitySchemes: z.record(z.string(), OpenApiSecuritySchemeSchema).optional(),\n links: z.record(z.string(), z.unknown()).optional(),\n callbacks: z.record(z.string(), z.unknown()).optional(),\n }).optional().describe('Reusable components'),\n \n /** Security requirements */\n security: z.array(z.record(z.string(), z.array(z.string()))).optional()\n .describe('Global security requirements'),\n \n /** Tags */\n tags: z.array(z.object({\n name: z.string(),\n description: z.string().optional(),\n externalDocs: z.object({\n description: z.string().optional(),\n url: z.string().url(),\n }).optional(),\n })).optional().describe('Tag definitions'),\n \n /** External documentation */\n externalDocs: z.object({\n description: z.string().optional(),\n url: z.string().url(),\n }).optional().describe('External documentation'),\n});\n\nexport type OpenApiSpec = z.infer<typeof OpenApiSpecSchema>;\n\n// ==========================================\n// API Testing Playground\n// ==========================================\n\n/**\n * API Testing UI Type\n */\nexport const ApiTestingUiType = z.enum([\n 'swagger-ui', // Swagger UI\n 'redoc', // Redoc\n 'rapidoc', // RapiDoc\n 'stoplight', // Stoplight Elements\n 'scalar', // Scalar API Reference\n 'graphql-playground', // GraphQL Playground\n 'graphiql', // GraphiQL\n 'postman', // Postman-like interface\n 'custom', // Custom implementation\n]);\n\nexport type ApiTestingUiType = z.infer<typeof ApiTestingUiType>;\n\n/**\n * API Testing UI Configuration Schema\n * \n * Configuration for interactive API testing interface.\n * \n * @example Swagger UI Config\n * ```json\n * {\n * \"type\": \"swagger-ui\",\n * \"path\": \"/api-docs\",\n * \"theme\": \"light\",\n * \"enableTryItOut\": true,\n * \"enableFilter\": true,\n * \"enableCors\": true,\n * \"defaultModelsExpandDepth\": 1\n * }\n * ```\n */\nexport const ApiTestingUiConfigSchema = z.object({\n /** UI type */\n type: ApiTestingUiType.describe('Testing UI implementation'),\n \n /** UI path */\n path: z.string().default('/api-docs').describe('URL path for documentation UI'),\n \n /** UI theme */\n theme: z.enum(['light', 'dark', 'auto']).default('light').describe('UI color theme'),\n \n /** Enable try-it-out feature */\n enableTryItOut: z.boolean().default(true).describe('Enable interactive API testing'),\n \n /** Enable filtering */\n enableFilter: z.boolean().default(true).describe('Enable endpoint filtering'),\n \n /** Enable CORS for testing */\n enableCors: z.boolean().default(true).describe('Enable CORS for browser testing'),\n \n /** Default expand depth for models */\n defaultModelsExpandDepth: z.number().int().min(-1).default(1)\n .describe('Default expand depth for schemas (-1 = fully expand)'),\n \n /** Display request duration */\n displayRequestDuration: z.boolean().default(true).describe('Show request duration'),\n \n /** Syntax highlighting */\n syntaxHighlighting: z.boolean().default(true).describe('Enable syntax highlighting'),\n \n /** Custom CSS URL */\n customCssUrl: z.string().url().optional().describe('Custom CSS stylesheet URL'),\n \n /** Custom JavaScript URL */\n customJsUrl: z.string().url().optional().describe('Custom JavaScript URL'),\n \n /** Layout options */\n layout: z.object({\n showExtensions: z.boolean().default(false).describe('Show vendor extensions'),\n showCommonExtensions: z.boolean().default(false).describe('Show common extensions'),\n deepLinking: z.boolean().default(true).describe('Enable deep linking'),\n displayOperationId: z.boolean().default(false).describe('Display operation IDs'),\n defaultModelRendering: z.enum(['example', 'model']).default('example')\n .describe('Default model rendering mode'),\n defaultModelsExpandDepth: z.number().int().default(1).describe('Models expand depth'),\n defaultModelExpandDepth: z.number().int().default(1).describe('Single model expand depth'),\n docExpansion: z.enum(['list', 'full', 'none']).default('list')\n .describe('Documentation expansion mode'),\n }).optional().describe('Layout configuration'),\n});\n\nexport type ApiTestingUiConfig = z.infer<typeof ApiTestingUiConfigSchema>;\n\n/**\n * API Test Request Schema\n * \n * Represents a saved/example API test request.\n * \n * @example\n * ```json\n * {\n * \"name\": \"Get Customer by ID\",\n * \"description\": \"Retrieves a customer record\",\n * \"method\": \"GET\",\n * \"url\": \"/api/v1/data/customer/123\",\n * \"headers\": {\n * \"Authorization\": \"Bearer {{token}}\"\n * },\n * \"variables\": {\n * \"token\": \"sample_token\"\n * }\n * }\n * ```\n */\nexport const ApiTestRequestSchema = z.object({\n /** Request name */\n name: z.string().describe('Test request name'),\n \n /** Request description */\n description: z.string().optional().describe('Request description'),\n \n /** HTTP method */\n method: z.enum(['GET', 'POST', 'PUT', 'PATCH', 'DELETE', 'HEAD', 'OPTIONS'])\n .describe('HTTP method'),\n \n /** Request URL */\n url: z.string().describe('Request URL (can include variables)'),\n \n /** Request headers */\n headers: z.record(z.string(), z.string()).optional().default({})\n .describe('Request headers'),\n \n /** Query parameters */\n queryParams: z.record(z.string(), z.union([z.string(), z.number(), z.boolean()]))\n .optional().default({}).describe('Query parameters'),\n \n /** Request body */\n body: z.unknown().optional().describe('Request body'),\n \n /** Environment variables */\n variables: z.record(z.string(), z.unknown()).optional().default({})\n .describe('Template variables'),\n \n /** Expected response */\n expectedResponse: z.object({\n statusCode: z.number().int(),\n body: z.unknown().optional(),\n }).optional().describe('Expected response for validation'),\n});\n\nexport type ApiTestRequest = z.infer<typeof ApiTestRequestSchema>;\n\n/**\n * API Test Collection Schema\n * \n * Collection of test requests (similar to Postman collections).\n * \n * @example\n * ```json\n * {\n * \"name\": \"Customer API Tests\",\n * \"description\": \"Test collection for customer endpoints\",\n * \"variables\": {\n * \"baseUrl\": \"https://api.example.com\",\n * \"apiKey\": \"test_key\"\n * },\n * \"requests\": [...]\n * }\n * ```\n */\nexport const ApiTestCollectionSchema = z.object({\n /** Collection name */\n name: z.string().describe('Collection name'),\n \n /** Collection description */\n description: z.string().optional().describe('Collection description'),\n \n /** Collection variables */\n variables: z.record(z.string(), z.unknown()).optional().default({})\n .describe('Shared variables'),\n \n /** Test requests */\n requests: z.array(ApiTestRequestSchema).describe('Test requests in this collection'),\n \n /** Folders/grouping */\n folders: z.array(z.object({\n name: z.string(),\n description: z.string().optional(),\n requests: z.array(ApiTestRequestSchema),\n })).optional().describe('Request folders for organization'),\n});\n\nexport type ApiTestCollection = z.infer<typeof ApiTestCollectionSchema>;\n\n// ==========================================\n// API Documentation Configuration\n// ==========================================\n\n/**\n * API Changelog Entry Schema\n * \n * Documents changes in API versions.\n */\nexport const ApiChangelogEntrySchema = z.object({\n /** Version */\n version: z.string().describe('API version'),\n \n /** Release date */\n date: z.string().date().describe('Release date'),\n \n /** Changes */\n changes: z.object({\n added: z.array(z.string()).optional().default([]).describe('New features'),\n changed: z.array(z.string()).optional().default([]).describe('Changes'),\n deprecated: z.array(z.string()).optional().default([]).describe('Deprecations'),\n removed: z.array(z.string()).optional().default([]).describe('Removed features'),\n fixed: z.array(z.string()).optional().default([]).describe('Bug fixes'),\n security: z.array(z.string()).optional().default([]).describe('Security fixes'),\n }).describe('Version changes'),\n \n /** Migration guide */\n migrationGuide: z.string().optional().describe('Migration guide URL or text'),\n});\n\nexport type ApiChangelogEntry = z.infer<typeof ApiChangelogEntrySchema>;\n\n/**\n * Code Generation Template Schema\n * \n * Templates for generating client code.\n */\nexport const CodeGenerationTemplateSchema = z.object({\n /** Language/framework */\n language: z.string().describe('Target language/framework (e.g., typescript, python, curl)'),\n \n /** Template name */\n name: z.string().describe('Template name'),\n \n /** Template content */\n template: z.string().describe('Code template with placeholders'),\n \n /** Template variables */\n variables: z.array(z.string()).optional().describe('Required template variables'),\n});\n\nexport type CodeGenerationTemplate = z.infer<typeof CodeGenerationTemplateSchema>;\n\n/**\n * API Documentation Configuration Schema\n * \n * Complete configuration for API documentation and testing interface.\n * \n * @example\n * ```json\n * {\n * \"enabled\": true,\n * \"title\": \"ObjectStack API Documentation\",\n * \"version\": \"1.0.0\",\n * \"description\": \"Unified API for ObjectStack platform\",\n * \"servers\": [\n * { \"url\": \"https://api.example.com\", \"description\": \"Production\" }\n * ],\n * \"ui\": {\n * \"type\": \"swagger-ui\",\n * \"theme\": \"light\",\n * \"enableTryItOut\": true\n * },\n * \"generateOpenApi\": true,\n * \"generateTestCollections\": true\n * }\n * ```\n */\nexport const ApiDocumentationConfigSchema = z.object({\n /** Enable documentation */\n enabled: z.boolean().default(true).describe('Enable API documentation'),\n \n /** Documentation title */\n title: z.string().default('API Documentation').describe('Documentation title'),\n \n /** API version */\n version: z.string().describe('API version'),\n \n /** API description */\n description: z.string().optional().describe('API description'),\n \n /** Server configurations */\n servers: z.array(OpenApiServerSchema).optional().default([])\n .describe('API server URLs'),\n \n /** UI configuration */\n ui: ApiTestingUiConfigSchema.optional().describe('Testing UI configuration'),\n \n /** Generate OpenAPI spec */\n generateOpenApi: z.boolean().default(true).describe('Generate OpenAPI 3.0 specification'),\n \n /** Generate test collections */\n generateTestCollections: z.boolean().default(true)\n .describe('Generate API test collections'),\n \n /** Test collections */\n testCollections: z.array(ApiTestCollectionSchema).optional().default([])\n .describe('Predefined test collections'),\n \n /** API changelog */\n changelog: z.array(ApiChangelogEntrySchema).optional().default([])\n .describe('API version changelog'),\n \n /** Code generation templates */\n codeTemplates: z.array(CodeGenerationTemplateSchema).optional().default([])\n .describe('Code generation templates'),\n \n /** Terms of service */\n termsOfService: z.string().url().optional().describe('Terms of service URL'),\n \n /** Contact information */\n contact: z.object({\n name: z.string().optional(),\n url: z.string().url().optional(),\n email: z.string().email().optional(),\n }).optional().describe('Contact information'),\n \n /** License */\n license: z.object({\n name: z.string(),\n url: z.string().url().optional(),\n }).optional().describe('API license'),\n \n /** External documentation */\n externalDocs: z.object({\n description: z.string().optional(),\n url: z.string().url(),\n }).optional().describe('External documentation link'),\n \n /** Security schemes */\n securitySchemes: z.record(z.string(), OpenApiSecuritySchemeSchema).optional()\n .describe('Security scheme definitions'),\n \n /** Global tags */\n tags: z.array(z.object({\n name: z.string(),\n description: z.string().optional(),\n externalDocs: z.object({\n description: z.string().optional(),\n url: z.string().url(),\n }).optional(),\n })).optional().describe('Global tag definitions'),\n});\n\nexport type ApiDocumentationConfig = z.infer<typeof ApiDocumentationConfigSchema>;\n\n// ==========================================\n// API Documentation Generation\n// ==========================================\n\n/**\n * Generated API Documentation Schema\n * \n * Output of documentation generation process.\n */\nexport const GeneratedApiDocumentationSchema = z.object({\n /** OpenAPI specification */\n openApiSpec: OpenApiSpecSchema.optional().describe('Generated OpenAPI specification'),\n \n /** Test collections */\n testCollections: z.array(ApiTestCollectionSchema).optional()\n .describe('Generated test collections'),\n \n /** Markdown documentation */\n markdown: z.string().optional().describe('Generated markdown documentation'),\n \n /** HTML documentation */\n html: z.string().optional().describe('Generated HTML documentation'),\n \n /** Generation timestamp */\n generatedAt: z.string().datetime().describe('Generation timestamp'),\n \n /** Source APIs */\n sourceApis: z.array(z.string()).describe('Source API IDs used for generation'),\n});\n\nexport type GeneratedApiDocumentation = z.infer<typeof GeneratedApiDocumentationSchema>;\n\n// ==========================================\n// Helper Functions\n// ==========================================\n\n/**\n * Helper to create API documentation config\n */\nexport const ApiDocumentationConfig = Object.assign(ApiDocumentationConfigSchema, {\n create: <T extends z.input<typeof ApiDocumentationConfigSchema>>(config: T) => config,\n});\n\n/**\n * Helper to create API test collection\n */\nexport const ApiTestCollection = Object.assign(ApiTestCollectionSchema, {\n create: <T extends z.input<typeof ApiTestCollectionSchema>>(config: T) => config,\n});\n\n/**\n * Helper to create OpenAPI specification\n */\nexport const OpenApiSpec = Object.assign(OpenApiSpecSchema, {\n create: <T extends z.input<typeof OpenApiSpecSchema>>(config: T) => config,\n});\n","// Copyright (c) 2025 ObjectStack. Licensed under the Apache-2.0 license.\n\nimport { z } from 'zod';\nimport { AnalyticsQuerySchema, CubeSchema } from '../data/analytics.zod';\nimport { BaseResponseSchema } from './contract.zod';\n\n/**\n * Analytics API Protocol\n * \n * Defines the HTTP interface for the Semantic Layer.\n * Provides endpoints for executing analytical queries and discovering metadata.\n */\n\n// ==========================================\n// 1. API Endpoints\n// ==========================================\n\nexport const AnalyticsEndpoint = z.enum([\n '/api/v1/analytics/query', // Execute analysis\n '/api/v1/analytics/meta', // Discover cubes/metrics\n '/api/v1/analytics/sql', // Dry-run SQL generation\n]);\n\n// ==========================================\n// 2. Query Execution\n// ==========================================\n\n/**\n * Query Request Body\n */\nexport const AnalyticsQueryRequestSchema = z.object({\n query: AnalyticsQuerySchema.describe(' The analytic query definition'),\n cube: z.string().describe('Target cube name'),\n format: z.enum(['json', 'csv', 'xlsx']).default('json').describe('Response format'),\n});\n\n/**\n * Query Response (JSON)\n */\nexport const AnalyticsResultResponseSchema = BaseResponseSchema.extend({\n data: z.object({\n rows: z.array(z.record(z.string(), z.unknown())).describe('Result rows'),\n fields: z.array(z.object({\n name: z.string(),\n type: z.string(),\n })).describe('Column metadata'),\n sql: z.string().optional().describe('Executed SQL (if debug enabled)'),\n }),\n});\n\n// ==========================================\n// 3. Metadata Discovery\n// ==========================================\n\n/**\n * Meta Request\n */\nexport const GetAnalyticsMetaRequestSchema = z.object({\n cube: z.string().optional().describe('Optional cube name to filter'),\n});\n\n/**\n * Meta Response\n * Returns available cubes, metrics, and dimensions.\n */\nexport const AnalyticsMetadataResponseSchema = BaseResponseSchema.extend({\n data: z.object({\n cubes: z.array(CubeSchema).describe('Available cubes'),\n }),\n});\n\n// ==========================================\n// 4. SQL Dry-Run\n// ==========================================\n\nexport const AnalyticsSqlResponseSchema = BaseResponseSchema.extend({\n data: z.object({\n sql: z.string(),\n params: z.array(z.unknown()),\n }),\n});\n\nexport type AnalyticsEndpoint = z.infer<typeof AnalyticsEndpoint>;\nexport type AnalyticsMetadataResponse = z.infer<typeof AnalyticsMetadataResponseSchema>;\nexport type AnalyticsSqlResponse = z.infer<typeof AnalyticsSqlResponseSchema>;\n","// Copyright (c) 2025 ObjectStack. Licensed under the Apache-2.0 license.\n\nimport { z } from 'zod';\n\n/**\n * Analytics/Semantic Layer Protocol\n * \n * Defines the \"Business Logic\" for data analysis.\n * Inspired by Cube.dev, LookML, and dbt MetricFlow.\n * \n * This layer decouples the \"Physical Data\" (Tables/Columns) from the \n * \"Business Data\" (Metrics/Dimensions).\n */\n\n/**\n * Aggregation Metric Type\n * The mathematical operation to perform on a metric.\n */\nexport const AggregationMetricType = z.enum([\n 'count', \n 'sum', \n 'avg', \n 'min', \n 'max', \n 'count_distinct', \n 'number', // Custom SQL expression returning a number\n 'string', // Custom SQL expression returning a string\n 'boolean' // Custom SQL expression returning a boolean\n]);\n\n/**\n * Dimension Type\n * The nature of the grouping field.\n */\nexport const DimensionType = z.enum([\n 'string', \n 'number', \n 'boolean', \n 'time', \n 'geo'\n]);\n\n/**\n * Time Interval for Time Dimensions\n */\nexport const TimeUpdateInterval = z.enum([\n 'second', 'minute', 'hour', 'day', 'week', 'month', 'quarter', 'year'\n]);\n\n/**\n * Metric Schema\n * A quantitative measurement (e.g., \"Total Revenue\", \"Average Order Value\").\n */\nexport const MetricSchema = z.object({\n name: z.string().regex(/^[a-z_][a-z0-9_]*$/).describe('Unique metric ID'),\n label: z.string().describe('Human readable label'),\n description: z.string().optional(),\n \n type: AggregationMetricType,\n \n /** Source Calculation */\n sql: z.string().describe('SQL expression or field reference'),\n \n /** Filtering for this specific metric (e.g. \"Revenue from Premium Users\") */\n filters: z.array(z.object({\n sql: z.string()\n })).optional(),\n \n /** Format for display (e.g. \"currency\", \"percent\") */\n format: z.string().optional(),\n});\n\n/**\n * Dimension Schema\n * A categorical attribute to group by (e.g., \"Product Category\", \"Order Date\").\n */\nexport const DimensionSchema = z.object({\n name: z.string().regex(/^[a-z_][a-z0-9_]*$/).describe('Unique dimension ID'),\n label: z.string().describe('Human readable label'),\n description: z.string().optional(),\n \n type: DimensionType,\n \n /** Source Column */\n sql: z.string().describe('SQL expression or column reference'),\n \n /** For Time Dimensions: Supported Granularities */\n granularities: z.array(TimeUpdateInterval).optional(),\n});\n\n/**\n * Join Schema\n * Defines how this cube relates to others.\n */\nexport const CubeJoinSchema = z.object({\n name: z.string().describe('Target cube name'),\n relationship: z.enum(['one_to_one', 'one_to_many', 'many_to_one']).default('many_to_one'),\n sql: z.string().describe('Join condition (ON clause)'),\n});\n\n/**\n * Cube Schema\n * A logical data model representing a business entity or process for analysis.\n * Maps physical tables to business metrics and dimensions.\n */\nexport const CubeSchema = z.object({\n name: z.string().regex(/^[a-z_][a-z0-9_]*$/).describe('Cube name (snake_case)'),\n title: z.string().optional(),\n description: z.string().optional(),\n \n /** Physical Data Source */\n sql: z.string().describe('Base SQL statement or Table Name'),\n \n /** Semantic Definitions */\n measures: z.record(z.string(), MetricSchema).describe('Quantitative metrics'),\n dimensions: z.record(z.string(), DimensionSchema).describe('Qualitative attributes'),\n \n /** Relationships */\n joins: z.record(z.string(), CubeJoinSchema).optional(),\n \n /** Pre-aggregations / Caching */\n refreshKey: z.object({\n every: z.string().optional(), // e.g. \"1 hour\"\n sql: z.string().optional(), // SQL to check for data changes\n }).optional(),\n \n /** Access Control */\n public: z.boolean().default(false),\n});\n\n/**\n * Analytics Query Schema\n * The request format for the Analytics API.\n */\nexport const AnalyticsQuerySchema = z.object({\n measures: z.array(z.string()).describe('List of metrics to calculate'),\n dimensions: z.array(z.string()).optional().describe('List of dimensions to group by'),\n \n filters: z.array(z.object({\n member: z.string().describe('Dimension or Measure'),\n operator: z.enum(['equals', 'notEquals', 'contains', 'notContains', 'gt', 'gte', 'lt', 'lte', 'set', 'notSet', 'inDateRange']),\n values: z.array(z.string()).optional(),\n })).optional(),\n \n timeDimensions: z.array(z.object({\n dimension: z.string(),\n granularity: TimeUpdateInterval.optional(),\n dateRange: z.union([\n z.string(), // \"Last 7 days\"\n z.array(z.string()) // [\"2023-01-01\", \"2023-01-31\"]\n ]).optional(),\n })).optional(),\n \n order: z.record(z.string(), z.enum(['asc', 'desc'])).optional(),\n \n limit: z.number().optional(),\n offset: z.number().optional(),\n \n timezone: z.string().default('UTC'),\n});\n\nexport type Metric = z.infer<typeof MetricSchema>;\nexport type Dimension = z.infer<typeof DimensionSchema>;\nexport type CubeJoin = z.infer<typeof CubeJoinSchema>;\nexport type Cube = z.infer<typeof CubeSchema>;\nexport type AnalyticsQuery = z.infer<typeof AnalyticsQuerySchema>;\n","// Copyright (c) 2025 ObjectStack. Licensed under the Apache-2.0 license.\n\nimport { z } from 'zod';\n\n/**\n * # API Versioning Protocol\n * \n * Defines how API versions are negotiated between client and server.\n * Supports multiple versioning strategies and deprecation lifecycle management.\n * \n * Architecture Alignment:\n * - Salesforce: URL path versioning (v57.0, v58.0)\n * - Stripe: Date-based versioning (2024-01-01)\n * - Kubernetes: API group versioning (v1, v1beta1)\n * - GitHub: Accept header versioning (application/vnd.github.v3+json)\n * - Microsoft Graph: URL path versioning (v1.0, beta)\n */\n\n// ==========================================\n// Versioning Strategy\n// ==========================================\n\n/**\n * API Versioning Strategy\n * Determines how the API version is specified by clients.\n * \n * - `urlPath`: Version in URL path (e.g., /api/v1/data) — Most common, easy to understand\n * - `header`: Version in Accept header (e.g., Accept: application/vnd.objectstack.v1+json)\n * - `queryParam`: Version in query parameter (e.g., /api/data?version=v1)\n * - `dateBased`: Date-based version in header (e.g., ObjectStack-Version: 2025-01-01) — Stripe-style\n */\nexport const VersioningStrategy = z.enum([\n 'urlPath',\n 'header',\n 'queryParam',\n 'dateBased',\n]);\n\nexport type VersioningStrategy = z.infer<typeof VersioningStrategy>;\n\n// ==========================================\n// Version Lifecycle\n// ==========================================\n\n/**\n * API Version Status\n * Lifecycle state of an API version.\n * \n * - `preview`: Available for testing, may change without notice (e.g., v2beta1)\n * - `current`: The recommended stable version\n * - `supported`: Older but still maintained (receives security fixes)\n * - `deprecated`: Scheduled for removal, clients should migrate\n * - `retired`: No longer available, requests return 410 Gone\n */\nexport const VersionStatus = z.enum([\n 'preview',\n 'current',\n 'supported',\n 'deprecated',\n 'retired',\n]);\n\nexport type VersionStatus = z.infer<typeof VersionStatus>;\n\n// ==========================================\n// Version Definition\n// ==========================================\n\n/**\n * API Version Definition Schema\n * Describes a single API version and its lifecycle metadata.\n * \n * @example\n * {\n * \"version\": \"v1\",\n * \"status\": \"current\",\n * \"releasedAt\": \"2025-01-15\",\n * \"description\": \"Initial stable release\"\n * }\n * \n * @example Deprecated version\n * {\n * \"version\": \"v0\",\n * \"status\": \"deprecated\",\n * \"releasedAt\": \"2024-06-01\",\n * \"deprecatedAt\": \"2025-01-15\",\n * \"sunsetAt\": \"2025-07-15\",\n * \"migrationGuide\": \"https://docs.objectstack.dev/migrate/v0-to-v1\",\n * \"description\": \"Legacy API version\"\n * }\n */\nexport const VersionDefinitionSchema = z.object({\n /** Version identifier (e.g., \"v1\", \"v2beta1\", \"2025-01-01\") */\n version: z.string().describe('Version identifier (e.g., \"v1\", \"v2beta1\", \"2025-01-01\")'),\n\n /** Current lifecycle status */\n status: VersionStatus.describe('Lifecycle status of this version'),\n\n /** Date this version was released (ISO 8601 date) */\n releasedAt: z.string().describe('Release date (ISO 8601, e.g., \"2025-01-15\")'),\n\n /** Date this version was deprecated (ISO 8601 date) */\n deprecatedAt: z.string().optional()\n .describe('Deprecation date (ISO 8601). Only set for deprecated/retired versions'),\n\n /** Date this version will be retired (ISO 8601 date) */\n sunsetAt: z.string().optional()\n .describe('Sunset date (ISO 8601). After this date, the version returns 410 Gone'),\n\n /** URL to migration guide for moving to a newer version */\n migrationGuide: z.string().url().optional()\n .describe('URL to migration guide for upgrading from this version'),\n\n /** Human-readable description of this version */\n description: z.string().optional()\n .describe('Human-readable description or release notes summary'),\n\n /** Breaking changes introduced in or since this version */\n breakingChanges: z.array(z.string()).optional()\n .describe('List of breaking changes (for preview/new versions)'),\n});\n\nexport type VersionDefinition = z.infer<typeof VersionDefinitionSchema>;\n\n// ==========================================\n// Versioning Configuration\n// ==========================================\n\n/**\n * API Versioning Configuration Schema\n * Complete configuration for API version management.\n * \n * @example\n * {\n * \"strategy\": \"urlPath\",\n * \"current\": \"v1\",\n * \"default\": \"v1\",\n * \"versions\": [\n * { \"version\": \"v1\", \"status\": \"current\", \"releasedAt\": \"2025-01-15\" },\n * { \"version\": \"v2beta1\", \"status\": \"preview\", \"releasedAt\": \"2025-06-01\" }\n * ],\n * \"deprecation\": {\n * \"warnHeader\": true,\n * \"sunsetHeader\": true\n * }\n * }\n */\nexport const VersioningConfigSchema = z.object({\n /** Versioning strategy */\n strategy: VersioningStrategy.default('urlPath')\n .describe('How the API version is specified by clients'),\n\n /** Current (recommended) API version */\n current: z.string().describe('The current/recommended API version identifier'),\n\n /** Default version when none specified by client */\n default: z.string().describe('Fallback version when client does not specify one'),\n\n /** All available API versions */\n versions: z.array(VersionDefinitionSchema)\n .min(1)\n .describe('All available API versions with lifecycle metadata'),\n\n /** Header name for header-based versioning */\n headerName: z.string().default('ObjectStack-Version')\n .describe('HTTP header name for version negotiation (header/dateBased strategies)'),\n\n /** Query parameter name for queryParam strategy */\n queryParamName: z.string().default('version')\n .describe('Query parameter name for version specification (queryParam strategy)'),\n\n /** URL prefix pattern for urlPath strategy */\n urlPrefix: z.string().default('/api')\n .describe('URL prefix before version segment (urlPath strategy)'),\n\n /** Deprecation behavior */\n deprecation: z.object({\n /** Include Deprecation header in responses for deprecated versions */\n warnHeader: z.boolean().default(true)\n .describe('Include Deprecation header (RFC 8594) in responses'),\n\n /** Include Sunset header with retirement date */\n sunsetHeader: z.boolean().default(true)\n .describe('Include Sunset header (RFC 8594) with retirement date'),\n\n /** Include Link header pointing to migration guide */\n linkHeader: z.boolean().default(true)\n .describe('Include Link header pointing to migration guide URL'),\n\n /** Whether to reject requests to retired versions */\n rejectRetired: z.boolean().default(true)\n .describe('Return 410 Gone for retired API versions'),\n\n /** Custom deprecation warning message */\n warningMessage: z.string().optional()\n .describe('Custom warning message for deprecated version responses'),\n }).optional().describe('Deprecation lifecycle behavior'),\n\n /** Whether to include version info in discovery response */\n includeInDiscovery: z.boolean().default(true)\n .describe('Include version information in the API discovery endpoint'),\n});\n\nexport type VersioningConfig = z.infer<typeof VersioningConfigSchema>;\nexport type VersioningConfigInput = z.input<typeof VersioningConfigSchema>;\n\n// ==========================================\n// Version Negotiation Response\n// ==========================================\n\n/**\n * Version Negotiation Response Schema\n * Returned when a client requests version information or\n * included in the discovery endpoint response.\n * \n * @example\n * {\n * \"current\": \"v1\",\n * \"requested\": \"v1\",\n * \"resolved\": \"v1\",\n * \"supported\": [\"v1\", \"v2beta1\"],\n * \"deprecated\": [\"v0\"],\n * \"versions\": [...]\n * }\n */\nexport const VersionNegotiationResponseSchema = z.object({\n /** The current/recommended version */\n current: z.string().describe('Current recommended API version'),\n\n /** The version the client requested (if any) */\n requested: z.string().optional().describe('Version requested by the client'),\n\n /** The version actually being used for this request */\n resolved: z.string().describe('Resolved API version for this request'),\n\n /** All supported (non-retired) version identifiers */\n supported: z.array(z.string()).describe('All supported version identifiers'),\n\n /** Deprecated version identifiers (still functional but will be removed) */\n deprecated: z.array(z.string()).optional()\n .describe('Deprecated version identifiers'),\n\n /** Full version definitions (optional, for detailed clients) */\n versions: z.array(VersionDefinitionSchema).optional()\n .describe('Full version definitions with lifecycle metadata'),\n});\n\nexport type VersionNegotiationResponse = z.infer<typeof VersionNegotiationResponseSchema>;\n\n// ==========================================\n// Default Versioning Configuration\n// ==========================================\n\n/**\n * Default versioning configuration for ObjectStack.\n * Uses URL path strategy with v1 as the current/default version.\n */\nexport const DEFAULT_VERSIONING_CONFIG: VersioningConfigInput = {\n strategy: 'urlPath',\n current: 'v1',\n default: 'v1',\n versions: [\n {\n version: 'v1',\n status: 'current',\n releasedAt: '2025-01-15',\n description: 'ObjectStack API v1 — Initial stable release',\n },\n ],\n deprecation: {\n warnHeader: true,\n sunsetHeader: true,\n linkHeader: true,\n rejectRetired: true,\n },\n includeInDiscovery: true,\n};\n","// Copyright (c) 2025 ObjectStack. Licensed under the Apache-2.0 license.\n\nimport { z } from 'zod';\nimport { BaseResponseSchema } from './contract.zod';\n\n/**\n * Authentication Service Protocol\n * \n * Defines the standard API contracts for Identity, Session Management,\n * and Access Control.\n */\n\n// ==========================================\n// Authentication Types\n// ==========================================\n\nexport const AuthProvider = z.enum([\n 'local',\n 'google',\n 'github',\n 'microsoft',\n 'ldap',\n 'saml'\n]);\n\nexport const SessionUserSchema = z.object({\n id: z.string().describe('User ID'),\n email: z.string().email().describe('Email address'),\n emailVerified: z.boolean().default(false).describe('Is email verified?'),\n name: z.string().describe('Display name'),\n image: z.string().optional().describe('Avatar URL'),\n username: z.string().optional().describe('Username (optional)'),\n roles: z.array(z.string()).optional().default([]).describe('Assigned role IDs'),\n tenantId: z.string().optional().describe('Current tenant ID'),\n language: z.string().default('en').describe('Preferred language'),\n timezone: z.string().optional().describe('Preferred timezone'),\n createdAt: z.string().datetime().optional(),\n updatedAt: z.string().datetime().optional(),\n});\n\nexport const SessionSchema = z.object({\n id: z.string(),\n expiresAt: z.string().datetime(),\n token: z.string().optional(),\n ipAddress: z.string().optional(),\n userAgent: z.string().optional(),\n userId: z.string(),\n});\n\n// ==========================================\n// Requests\n// ==========================================\n\nexport const LoginType = z.enum(['email', 'username', 'phone', 'magic-link', 'social']);\n\nexport const LoginRequestSchema = z.object({\n type: LoginType.default('email').describe('Login method'),\n email: z.string().email().optional().describe('Required for email/magic-link'),\n username: z.string().optional().describe('Required for username login'),\n password: z.string().optional().describe('Required for password login'),\n provider: z.string().optional().describe('Required for social (google, github)'),\n redirectTo: z.string().optional().describe('Redirect URL after successful login'),\n});\n\nexport const RegisterRequestSchema = z.object({\n email: z.string().email(),\n password: z.string(),\n name: z.string(),\n image: z.string().optional(),\n});\n\nexport const RefreshTokenRequestSchema = z.object({\n refreshToken: z.string().describe('Refresh token'),\n});\n\n// ==========================================\n// Responses\n// ==========================================\n\nexport const SessionResponseSchema = BaseResponseSchema.extend({\n data: z.object({\n session: SessionSchema.describe('Active Session Info'),\n user: SessionUserSchema.describe('Current User Details'),\n token: z.string().optional().describe('Bearer token if not using cookies'),\n }),\n});\n\nexport const UserProfileResponseSchema = BaseResponseSchema.extend({\n data: SessionUserSchema,\n});\n\nexport type AuthProvider = z.infer<typeof AuthProvider>;\nexport type SessionUser = z.infer<typeof SessionUserSchema>;\nexport type SessionUserInput = z.input<typeof SessionUserSchema>;\nexport type Session = z.infer<typeof SessionSchema>;\nexport type LoginType = z.infer<typeof LoginType>;\nexport type LoginRequest = z.infer<typeof LoginRequestSchema>;\nexport type LoginRequestInput = z.input<typeof LoginRequestSchema>;\nexport type RegisterRequest = z.infer<typeof RegisterRequestSchema>;\nexport type RefreshTokenRequest = z.infer<typeof RefreshTokenRequestSchema>;\nexport type SessionResponse = z.infer<typeof SessionResponseSchema>;\nexport type UserProfileResponse = z.infer<typeof UserProfileResponseSchema>;\n","// Copyright (c) 2025 ObjectStack. Licensed under the Apache-2.0 license.\n\nimport { z } from 'zod';\n\n/**\n * Authentication Endpoint Specification\n * \n * Defines the canonical HTTP endpoints for the authentication service.\n * Based on better-auth v1.4.18 endpoint conventions.\n * \n * NOTE: ObjectStack's auth implementation uses better-auth library which has\n * established endpoint conventions. This spec documents those conventions as\n * the canonical API contract.\n */\n\n// ==========================================\n// Endpoint Path Definitions\n// ==========================================\n\n/**\n * Authentication Endpoint Paths\n * \n * These are the paths relative to the auth base route (e.g., /api/v1/auth).\n * Based on better-auth's endpoint structure.\n */\nexport const AuthEndpointPaths = {\n // Email/Password Authentication\n signInEmail: '/sign-in/email',\n signUpEmail: '/sign-up/email',\n signOut: '/sign-out',\n \n // Session Management\n getSession: '/get-session',\n \n // Password Management\n forgetPassword: '/forget-password',\n resetPassword: '/reset-password',\n \n // Email Verification\n sendVerificationEmail: '/send-verification-email',\n verifyEmail: '/verify-email',\n \n // OAuth (dynamic based on provider)\n // authorize: '/authorize/:provider'\n // callback: '/callback/:provider'\n \n // 2FA (when enabled)\n twoFactorEnable: '/two-factor/enable',\n twoFactorVerify: '/two-factor/verify',\n \n // Passkeys (when enabled)\n passkeyRegister: '/passkey/register',\n passkeyAuthenticate: '/passkey/authenticate',\n \n // Magic Links (when enabled)\n magicLinkSend: '/magic-link/send',\n magicLinkVerify: '/magic-link/verify',\n} as const;\n\n/**\n * HTTP Method + Path Specification\n * \n * Defines the complete HTTP contract for each endpoint.\n */\nexport const AuthEndpointSchema = z.object({\n /** Sign in with email and password */\n signInEmail: z.object({\n method: z.literal('POST'),\n path: z.literal(AuthEndpointPaths.signInEmail),\n description: z.literal('Sign in with email and password'),\n }),\n \n /** Register new user with email and password */\n signUpEmail: z.object({\n method: z.literal('POST'),\n path: z.literal(AuthEndpointPaths.signUpEmail),\n description: z.literal('Register new user with email and password'),\n }),\n \n /** Sign out current user */\n signOut: z.object({\n method: z.literal('POST'),\n path: z.literal(AuthEndpointPaths.signOut),\n description: z.literal('Sign out current user'),\n }),\n \n /** Get current user session */\n getSession: z.object({\n method: z.literal('GET'),\n path: z.literal(AuthEndpointPaths.getSession),\n description: z.literal('Get current user session'),\n }),\n \n /** Request password reset email */\n forgetPassword: z.object({\n method: z.literal('POST'),\n path: z.literal(AuthEndpointPaths.forgetPassword),\n description: z.literal('Request password reset email'),\n }),\n \n /** Reset password with token */\n resetPassword: z.object({\n method: z.literal('POST'),\n path: z.literal(AuthEndpointPaths.resetPassword),\n description: z.literal('Reset password with token'),\n }),\n \n /** Send email verification */\n sendVerificationEmail: z.object({\n method: z.literal('POST'),\n path: z.literal(AuthEndpointPaths.sendVerificationEmail),\n description: z.literal('Send email verification link'),\n }),\n \n /** Verify email with token */\n verifyEmail: z.object({\n method: z.literal('GET'),\n path: z.literal(AuthEndpointPaths.verifyEmail),\n description: z.literal('Verify email with token'),\n }),\n});\n\n/**\n * Endpoint Aliases\n * \n * Common aliases for better developer experience.\n * These map to the canonical better-auth endpoints.\n */\nexport const AuthEndpointAliases = {\n login: AuthEndpointPaths.signInEmail,\n register: AuthEndpointPaths.signUpEmail,\n logout: AuthEndpointPaths.signOut,\n me: AuthEndpointPaths.getSession,\n} as const;\n\n/**\n * Full Endpoint URLs\n * \n * Helper to construct full endpoint URLs given a base path.\n */\nexport function getAuthEndpointUrl(basePath: string, endpoint: keyof typeof AuthEndpointPaths): string {\n const cleanBase = basePath.replace(/\\/$/, '');\n return `${cleanBase}${AuthEndpointPaths[endpoint]}`;\n}\n\n/**\n * Endpoint Mapping\n * \n * Maps common/legacy endpoint names to canonical better-auth paths.\n * This allows clients to use simpler names while maintaining compatibility.\n */\nexport const EndpointMapping = {\n '/login': AuthEndpointPaths.signInEmail,\n '/register': AuthEndpointPaths.signUpEmail,\n '/logout': AuthEndpointPaths.signOut,\n '/me': AuthEndpointPaths.getSession,\n '/refresh': AuthEndpointPaths.getSession, // Session refresh handled by better-auth automatically\n} as const;\n\n// ==========================================\n// Type Exports\n// ==========================================\n\nexport type AuthEndpoint = z.infer<typeof AuthEndpointSchema>;\nexport type AuthEndpointPath = typeof AuthEndpointPaths[keyof typeof AuthEndpointPaths];\nexport type AuthEndpointAlias = keyof typeof AuthEndpointAliases;\nexport type EndpointMappingKey = keyof typeof EndpointMapping;\n","// Copyright (c) 2025 ObjectStack. Licensed under the Apache-2.0 license.\n\nimport { z } from 'zod';\nimport { BaseResponseSchema } from './contract.zod';\nimport { FileMetadataSchema } from '../system/object-storage.zod';\n\n/**\n * Storage Service Protocol\n * \n * Defines the API contract for client-side file operations.\n * Focuses on secure, direct-to-cloud uploads (Presigned URLs)\n * rather than proxying bytes through the API server.\n */\n\n// ==========================================\n// Requests\n// ==========================================\n\nexport const GetPresignedUrlRequestSchema = z.object({\n filename: z.string().describe('Original filename'),\n mimeType: z.string().describe('File MIME type'),\n size: z.number().describe('File size in bytes'),\n scope: z.string().default('user').describe('Target storage scope (e.g. user, private, public)'),\n bucket: z.string().optional().describe('Specific bucket override (admin only)'),\n});\n\nexport const CompleteUploadRequestSchema = z.object({\n fileId: z.string().describe('File ID returned from presigned request'),\n eTag: z.string().optional().describe('S3 ETag verification'),\n});\n\n// ==========================================\n// Responses\n// ==========================================\n\nexport const PresignedUrlResponseSchema = BaseResponseSchema.extend({\n data: z.object({\n uploadUrl: z.string().describe('PUT/POST URL for direct upload'),\n downloadUrl: z.string().optional().describe('Public/Private preview URL'),\n fileId: z.string().describe('Temporary File ID'),\n method: z.enum(['PUT', 'POST']).describe('HTTP Method to use'),\n headers: z.record(z.string(), z.string()).optional().describe('Required headers for upload'),\n expiresIn: z.number().describe('URL expiry in seconds'),\n }),\n});\n\nexport const FileUploadResponseSchema = BaseResponseSchema.extend({\n data: FileMetadataSchema.describe('Uploaded file metadata'),\n});\n\nexport type GetPresignedUrlRequest = z.infer<typeof GetPresignedUrlRequestSchema>;\nexport type CompleteUploadRequest = z.infer<typeof CompleteUploadRequestSchema>;\nexport type PresignedUrlResponse = z.infer<typeof PresignedUrlResponseSchema>;\nexport type FileUploadResponse = z.infer<typeof FileUploadResponseSchema>;\n","// Copyright (c) 2025 ObjectStack. Licensed under the Apache-2.0 license.\n\nimport { z } from 'zod';\nimport { SystemIdentifierSchema } from '../shared/identifiers.zod';\n\n/**\n * Object Storage Protocol\n * \n * Unified storage protocol that combines:\n * - Object storage systems (S3, Azure Blob, GCS, MinIO)\n * - Scoped storage configuration (temp, cache, data, logs, config, public)\n * - Multi-cloud storage providers\n * - Bucket/container configuration\n * - Access control and permissions\n * - Lifecycle policies for data retention\n * - Presigned URLs for secure direct access\n * - Multipart uploads for large files\n */\n\n// ============================================================================\n// Storage Scope Protocol (formerly from scoped-storage.zod.ts)\n// ============================================================================\n\n/**\n * Storage Scope Enum\n * Defines the lifecycle and persistence guarantee of the storage area.\n */\nexport const StorageScopeSchema = z.enum([\n 'global', // Global application-wide storage\n 'tenant', // Tenant-scoped storage (multi-tenant apps)\n 'user', // User-scoped storage\n 'session', // Session-scoped storage (ephemeral)\n 'temp', // Ephemeral, cleared on restart\n 'cache', // Ephemeral, survives restarts, cleared on LRU/Expiration\n 'data', // Persistent, backed up\n 'logs', // Append-only, rotated\n 'config', // Read-heavy, versioned\n 'public' // Publicly accessible static assets\n]).describe('Storage scope classification');\n\nexport type StorageScope = z.infer<typeof StorageScopeSchema>;\n\n/**\n * File Metadata Schema\n * Standardized file attribute structure\n */\nexport const FileMetadataSchema = z.object({\n path: z.string().describe('File path'),\n name: z.string().describe('File name'),\n size: z.number().int().describe('File size in bytes'),\n mimeType: z.string().describe('MIME type'),\n lastModified: z.string().datetime().describe('Last modified timestamp'),\n created: z.string().datetime().describe('Creation timestamp'),\n etag: z.string().optional().describe('Entity tag'),\n});\n\nexport type FileMetadata = z.infer<typeof FileMetadataSchema>;\n\n// ============================================================================\n// Enums\n// ============================================================================\n\n/**\n * Storage Provider Types\n * \n * Supported cloud and self-hosted object storage providers.\n */\nexport const StorageProviderSchema = z.enum([\n 's3', // Amazon S3\n 'azure_blob', // Azure Blob Storage\n 'gcs', // Google Cloud Storage\n 'minio', // MinIO (self-hosted S3-compatible)\n 'r2', // Cloudflare R2\n 'spaces', // DigitalOcean Spaces\n 'wasabi', // Wasabi Hot Cloud Storage\n 'backblaze', // Backblaze B2\n 'local', // Local filesystem (development only)\n]).describe('Storage provider type');\n\nexport type StorageProvider = z.infer<typeof StorageProviderSchema>;\n\n/**\n * Storage Access Control List (ACL)\n * \n * Predefined access control configurations for objects and buckets.\n */\nexport const StorageAclSchema = z.enum([\n 'private', // Owner has full control, no one else has access\n 'public_read', // Owner has full control, everyone can read\n 'public_read_write', // Owner has full control, everyone can read/write (not recommended)\n 'authenticated_read', // Owner has full control, authenticated users can read\n 'bucket_owner_read', // Object owner has full control, bucket owner can read\n 'bucket_owner_full_control', // Both object and bucket owner have full control\n]).describe('Storage access control level');\n\nexport type StorageAcl = z.infer<typeof StorageAclSchema>;\n\n/**\n * Storage Class / Tier\n * \n * Different storage tiers for cost optimization.\n * Maps to provider-specific storage classes.\n */\nexport const StorageClassSchema = z.enum([\n 'standard', // Standard/hot storage for frequently accessed data\n 'intelligent', // Intelligent tiering (auto-moves between hot/cool)\n 'infrequent_access', // Infrequent access/cool storage\n 'glacier', // Archive/cold storage (slower retrieval)\n 'deep_archive', // Deep archive (cheapest, slowest retrieval)\n]).describe('Storage class/tier for cost optimization');\n\nexport type StorageClass = z.infer<typeof StorageClassSchema>;\n\n/**\n * Lifecycle Transition Action\n */\nexport const LifecycleActionSchema = z.enum([\n 'transition', // Move to different storage class\n 'delete', // Delete the object\n 'abort', // Abort incomplete multipart uploads\n]).describe('Lifecycle policy action type');\n\nexport type LifecycleAction = z.infer<typeof LifecycleActionSchema>;\n\n// ============================================================================\n// Configuration Schemas\n// ============================================================================\n\n/**\n * Object Metadata Schema\n * \n * Standard and custom metadata attached to stored objects.\n * \n * @example\n * {\n * contentType: 'image/jpeg',\n * contentLength: 1024000,\n * etag: '\"abc123\"',\n * lastModified: new Date('2024-01-01'),\n * custom: {\n * uploadedBy: 'user123',\n * department: 'marketing'\n * }\n * }\n */\nexport const ObjectMetadataSchema = z.object({\n contentType: z.string().describe('MIME type (e.g., image/jpeg, application/pdf)'),\n contentLength: z.number().min(0).describe('File size in bytes'),\n contentEncoding: z.string().optional().describe('Content encoding (e.g., gzip)'),\n contentDisposition: z.string().optional().describe('Content disposition header'),\n contentLanguage: z.string().optional().describe('Content language'),\n cacheControl: z.string().optional().describe('Cache control directives'),\n etag: z.string().optional().describe('Entity tag for versioning/caching'),\n lastModified: z.string().datetime().optional().describe('Last modification timestamp'),\n versionId: z.string().optional().describe('Object version identifier'),\n storageClass: StorageClassSchema.optional().describe('Storage class/tier'),\n encryption: z.object({\n algorithm: z.string().describe('Encryption algorithm (e.g., AES256, aws:kms)'),\n keyId: z.string().optional().describe('KMS key ID if using managed encryption'),\n }).optional().describe('Server-side encryption configuration'),\n custom: z.record(z.string(), z.string()).optional().describe('Custom user-defined metadata'),\n});\n\nexport type ObjectMetadata = z.infer<typeof ObjectMetadataSchema>;\n\n/**\n * Presigned URL Configuration\n * \n * Configuration for generating temporary URLs for direct access to objects.\n * Useful for secure file uploads/downloads without exposing credentials.\n * \n * @example\n * // Generate download URL valid for 1 hour\n * {\n * operation: 'get',\n * expiresIn: 3600,\n * contentType: 'image/jpeg'\n * }\n * \n * @example\n * // Generate upload URL valid for 15 minutes with size limit\n * {\n * operation: 'put',\n * expiresIn: 900,\n * contentType: 'application/pdf',\n * maxSize: 10485760\n * }\n */\nexport const PresignedUrlConfigSchema = z.object({\n operation: z.enum(['get', 'put', 'delete', 'head']).describe('Allowed operation'),\n expiresIn: z.number().min(1).max(604800).describe('Expiration time in seconds (max 7 days)'),\n contentType: z.string().optional().describe('Required content type for PUT operations'),\n maxSize: z.number().min(0).optional().describe('Maximum file size in bytes for PUT operations'),\n responseContentType: z.string().optional().describe('Override content-type for GET operations'),\n responseContentDisposition: z.string().optional().describe('Override content-disposition for GET operations'),\n});\n\nexport type PresignedUrlConfig = z.infer<typeof PresignedUrlConfigSchema>;\n\n/**\n * Multipart Upload Configuration\n * \n * Configuration for chunked uploads of large files.\n * Enables resumable uploads and parallel transfer.\n * \n * @example\n * // Enable multipart for files > 100MB with 10MB chunks\n * {\n * enabled: true,\n * partSize: 10485760,\n * maxParts: 10000,\n * threshold: 104857600,\n * maxConcurrent: 4\n * }\n */\nexport const MultipartUploadConfigSchema = z.object({\n enabled: z.boolean().default(true).describe('Enable multipart uploads'),\n partSize: z.number().min(5 * 1024 * 1024).max(5 * 1024 * 1024 * 1024).default(10 * 1024 * 1024).describe('Part size in bytes (min 5MB, max 5GB)'),\n maxParts: z.number().min(1).max(10000).default(10000).describe('Maximum number of parts (max 10,000)'),\n threshold: z.number().min(0).default(100 * 1024 * 1024).describe('File size threshold to trigger multipart upload (bytes)'),\n maxConcurrent: z.number().min(1).max(100).default(4).describe('Maximum concurrent part uploads'),\n abortIncompleteAfterDays: z.number().min(1).optional().describe('Auto-abort incomplete uploads after N days'),\n});\n\nexport type MultipartUploadConfig = z.infer<typeof MultipartUploadConfigSchema>;\n\n/**\n * Access Control Configuration\n * \n * Fine-grained access control for buckets and objects.\n * \n * @example\n * {\n * acl: 'private',\n * allowedOrigins: ['https://app.example.com'],\n * allowedMethods: ['GET', 'PUT'],\n * corsEnabled: true,\n * publicAccess: {\n * allowPublicRead: false,\n * allowPublicWrite: false\n * }\n * }\n */\nexport const AccessControlConfigSchema = z.object({\n acl: StorageAclSchema.default('private').describe('Default access control level'),\n allowedOrigins: z.array(z.string()).optional().describe('CORS allowed origins'),\n allowedMethods: z.array(z.enum(['GET', 'PUT', 'POST', 'DELETE', 'HEAD'])).optional().describe('CORS allowed HTTP methods'),\n allowedHeaders: z.array(z.string()).optional().describe('CORS allowed headers'),\n exposeHeaders: z.array(z.string()).optional().describe('CORS exposed headers'),\n maxAge: z.number().min(0).optional().describe('CORS preflight cache duration in seconds'),\n corsEnabled: z.boolean().default(false).describe('Enable CORS configuration'),\n publicAccess: z.object({\n allowPublicRead: z.boolean().default(false).describe('Allow public read access'),\n allowPublicWrite: z.boolean().default(false).describe('Allow public write access'),\n allowPublicList: z.boolean().default(false).describe('Allow public bucket listing'),\n }).optional().describe('Public access control'),\n allowedIps: z.array(z.string()).optional().describe('Allowed IP addresses/CIDR blocks'),\n blockedIps: z.array(z.string()).optional().describe('Blocked IP addresses/CIDR blocks'),\n});\n\nexport type AccessControlConfig = z.infer<typeof AccessControlConfigSchema>;\n\n/**\n * Lifecycle Policy Rule\n * \n * Individual rule for automatic object lifecycle management.\n * \n * @example\n * // Transition to infrequent access after 30 days\n * {\n * id: 'move_to_ia',\n * enabled: true,\n * action: 'transition',\n * daysAfterCreation: 30,\n * targetStorageClass: 'infrequent_access'\n * }\n * \n * @example\n * // Delete objects after 365 days\n * {\n * id: 'delete_old',\n * enabled: true,\n * action: 'delete',\n * daysAfterCreation: 365\n * }\n */\nexport const LifecyclePolicyRuleSchema = z.object({\n id: SystemIdentifierSchema.describe('Rule identifier'),\n enabled: z.boolean().default(true).describe('Enable this rule'),\n action: LifecycleActionSchema.describe('Action to perform'),\n prefix: z.string().optional().describe('Object key prefix filter (e.g., \"uploads/\")'),\n tags: z.record(z.string(), z.string()).optional().describe('Object tag filters'),\n daysAfterCreation: z.number().min(0).optional().describe('Days after object creation'),\n daysAfterModification: z.number().min(0).optional().describe('Days after last modification'),\n targetStorageClass: StorageClassSchema.optional().describe('Target storage class for transition action'),\n}).refine((data) => {\n // Validate that transition action has targetStorageClass\n if (data.action === 'transition' && !data.targetStorageClass) {\n return false;\n }\n return true;\n}, {\n message: 'targetStorageClass is required when action is \"transition\"',\n});\n\nexport type LifecyclePolicyRule = z.infer<typeof LifecyclePolicyRuleSchema>;\n\n/**\n * Lifecycle Policy Configuration\n * \n * Collection of lifecycle rules for automatic data management.\n * \n * @example\n * {\n * enabled: true,\n * rules: [\n * {\n * id: 'archive_old_files',\n * enabled: true,\n * action: 'transition',\n * daysAfterCreation: 90,\n * targetStorageClass: 'glacier'\n * },\n * {\n * id: 'delete_temp_files',\n * enabled: true,\n * action: 'delete',\n * prefix: 'temp/',\n * daysAfterCreation: 7\n * }\n * ]\n * }\n */\nexport const LifecyclePolicyConfigSchema = z.object({\n enabled: z.boolean().default(false).describe('Enable lifecycle policies'),\n rules: z.array(LifecyclePolicyRuleSchema).default([]).describe('Lifecycle rules'),\n});\n\nexport type LifecyclePolicyConfig = z.infer<typeof LifecyclePolicyConfigSchema>;\n\n/**\n * Bucket Configuration Schema\n * \n * Comprehensive configuration for a storage bucket/container.\n * \n * @example\n * {\n * name: 'user_uploads',\n * label: 'User Uploads',\n * bucketName: 'my-app-uploads',\n * region: 'us-east-1',\n * provider: 's3',\n * versioning: true,\n * accessControl: {\n * acl: 'private',\n * corsEnabled: true,\n * allowedOrigins: ['https://app.example.com']\n * },\n * multipartConfig: {\n * enabled: true,\n * threshold: 104857600\n * }\n * }\n */\nexport const BucketConfigSchema = z.object({\n name: SystemIdentifierSchema.describe('Bucket identifier in ObjectStack (snake_case)'),\n label: z.string().describe('Display label'),\n bucketName: z.string().describe('Actual bucket/container name in storage provider'),\n region: z.string().optional().describe('Storage region (e.g., us-east-1, westus)'),\n provider: StorageProviderSchema.describe('Storage provider'),\n endpoint: z.string().optional().describe('Custom endpoint URL (for S3-compatible providers)'),\n pathStyle: z.boolean().default(false).describe('Use path-style URLs (for S3-compatible providers)'),\n \n versioning: z.boolean().default(false).describe('Enable object versioning'),\n encryption: z.object({\n enabled: z.boolean().default(false).describe('Enable server-side encryption'),\n algorithm: z.enum(['AES256', 'aws:kms', 'azure:kms', 'gcp:kms']).default('AES256').describe('Encryption algorithm'),\n kmsKeyId: z.string().optional().describe('KMS key ID for managed encryption'),\n }).optional().describe('Server-side encryption configuration'),\n \n accessControl: AccessControlConfigSchema.optional().describe('Access control configuration'),\n lifecyclePolicy: LifecyclePolicyConfigSchema.optional().describe('Lifecycle policy configuration'),\n multipartConfig: MultipartUploadConfigSchema.optional().describe('Multipart upload configuration'),\n \n tags: z.record(z.string(), z.string()).optional().describe('Bucket tags for organization'),\n description: z.string().optional().describe('Bucket description'),\n enabled: z.boolean().default(true).describe('Enable this bucket'),\n});\n\nexport type BucketConfig = z.infer<typeof BucketConfigSchema>;\n\n/**\n * Storage Connection Configuration\n * \n * Provider-specific connection credentials and settings.\n * \n * @example S3\n * {\n * accessKeyId: '${AWS_ACCESS_KEY_ID}',\n * secretAccessKey: '${AWS_SECRET_ACCESS_KEY}',\n * sessionToken: '${AWS_SESSION_TOKEN}',\n * region: 'us-east-1'\n * }\n * \n * @example Azure\n * {\n * accountName: 'mystorageaccount',\n * accountKey: '${AZURE_STORAGE_KEY}',\n * endpoint: 'https://mystorageaccount.blob.core.windows.net'\n * }\n */\nexport const StorageConnectionSchema = z.object({\n // AWS S3 / MinIO\n accessKeyId: z.string().optional().describe('AWS access key ID or MinIO access key'),\n secretAccessKey: z.string().optional().describe('AWS secret access key or MinIO secret key'),\n sessionToken: z.string().optional().describe('AWS session token for temporary credentials'),\n \n // Azure Blob Storage\n accountName: z.string().optional().describe('Azure storage account name'),\n accountKey: z.string().optional().describe('Azure storage account key'),\n sasToken: z.string().optional().describe('Azure SAS token'),\n \n // Google Cloud Storage\n projectId: z.string().optional().describe('GCP project ID'),\n credentials: z.string().optional().describe('GCP service account credentials JSON'),\n \n // Common\n endpoint: z.string().optional().describe('Custom endpoint URL'),\n region: z.string().optional().describe('Default region'),\n useSSL: z.boolean().default(true).describe('Use SSL/TLS for connections'),\n timeout: z.number().min(0).optional().describe('Connection timeout in milliseconds'),\n});\n\nexport type StorageConnection = z.infer<typeof StorageConnectionSchema>;\n\n/**\n * Object Storage Configuration\n * \n * Complete object storage system configuration.\n * \n * @example\n * {\n * name: 'production_storage',\n * label: 'Production File Storage',\n * provider: 's3',\n * scope: 'global',\n * connection: {\n * accessKeyId: '${AWS_ACCESS_KEY_ID}',\n * secretAccessKey: '${AWS_SECRET_ACCESS_KEY}',\n * region: 'us-east-1'\n * },\n * buckets: [\n * {\n * name: 'user_uploads',\n * label: 'User Uploads',\n * bucketName: 'prod-uploads',\n * provider: 's3',\n * region: 'us-east-1'\n * }\n * ],\n * defaultBucket: 'user_uploads'\n * }\n */\nexport const ObjectStorageConfigSchema = z.object({\n name: SystemIdentifierSchema.describe('Storage configuration identifier'),\n label: z.string().describe('Display label'),\n provider: StorageProviderSchema.describe('Primary storage provider'),\n \n /**\n * Storage scope\n * Defines the lifecycle and access pattern for this storage\n */\n scope: StorageScopeSchema.optional().default('global').describe('Storage scope'),\n \n connection: StorageConnectionSchema.describe('Connection credentials'),\n buckets: z.array(BucketConfigSchema).default([]).describe('Configured buckets'),\n defaultBucket: z.string().optional().describe('Default bucket name for operations'),\n \n /**\n * Base path or location\n * For local/scoped storage configurations\n */\n location: z.string().optional().describe('Root path (local) or base location'),\n \n /**\n * Storage quota in bytes\n */\n quota: z.number().int().positive().optional().describe('Max size in bytes'),\n \n /**\n * Provider-specific options\n */\n options: z.record(z.string(), z.unknown()).optional().describe('Provider-specific configuration options'),\n \n enabled: z.boolean().default(true).describe('Enable this storage configuration'),\n description: z.string().optional().describe('Configuration description'),\n});\n\nexport type ObjectStorageConfig = z.infer<typeof ObjectStorageConfigSchema>;\n\n// ============================================================================\n// Helper Examples\n// ============================================================================\n\n/**\n * Example: AWS S3 Configuration\n */\nexport const s3StorageExample = ObjectStorageConfigSchema.parse({\n name: 'aws_s3_storage',\n label: 'AWS S3 Production Storage',\n provider: 's3',\n connection: {\n accessKeyId: '${AWS_ACCESS_KEY_ID}',\n secretAccessKey: '${AWS_SECRET_ACCESS_KEY}',\n region: 'us-east-1',\n },\n buckets: [\n {\n name: 'user_uploads',\n label: 'User Uploads',\n bucketName: 'my-app-user-uploads',\n region: 'us-east-1',\n provider: 's3',\n versioning: true,\n encryption: {\n enabled: true,\n algorithm: 'aws:kms',\n kmsKeyId: '${AWS_KMS_KEY_ID}',\n },\n accessControl: {\n acl: 'private',\n corsEnabled: true,\n allowedOrigins: ['https://app.example.com'],\n allowedMethods: ['GET', 'PUT', 'POST'],\n },\n lifecyclePolicy: {\n enabled: true,\n rules: [\n {\n id: 'archive_old_uploads',\n enabled: true,\n action: 'transition',\n daysAfterCreation: 90,\n targetStorageClass: 'glacier',\n },\n ],\n },\n multipartConfig: {\n enabled: true,\n partSize: 10 * 1024 * 1024,\n threshold: 100 * 1024 * 1024,\n maxConcurrent: 4,\n },\n },\n ],\n defaultBucket: 'user_uploads',\n enabled: true,\n});\n\n/**\n * Example: MinIO Configuration\n */\nexport const minioStorageExample = ObjectStorageConfigSchema.parse({\n name: 'minio_local',\n label: 'MinIO Local Storage',\n provider: 'minio',\n connection: {\n accessKeyId: 'minioadmin',\n secretAccessKey: 'minioadmin',\n endpoint: 'http://localhost:9000',\n useSSL: false,\n },\n buckets: [\n {\n name: 'development_files',\n label: 'Development Files',\n bucketName: 'dev-files',\n provider: 'minio',\n endpoint: 'http://localhost:9000',\n pathStyle: true,\n accessControl: {\n acl: 'private',\n },\n },\n ],\n defaultBucket: 'development_files',\n enabled: true,\n});\n\n/**\n * Example: Azure Blob Storage Configuration\n */\nexport const azureBlobStorageExample = ObjectStorageConfigSchema.parse({\n name: 'azure_blob_storage',\n label: 'Azure Blob Storage',\n provider: 'azure_blob',\n connection: {\n accountName: 'mystorageaccount',\n accountKey: '${AZURE_STORAGE_KEY}',\n endpoint: 'https://mystorageaccount.blob.core.windows.net',\n },\n buckets: [\n {\n name: 'media_files',\n label: 'Media Files',\n bucketName: 'media',\n provider: 'azure_blob',\n region: 'eastus',\n accessControl: {\n acl: 'public_read',\n publicAccess: {\n allowPublicRead: true,\n allowPublicWrite: false,\n allowPublicList: false,\n },\n },\n },\n ],\n defaultBucket: 'media_files',\n enabled: true,\n});\n\n/**\n * Example: Google Cloud Storage Configuration\n */\nexport const gcsStorageExample = ObjectStorageConfigSchema.parse({\n name: 'gcs_storage',\n label: 'Google Cloud Storage',\n provider: 'gcs',\n connection: {\n projectId: 'my-gcp-project',\n credentials: '${GCP_SERVICE_ACCOUNT_JSON}',\n },\n buckets: [\n {\n name: 'backup_storage',\n label: 'Backup Storage',\n bucketName: 'my-app-backups',\n region: 'us-central1',\n provider: 'gcs',\n lifecyclePolicy: {\n enabled: true,\n rules: [\n {\n id: 'delete_old_backups',\n enabled: true,\n action: 'delete',\n daysAfterCreation: 30,\n },\n ],\n },\n },\n ],\n defaultBucket: 'backup_storage',\n enabled: true,\n});\n","// Copyright (c) 2025 ObjectStack. Licensed under the Apache-2.0 license.\n\nimport { z } from 'zod';\nimport { BaseResponseSchema } from './contract.zod';\nimport { ObjectSchema } from '../data/object.zod';\nimport { AppSchema } from '../ui/app.zod';\n\n/**\n * Metadata Service Protocol\n * \n * Defines the standard API contracts for fetching system metadata.\n * Frontend, IDEs, and Mobile apps use this to build dynamic UIs.\n */\n\n// ==========================================\n// Responses\n// ==========================================\n\n/**\n * Single Object Definition Response\n * Returns the full JSON schema for an Entity (Fields, Actions, Config).\n */\nexport const ObjectDefinitionResponseSchema = BaseResponseSchema.extend({\n data: ObjectSchema.describe('Full Object Schema'),\n});\n\n/**\n * App Definition Response\n * Returns the navigation, branding, and layout for an App.\n */\nexport const AppDefinitionResponseSchema = BaseResponseSchema.extend({\n data: AppSchema.describe('Full App Configuration'),\n});\n\n/**\n * All Concepts Response\n * Bulk load lightweight definitions for autocomplete/pickers.\n */\nexport const ConceptListResponseSchema = BaseResponseSchema.extend({\n data: z.array(z.object({\n name: z.string(),\n label: z.string(),\n icon: z.string().optional(),\n description: z.string().optional(),\n })).describe('List of available concepts (Objects, Apps, Flows)'),\n});\n\nexport type ObjectDefinitionResponse = z.infer<typeof ObjectDefinitionResponseSchema>;\nexport type AppDefinitionResponse = z.infer<typeof AppDefinitionResponseSchema>;\nexport type ConceptListResponse = z.infer<typeof ConceptListResponseSchema>;\n","// Copyright (c) 2025 ObjectStack. Licensed under the Apache-2.0 license.\n\nimport { z } from 'zod';\nimport { FieldSchema } from './field.zod';\nimport { ValidationRuleSchema } from './validation.zod';\nimport { StateMachineSchema } from '../automation/state-machine.zod';\n\n/**\n * API Operations Enum\n */\nexport const ApiMethod = z.enum([\n 'get', 'list', // Read\n 'create', 'update', 'delete', // Write\n 'upsert', // Idempotent Write\n 'bulk', // Batch operations\n 'aggregate', // Analytics (count, sum)\n 'history', // Audit access\n 'search', // Search access\n 'restore', 'purge', // Trash management\n 'import', 'export', // Data portability\n]);\nexport type ApiMethod = z.infer<typeof ApiMethod>;\n\n/**\n * Capability Flags\n * Defines what system features are enabled for this object.\n * \n * Optimized based on industry standards (Salesforce, ServiceNow):\n * - Added `activities` (Tasks/Events)\n * - Added `mru` (Recent Items)\n * - Added `feeds` (Social/Chatter)\n * - Grouped API permissions\n * \n * @example\n * {\n * trackHistory: true,\n * searchable: true,\n * apiEnabled: true,\n * files: true\n * }\n */\nexport const ObjectCapabilities = z.object({\n /** Enable history tracking (Audit Trail) */\n trackHistory: z.boolean().default(false).describe('Enable field history tracking for audit compliance'),\n \n /** Enable global search indexing */\n searchable: z.boolean().default(true).describe('Index records for global search'),\n \n /** Enable REST/GraphQL API access */\n apiEnabled: z.boolean().default(true).describe('Expose object via automatic APIs'),\n\n /** \n * API Supported Operations\n * Granular control over API exposure.\n */\n apiMethods: z.array(ApiMethod).optional().describe('Whitelist of allowed API operations'),\n \n /** Enable standard attachments/files engine */\n files: z.boolean().default(false).describe('Enable file attachments and document management'),\n \n /** Enable social collaboration (Comments, Mentions, Feeds) */\n feeds: z.boolean().default(false).describe('Enable social feed, comments, and mentions (Chatter-like)'),\n \n /** Enable standard Activity suite (Tasks, Calendars, Events) */\n activities: z.boolean().default(false).describe('Enable standard tasks and events tracking'),\n \n /** Enable Recycle Bin / Soft Delete */\n trash: z.boolean().default(true).describe('Enable soft-delete with restore capability'),\n\n /** Enable \"Recently Viewed\" tracking */\n mru: z.boolean().default(true).describe('Track Most Recently Used (MRU) list for users'),\n \n /** Allow cloning records */\n clone: z.boolean().default(true).describe('Allow record deep cloning'),\n});\n\n/**\n * Schema for database indexes.\n * Enhanced with additional index types and configuration options\n * \n * @example\n * {\n * name: \"idx_account_name\",\n * fields: [\"name\"],\n * type: \"btree\",\n * unique: true\n * }\n */\nexport const IndexSchema = z.object({\n name: z.string().optional().describe('Index name (auto-generated if not provided)'),\n fields: z.array(z.string()).describe('Fields included in the index'),\n type: z.enum(['btree', 'hash', 'gin', 'gist', 'fulltext']).optional().default('btree').describe('Index algorithm type'),\n unique: z.boolean().optional().default(false).describe('Whether the index enforces uniqueness'),\n partial: z.string().optional().describe('Partial index condition (SQL WHERE clause for conditional indexes)'),\n});\n\n/**\n * Search Configuration\n * Defines how this object behaves in search results.\n * \n * @example\n * {\n * fields: [\"name\", \"email\", \"phone\"],\n * displayFields: [\"name\", \"title\"],\n * filters: [\"status = 'active'\"]\n * }\n */\nexport const SearchConfigSchema = z.object({\n fields: z.array(z.string()).describe('Fields to index for full-text search weighting'),\n displayFields: z.array(z.string()).optional().describe('Fields to display in search result cards'),\n filters: z.array(z.string()).optional().describe('Default filters for search results'),\n});\n\n/**\n * Multi-Tenancy Configuration Schema\n * Configures tenant isolation strategy for SaaS applications\n * \n * @example Shared database with tenant_id isolation\n * {\n * enabled: true,\n * strategy: 'shared',\n * tenantField: 'tenant_id',\n * crossTenantAccess: false\n * }\n */\nexport const TenancyConfigSchema = z.object({\n enabled: z.boolean().describe('Enable multi-tenancy for this object'),\n strategy: z.enum(['shared', 'isolated', 'hybrid']).describe('Tenant isolation strategy: shared (single DB, row-level), isolated (separate DB per tenant), hybrid (mix)'),\n tenantField: z.string().default('tenant_id').describe('Field name for tenant identifier'),\n crossTenantAccess: z.boolean().default(false).describe('Allow cross-tenant data access (with explicit permission)'),\n});\n\n/**\n * Soft Delete Configuration Schema\n * Implements recycle bin / trash functionality\n * \n * @example Standard soft delete with cascade\n * {\n * enabled: true,\n * field: 'deleted_at',\n * cascadeDelete: true\n * }\n */\nexport const SoftDeleteConfigSchema = z.object({\n enabled: z.boolean().describe('Enable soft delete (trash/recycle bin)'),\n field: z.string().default('deleted_at').describe('Field name for soft delete timestamp'),\n cascadeDelete: z.boolean().default(false).describe('Cascade soft delete to related records'),\n});\n\n/**\n * Versioning Configuration Schema\n * Implements record versioning and history tracking\n * \n * @example Snapshot versioning with 90-day retention\n * {\n * enabled: true,\n * strategy: 'snapshot',\n * retentionDays: 90,\n * versionField: 'version'\n * }\n */\nexport const VersioningConfigSchema = z.object({\n enabled: z.boolean().describe('Enable record versioning'),\n strategy: z.enum(['snapshot', 'delta', 'event-sourcing']).describe('Versioning strategy: snapshot (full copy), delta (changes only), event-sourcing (event log)'),\n retentionDays: z.number().min(1).optional().describe('Number of days to retain old versions (undefined = infinite)'),\n versionField: z.string().default('version').describe('Field name for version number/timestamp'),\n});\n\n/**\n * Partitioning Strategy Schema\n * Configures table partitioning for performance at scale\n * \n * @example Range partitioning by date (monthly)\n * {\n * enabled: true,\n * strategy: 'range',\n * key: 'created_at',\n * interval: '1 month'\n * }\n */\nexport const PartitioningConfigSchema = z.object({\n enabled: z.boolean().describe('Enable table partitioning'),\n strategy: z.enum(['range', 'hash', 'list']).describe('Partitioning strategy: range (date ranges), hash (consistent hashing), list (predefined values)'),\n key: z.string().describe('Field name to partition by'),\n interval: z.string().optional().describe('Partition interval for range strategy (e.g., \"1 month\", \"1 year\")'),\n}).refine((data) => {\n // If strategy is 'range', interval must be provided\n if (data.strategy === 'range' && !data.interval) {\n return false;\n }\n return true;\n}, {\n message: 'interval is required when strategy is \"range\"',\n});\n\n/**\n * Change Data Capture (CDC) Configuration Schema\n * Enables real-time data streaming to external systems\n * \n * @example Stream all changes to Kafka\n * {\n * enabled: true,\n * events: ['insert', 'update', 'delete'],\n * destination: 'kafka://events.objectstack'\n * }\n */\nexport const CDCConfigSchema = z.object({\n enabled: z.boolean().describe('Enable Change Data Capture'),\n events: z.array(z.enum(['insert', 'update', 'delete'])).describe('Event types to capture'),\n destination: z.string().describe('Destination endpoint (e.g., \"kafka://topic\", \"webhook://url\")'),\n});\n\n/**\n * Base Object Schema Definition\n * \n * The Blueprint of a Business Object.\n * Represents a table, a collection, or a virtual entity.\n * \n * @example\n * ```yaml\n * name: project_task\n * label: Project Task\n * icon: task\n * fields:\n * project:\n * type: lookup\n * reference: project\n * status:\n * type: select\n * options: [todo, in_progress, done]\n * enable:\n * trackHistory: true\n * files: true\n * ```\n */\nconst ObjectSchemaBase = z.object({\n /** \n * Identity & Metadata \n */\n name: z.string().regex(/^[a-z_][a-z0-9_]*$/).describe('Machine unique key (snake_case). Immutable.'),\n label: z.string().optional().describe('Human readable singular label (e.g. \"Account\")'),\n pluralLabel: z.string().optional().describe('Human readable plural label (e.g. \"Accounts\")'),\n description: z.string().optional().describe('Developer documentation / description'),\n icon: z.string().optional().describe('Icon name (Lucide/Material) for UI representation'),\n \n /**\n * Taxonomy & Organization\n */\n tags: z.array(z.string()).optional().describe('Categorization tags (e.g. \"sales\", \"system\", \"reference\")'),\n active: z.boolean().optional().default(true).describe('Is the object active and usable'),\n isSystem: z.boolean().optional().default(false).describe('Is system object (protected from deletion)'),\n abstract: z.boolean().optional().default(false).describe('Is abstract base object (cannot be instantiated)'),\n\n /** \n * Storage & Virtualization \n */\n datasource: z.string().optional().default('default').describe('Target Datasource ID. \"default\" is the primary DB.'),\n tableName: z.string().optional().describe('Physical table/collection name in the target datasource'),\n \n /** \n * Data Model \n */\n fields: z.record(z.string().regex(/^[a-z_][a-z0-9_]*$/, {\n message: 'Field names must be lowercase snake_case (e.g., \"first_name\", \"company\", \"annual_revenue\")',\n }), FieldSchema).describe('Field definitions map. Keys must be snake_case identifiers.'),\n indexes: z.array(IndexSchema).optional().describe('Database performance indexes'),\n \n /**\n * Advanced Data Management\n */\n \n // Multi-tenancy configuration\n tenancy: TenancyConfigSchema.optional().describe('Multi-tenancy configuration for SaaS applications'),\n \n // Soft delete configuration\n softDelete: SoftDeleteConfigSchema.optional().describe('Soft delete (trash/recycle bin) configuration'),\n \n // Versioning configuration\n versioning: VersioningConfigSchema.optional().describe('Record versioning and history tracking configuration'),\n \n // Partitioning strategy\n partitioning: PartitioningConfigSchema.optional().describe('Table partitioning configuration for performance'),\n \n // Change Data Capture\n cdc: CDCConfigSchema.optional().describe('Change Data Capture (CDC) configuration for real-time data streaming'),\n \n /**\n * Logic & Validation (Co-located)\n * Best Practice: Define rules close to data.\n */\n validations: z.array(ValidationRuleSchema).optional().describe('Object-level validation rules'),\n \n /**\n * State Machine(s)\n * Named record of state machines, where each key is a unique machine identifier.\n * Multiple machines allow parallel lifecycles (e.g., status + payment_status + approval_status).\n * \n * @example stateMachines: { lifecycle: {...}, payment: {...}, approval: {...} }\n */\n stateMachines: z.record(z.string(), StateMachineSchema).optional().describe('Named state machines for parallel lifecycles (e.g., status, payment, approval)'),\n\n /** \n * Display & UI Hints (Data-Layer)\n */\n titleFormat: z.string().optional().describe('Title expression (e.g. \"{name} - {code}\"). Overrides nameField.'),\n compactLayout: z.array(z.string()).optional().describe('Primary fields for hover/cards/lookups'),\n \n /** \n * Search Engine Config \n */\n search: SearchConfigSchema.optional().describe('Search engine configuration'),\n \n /** \n * System Capabilities \n */\n enable: ObjectCapabilities.optional().describe('Enabled system features modules'),\n\n /** Record Types */\n recordTypes: z.array(z.string()).optional().describe('Record type names for this object'),\n\n /** Sharing Model */\n sharingModel: z.enum(['private', 'read', 'read_write', 'full']).optional().describe('Default sharing model'),\n\n /** Key Prefix */\n keyPrefix: z.string().max(5).optional().describe('Short prefix for record IDs (e.g., \"001\" for Account)'),\n});\n\n/**\n * Enhanced ObjectSchema with Factory\n */\nexport const ObjectSchema = Object.assign(ObjectSchemaBase, {\n create: <T extends z.input<typeof ObjectSchemaBase>>(config: T) => config,\n});\n\nexport type ServiceObject = z.infer<typeof ObjectSchemaBase>;\nexport type ServiceObjectInput = z.input<typeof ObjectSchemaBase>;\nexport type ObjectCapabilities = z.infer<typeof ObjectCapabilities>;\nexport type ObjectIndex = z.infer<typeof IndexSchema>;\nexport type TenancyConfig = z.infer<typeof TenancyConfigSchema>;\nexport type SoftDeleteConfig = z.infer<typeof SoftDeleteConfigSchema>;\nexport type VersioningConfig = z.infer<typeof VersioningConfigSchema>;\nexport type PartitioningConfig = z.infer<typeof PartitioningConfigSchema>;\nexport type CDCConfig = z.infer<typeof CDCConfigSchema>;\n\n// =================================================================\n// Object Ownership Model\n// =================================================================\n\n/**\n * How a package relates to an object it references.\n * \n * - `own`: This package is the original author/owner of the object.\n * Only one package may own a given object name. The owner defines\n * the base schema (table name, primary key, core fields).\n * \n * - `extend`: This package adds fields, views, or actions to an\n * existing object owned by another package. Multiple packages\n * may extend the same object. Extensions are merged at boot time.\n * \n * Follows Salesforce/ServiceNow patterns:\n * object name = database table name, globally unique, no namespace prefix.\n */\nexport const ObjectOwnershipEnum = z.enum(['own', 'extend']);\nexport type ObjectOwnership = z.infer<typeof ObjectOwnershipEnum>;\n\n/**\n * Object Extension Entry — used in `objectExtensions` array.\n * Declares fields/config to merge into an existing object owned by another package.\n * \n * @example\n * ```ts\n * objectExtensions: [{\n * extend: 'contact', // target object FQN\n * fields: { sales_stage: Field.select([...]) },\n * }]\n * ```\n */\nexport const ObjectExtensionSchema = z.object({\n /** The target object name (FQN) to extend */\n extend: z.string().describe('Target object name (FQN) to extend'),\n \n /** Fields to merge into the target object (additive) */\n fields: z.record(z.string(), FieldSchema).optional().describe('Fields to add/override'),\n \n /** Override label */\n label: z.string().optional(),\n \n /** Override plural label */\n pluralLabel: z.string().optional(),\n \n /** Override description */\n description: z.string().optional(),\n \n /** Additional validation rules to add */\n validations: z.array(ValidationRuleSchema).optional(),\n \n /** Additional indexes to add */\n indexes: z.array(IndexSchema).optional(),\n \n /** Merge priority. Higher number applied later (wins on conflict). Default: 200 */\n priority: z.number().int().min(0).max(999).default(200).describe('Merge priority (higher = applied later)'),\n});\n\nexport type ObjectExtension = z.infer<typeof ObjectExtensionSchema>;\n","// Copyright (c) 2025 ObjectStack. Licensed under the Apache-2.0 license.\n\nimport { z } from 'zod';\nimport { SystemIdentifierSchema } from '../shared/identifiers.zod';\nimport { EncryptionConfigSchema } from '../system/encryption.zod';\nimport { MaskingRuleSchema } from '../system/masking.zod';\n\n/**\n * Field Type Enum\n */\nexport const FieldType = z.enum([\n // Core Text\n 'text', 'textarea', 'email', 'url', 'phone', 'password',\n // Rich Content\n 'markdown', 'html', 'richtext',\n // Numbers\n 'number', 'currency', 'percent', \n // Date & Time\n 'date', 'datetime', 'time',\n // Logic\n 'boolean', 'toggle', // Toggle is a distinct UI from checkbox\n // Selection\n 'select', // Single select dropdown\n 'multiselect', // Multi select (often tags)\n 'radio', // Radio group\n 'checkboxes', // Checkbox group\n // Relational\n 'lookup', 'master_detail', // Dynamic reference\n 'tree', // Hierarchical reference\n // Media\n 'image', 'file', 'avatar', 'video', 'audio',\n // Calculated / System\n 'formula', 'summary', 'autonumber',\n // Enhanced Types\n 'location', // GPS coordinates\n 'address', // Structured address\n 'code', // Code editor (JSON/SQL/JS)\n 'json', // Structured JSON data\n 'color', // Color picker\n 'rating', // Star rating\n 'slider', // Numeric slider\n 'signature', // Digital signature\n 'qrcode', // QR code / Barcode\n 'progress', // Progress bar\n 'tags', // Simple tag list\n // AI/ML Types\n 'vector', // Vector embeddings for AI/ML (semantic search, RAG)\n]);\n\nexport type FieldType = z.infer<typeof FieldType>;\n\n/**\n * Select Option Schema\n * \n * Defines option values for select/picklist fields.\n * \n * **CRITICAL RULE**: The `value` field is a machine identifier that gets stored in the database.\n * It MUST be lowercase to avoid case-sensitivity issues in queries and comparisons.\n * \n * @example Good\n * { label: 'New', value: 'new' }\n * { label: 'In Progress', value: 'in_progress' }\n * { label: 'Closed Won', value: 'closed_won' }\n * \n * @example Bad (will be rejected)\n * { label: 'New', value: 'New' } // uppercase\n * { label: 'In Progress', value: 'In Progress' } // spaces and uppercase\n * { label: 'Closed Won', value: 'Closed_Won' } // mixed case\n */\nexport const SelectOptionSchema = z.object({\n label: z.string().describe('Display label (human-readable, any case allowed)'),\n value: SystemIdentifierSchema.describe('Stored value (lowercase machine identifier)'),\n color: z.string().optional().describe('Color code for badges/charts'),\n default: z.boolean().optional().describe('Is default option'),\n});\n\n/**\n * Location Coordinates Schema\n * GPS coordinates for location field type\n */\nexport const LocationCoordinatesSchema = z.object({\n latitude: z.number().min(-90).max(90).describe('Latitude coordinate'),\n longitude: z.number().min(-180).max(180).describe('Longitude coordinate'),\n altitude: z.number().optional().describe('Altitude in meters'),\n accuracy: z.number().optional().describe('Accuracy in meters'),\n});\n\n/**\n * Currency Configuration Schema\n * Configuration for currency field type supporting multi-currency\n * \n * Note: Currency codes are validated by length only (3 characters) to support:\n * - Standard ISO 4217 codes (USD, EUR, CNY, etc.)\n * - Cryptocurrency codes (BTC, ETH, etc.)\n * - Custom business-specific codes\n * Stricter validation can be implemented at the application layer based on business requirements.\n */\nexport const CurrencyConfigSchema = z.object({\n precision: z.number().int().min(0).max(10).default(2).describe('Decimal precision (default: 2)'),\n currencyMode: z.enum(['dynamic', 'fixed']).default('dynamic').describe('Currency mode: dynamic (user selectable) or fixed (single currency)'),\n defaultCurrency: z.string().length(3).default('CNY').describe('Default or fixed currency code (ISO 4217, e.g., USD, CNY, EUR)'),\n});\n\n/**\n * Currency Value Schema\n * Runtime value structure for currency fields\n * \n * Note: Currency codes are validated by length only (3 characters) to support flexibility.\n * See CurrencyConfigSchema for details on currency code validation strategy.\n */\nexport const CurrencyValueSchema = z.object({\n value: z.number().describe('Monetary amount'),\n currency: z.string().length(3).describe('Currency code (ISO 4217)'),\n});\n\n/**\n * Address Schema\n * Structured address for address field type\n */\nexport const AddressSchema = z.object({\n street: z.string().optional().describe('Street address'),\n city: z.string().optional().describe('City name'),\n state: z.string().optional().describe('State/Province'),\n postalCode: z.string().optional().describe('Postal/ZIP code'),\n country: z.string().optional().describe('Country name or code'),\n countryCode: z.string().optional().describe('ISO country code (e.g., US, GB)'),\n formatted: z.string().optional().describe('Formatted address string'),\n});\n\n/**\n * Vector Configuration Schema\n * Configuration for vector field type supporting AI/ML embeddings\n * \n * Vector fields store numerical embeddings for semantic search, similarity matching,\n * and Retrieval-Augmented Generation (RAG) workflows.\n * \n * @example\n * // Text embeddings for semantic search\n * {\n * dimensions: 1536, // OpenAI text-embedding-ada-002\n * distanceMetric: 'cosine',\n * indexed: true\n * }\n * \n * @example\n * // Image embeddings with normalization\n * {\n * dimensions: 512, // ResNet-50\n * distanceMetric: 'euclidean',\n * normalized: true,\n * indexed: true\n * }\n */\nexport const VectorConfigSchema = z.object({\n dimensions: z.number().int().min(1).max(10000).describe('Vector dimensionality (e.g., 1536 for OpenAI embeddings)'),\n distanceMetric: z.enum(['cosine', 'euclidean', 'dotProduct', 'manhattan']).default('cosine').describe('Distance/similarity metric for vector search'),\n normalized: z.boolean().default(false).describe('Whether vectors are normalized (unit length)'),\n indexed: z.boolean().default(true).describe('Whether to create a vector index for fast similarity search'),\n indexType: z.enum(['hnsw', 'ivfflat', 'flat']).optional().describe('Vector index algorithm (HNSW for high accuracy, IVFFlat for large datasets)'),\n});\n\n/**\n * File Attachment Configuration Schema\n * Configuration for file and attachment field types\n * \n * Provides comprehensive file upload capabilities with:\n * - File type restrictions (allowed/blocked)\n * - File size limits (min/max)\n * - Virus scanning integration\n * - Storage provider integration\n * - Image-specific features (dimensions, thumbnails)\n * \n * @example Basic file upload with size limit\n * {\n * maxSize: 10485760, // 10MB\n * allowedTypes: ['.pdf', '.docx', '.xlsx'],\n * virusScan: true\n * }\n * \n * @example Image upload with validation\n * {\n * maxSize: 5242880, // 5MB\n * allowedTypes: ['.jpg', '.jpeg', '.png', '.webp'],\n * imageValidation: {\n * maxWidth: 4096,\n * maxHeight: 4096,\n * generateThumbnails: true\n * }\n * }\n */\nexport const FileAttachmentConfigSchema = z.object({\n /** File Size Limits */\n minSize: z.number().min(0).optional().describe('Minimum file size in bytes'),\n maxSize: z.number().min(1).optional().describe('Maximum file size in bytes (e.g., 10485760 = 10MB)'),\n \n /** File Type Restrictions */\n allowedTypes: z.array(z.string()).optional().describe('Allowed file extensions (e.g., [\".pdf\", \".docx\", \".jpg\"])'),\n blockedTypes: z.array(z.string()).optional().describe('Blocked file extensions (e.g., [\".exe\", \".bat\", \".sh\"])'),\n allowedMimeTypes: z.array(z.string()).optional().describe('Allowed MIME types (e.g., [\"image/jpeg\", \"application/pdf\"])'),\n blockedMimeTypes: z.array(z.string()).optional().describe('Blocked MIME types'),\n \n /** Virus Scanning */\n virusScan: z.boolean().default(false).describe('Enable virus scanning for uploaded files'),\n virusScanProvider: z.enum(['clamav', 'virustotal', 'metadefender', 'custom']).optional().describe('Virus scanning service provider'),\n virusScanOnUpload: z.boolean().default(true).describe('Scan files immediately on upload'),\n quarantineOnThreat: z.boolean().default(true).describe('Quarantine files if threat detected'),\n \n /** Storage Configuration */\n storageProvider: z.string().optional().describe('Object storage provider name (references ObjectStorageConfig)'),\n storageBucket: z.string().optional().describe('Target bucket name'),\n storagePrefix: z.string().optional().describe('Storage path prefix (e.g., \"uploads/documents/\")'),\n \n /** Image-Specific Validation */\n imageValidation: z.object({\n minWidth: z.number().min(1).optional().describe('Minimum image width in pixels'),\n maxWidth: z.number().min(1).optional().describe('Maximum image width in pixels'),\n minHeight: z.number().min(1).optional().describe('Minimum image height in pixels'),\n maxHeight: z.number().min(1).optional().describe('Maximum image height in pixels'),\n aspectRatio: z.string().optional().describe('Required aspect ratio (e.g., \"16:9\", \"1:1\")'),\n generateThumbnails: z.boolean().default(false).describe('Auto-generate thumbnails'),\n thumbnailSizes: z.array(z.object({\n name: z.string().describe('Thumbnail variant name (e.g., \"small\", \"medium\", \"large\")'),\n width: z.number().min(1).describe('Thumbnail width in pixels'),\n height: z.number().min(1).describe('Thumbnail height in pixels'),\n crop: z.boolean().default(false).describe('Crop to exact dimensions'),\n })).optional().describe('Thumbnail size configurations'),\n preserveMetadata: z.boolean().default(false).describe('Preserve EXIF metadata'),\n autoRotate: z.boolean().default(true).describe('Auto-rotate based on EXIF orientation'),\n }).optional().describe('Image-specific validation rules'),\n \n /** Upload Behavior */\n allowMultiple: z.boolean().default(false).describe('Allow multiple file uploads (overrides field.multiple)'),\n allowReplace: z.boolean().default(true).describe('Allow replacing existing files'),\n allowDelete: z.boolean().default(true).describe('Allow deleting uploaded files'),\n requireUpload: z.boolean().default(false).describe('Require at least one file when field is required'),\n \n /** Metadata Extraction */\n extractMetadata: z.boolean().default(true).describe('Extract file metadata (name, size, type, etc.)'),\n extractText: z.boolean().default(false).describe('Extract text content from documents (OCR/parsing)'),\n \n /** Versioning */\n versioningEnabled: z.boolean().default(false).describe('Keep previous versions of replaced files'),\n maxVersions: z.number().min(1).optional().describe('Maximum number of versions to retain'),\n \n /** Access Control */\n publicRead: z.boolean().default(false).describe('Allow public read access to uploaded files'),\n presignedUrlExpiry: z.number().min(60).max(604800).default(3600).describe('Presigned URL expiration in seconds (default: 1 hour)'),\n}).refine((data) => {\n // Validate minSize is less than or equal to maxSize\n if (data.minSize !== undefined && data.maxSize !== undefined && data.minSize > data.maxSize) {\n return false;\n }\n return true;\n}, {\n message: 'minSize must be less than or equal to maxSize',\n}).refine((data) => {\n // Validate virusScanProvider requires virusScan to be enabled\n if (data.virusScanProvider !== undefined && data.virusScan !== true) {\n return false;\n }\n return true;\n}, {\n message: 'virusScanProvider requires virusScan to be enabled',\n});\n\n/**\n * Data Quality Rules Schema\n * Defines data quality validation and monitoring for fields\n * \n * @example Unique SSN field with completeness requirement\n * {\n * uniqueness: true,\n * completeness: 0.95, // 95% of records must have this field\n * accuracy: {\n * source: 'government_db',\n * threshold: 0.98\n * }\n * }\n */\nexport const DataQualityRulesSchema = z.object({\n /** Enforce uniqueness constraint */\n uniqueness: z.boolean().default(false).describe('Enforce unique values across all records'),\n \n /** Completeness ratio (0-1) indicating minimum percentage of non-null values */\n completeness: z.number().min(0).max(1).default(0).describe('Minimum ratio of non-null values (0-1, default: 0 = no requirement)'),\n \n /** Accuracy validation against authoritative source */\n accuracy: z.object({\n source: z.string().describe('Reference data source for validation (e.g., \"api.verify.com\", \"master_data\")'),\n threshold: z.number().min(0).max(1).describe('Minimum accuracy threshold (0-1, e.g., 0.95 = 95% match required)'),\n }).optional().describe('Accuracy validation configuration'),\n});\n\n/**\n * Computed Field Caching Schema\n * Configuration for caching computed/formula field results\n * \n * @example Cache product price with 1-hour TTL, invalidate on inventory changes\n * {\n * enabled: true,\n * ttl: 3600,\n * invalidateOn: ['inventory.quantity', 'pricing.discount']\n * }\n */\nexport const ComputedFieldCacheSchema = z.object({\n /** Enable caching for this computed field */\n enabled: z.boolean().describe('Enable caching for computed field results'),\n \n /** Time-to-live in seconds */\n ttl: z.number().min(0).describe('Cache TTL in seconds (0 = no expiration)'),\n \n /** Array of field paths that trigger cache invalidation when changed */\n invalidateOn: z.array(z.string()).describe('Field paths that invalidate cache (e.g., [\"inventory.quantity\", \"pricing.base_price\"])'),\n});\n\n/**\n * Field Schema - Best Practice Enterprise Pattern\n */\n/**\n * Field Definition Schema\n * Defines the properties, type, and behavior of a single field (column) on an object.\n * \n * @example Lookup Field\n * {\n * name: \"account_id\",\n * label: \"Account\",\n * type: \"lookup\",\n * reference: \"accounts\",\n * required: true\n * }\n * \n * @example Select Field\n * {\n * name: \"status\",\n * label: \"Status\",\n * type: \"select\",\n * options: [\n * { label: \"Open\", value: \"open\" },\n * { label: \"Closed\", value: \"closed\" }\n * ],\n * defaultValue: \"open\"\n * }\n */\nexport const FieldSchema = z.object({\n /** Identity */\n name: z.string().regex(/^[a-z_][a-z0-9_]*$/).describe('Machine name (snake_case)').optional(),\n label: z.string().optional().describe('Human readable label'),\n type: FieldType.describe('Field Data Type'),\n description: z.string().optional().describe('Tooltip/Help text'),\n format: z.string().optional().describe('Format string (e.g. email, phone)'),\n\n /** Database Constraints */\n required: z.boolean().default(false).describe('Is required'),\n searchable: z.boolean().default(false).describe('Is searchable'),\n multiple: z.boolean().default(false).describe('Allow multiple values (Stores as Array/JSON). Applicable for select, lookup, file, image.'),\n unique: z.boolean().default(false).describe('Is unique constraint'),\n defaultValue: z.unknown().optional().describe('Default value'),\n \n /** Text/String Constraints */\n maxLength: z.number().optional().describe('Max character length'),\n minLength: z.number().optional().describe('Min character length'),\n \n /** Number Constraints */\n precision: z.number().optional().describe('Total digits'),\n scale: z.number().optional().describe('Decimal places'),\n min: z.number().optional().describe('Minimum value'),\n max: z.number().optional().describe('Maximum value'),\n\n /** Selection Options */\n options: z.array(SelectOptionSchema).optional().describe('Static options for select/multiselect'),\n\n /** Relationship Config */\n reference: z.string().optional().describe('Target Object Name'),\n referenceFilters: z.array(z.string()).optional().describe('Filters applied to lookup dialogs (e.g. \"active = true\")'),\n writeRequiresMasterRead: z.boolean().optional().describe('If true, user needs read access to master record to edit this field'),\n deleteBehavior: z.enum(['set_null', 'cascade', 'restrict']).optional().default('set_null').describe('What happens if referenced record is deleted'),\n\n /** Calculation */\n expression: z.string().optional().describe('Formula expression'),\n summaryOperations: z.object({\n object: z.string(),\n field: z.string(),\n function: z.enum(['count', 'sum', 'min', 'max', 'avg'])\n }).optional().describe('Roll-up summary definition'),\n\n /** Enhanced Field Type Configurations */\n // Code field config\n language: z.string().optional().describe('Programming language for syntax highlighting (e.g., javascript, python, sql)'),\n theme: z.string().optional().describe('Code editor theme (e.g., dark, light, monokai)'),\n lineNumbers: z.boolean().optional().describe('Show line numbers in code editor'),\n \n // Rating field config\n maxRating: z.number().optional().describe('Maximum rating value (default: 5)'),\n allowHalf: z.boolean().optional().describe('Allow half-star ratings'),\n \n // Location field config\n displayMap: z.boolean().optional().describe('Display map widget for location field'),\n allowGeocoding: z.boolean().optional().describe('Allow address-to-coordinate conversion'),\n \n // Address field config\n addressFormat: z.enum(['us', 'uk', 'international']).optional().describe('Address format template'),\n \n // Color field config\n colorFormat: z.enum(['hex', 'rgb', 'rgba', 'hsl']).optional().describe('Color value format'),\n allowAlpha: z.boolean().optional().describe('Allow transparency/alpha channel'),\n presetColors: z.array(z.string()).optional().describe('Preset color options'),\n \n // Slider field config\n step: z.number().optional().describe('Step increment for slider (default: 1)'),\n showValue: z.boolean().optional().describe('Display current value on slider'),\n marks: z.record(z.string(), z.string()).optional().describe('Custom marks/labels at specific values (e.g., {0: \"Low\", 50: \"Medium\", 100: \"High\"})'),\n \n // QR Code / Barcode field config\n // Note: qrErrorCorrection is only applicable when barcodeFormat='qr'\n // Runtime validation should enforce this constraint\n barcodeFormat: z.enum(['qr', 'ean13', 'ean8', 'code128', 'code39', 'upca', 'upce']).optional().describe('Barcode format type'),\n qrErrorCorrection: z.enum(['L', 'M', 'Q', 'H']).optional().describe('QR code error correction level (L=7%, M=15%, Q=25%, H=30%). Only applicable when barcodeFormat is \"qr\"'),\n displayValue: z.boolean().optional().describe('Display human-readable value below barcode/QR code'),\n allowScanning: z.boolean().optional().describe('Enable camera scanning for barcode/QR code input'),\n\n // Currency field config\n currencyConfig: CurrencyConfigSchema.optional().describe('Configuration for currency field type'),\n\n // Vector field config\n vectorConfig: VectorConfigSchema.optional().describe('Configuration for vector field type (AI/ML embeddings)'),\n\n // File attachment field config\n fileAttachmentConfig: FileAttachmentConfigSchema.optional().describe('Configuration for file and attachment field types'),\n\n /** Enhanced Security & Compliance */\n // Encryption configuration\n encryptionConfig: EncryptionConfigSchema.optional().describe('Field-level encryption configuration for sensitive data (GDPR/HIPAA/PCI-DSS)'),\n \n // Data masking rules\n maskingRule: MaskingRuleSchema.optional().describe('Data masking rules for PII protection'),\n \n // Audit trail\n auditTrail: z.boolean().default(false).describe('Enable detailed audit trail for this field (tracks all changes with user and timestamp)'),\n \n /** Field Dependencies & Relationships */\n // Field dependencies\n dependencies: z.array(z.string()).optional().describe('Array of field names that this field depends on (for formulas, visibility rules, etc.)'),\n \n /** Computed Field Optimization */\n // Computed field caching\n cached: ComputedFieldCacheSchema.optional().describe('Caching configuration for computed/formula fields'),\n \n /** Data Quality & Governance */\n // Data quality rules\n dataQuality: DataQualityRulesSchema.optional().describe('Data quality validation and monitoring rules'),\n\n /** Security & Visibility */\n hidden: z.boolean().default(false).describe('Hidden from default UI'),\n readonly: z.boolean().default(false).describe('Read-only in UI'),\n sortable: z.boolean().optional().default(true).describe('Whether field is sortable in list views'),\n inlineHelpText: z.string().optional().describe('Help text displayed below the field in forms'),\n trackFeedHistory: z.boolean().optional().describe('Track field changes in Chatter/activity feed (Salesforce pattern)'),\n caseSensitive: z.boolean().optional().describe('Whether text comparisons are case-sensitive'),\n autonumberFormat: z.string().optional().describe('Auto-number display format pattern (e.g., \"CASE-{0000}\")'),\n /** Indexing */\n index: z.boolean().default(false).describe('Create standard database index'),\n externalId: z.boolean().default(false).describe('Is external ID for upsert operations'),\n});\n\nexport type Field = z.infer<typeof FieldSchema>;\nexport type SelectOption = z.infer<typeof SelectOptionSchema>;\nexport type LocationCoordinates = z.infer<typeof LocationCoordinatesSchema>;\nexport type Address = z.infer<typeof AddressSchema>;\nexport type CurrencyConfig = z.infer<typeof CurrencyConfigSchema>;\nexport type CurrencyConfigInput = z.input<typeof CurrencyConfigSchema>;\nexport type CurrencyValue = z.infer<typeof CurrencyValueSchema>;\nexport type VectorConfig = z.infer<typeof VectorConfigSchema>;\nexport type VectorConfigInput = z.input<typeof VectorConfigSchema>;\nexport type FileAttachmentConfig = z.infer<typeof FileAttachmentConfigSchema>;\nexport type FileAttachmentConfigInput = z.input<typeof FileAttachmentConfigSchema>;\nexport type DataQualityRules = z.infer<typeof DataQualityRulesSchema>;\nexport type DataQualityRulesInput = z.input<typeof DataQualityRulesSchema>;\nexport type ComputedFieldCache = z.infer<typeof ComputedFieldCacheSchema>;\n\n/**\n * Field Factory Helper\n */\nexport type FieldInput = Omit<Partial<Field>, 'type'>;\n\nexport const Field = {\n text: (config: FieldInput = {}) => ({ type: 'text', ...config } as const),\n textarea: (config: FieldInput = {}) => ({ type: 'textarea', ...config } as const),\n number: (config: FieldInput = {}) => ({ type: 'number', ...config } as const),\n boolean: (config: FieldInput = {}) => ({ type: 'boolean', ...config } as const),\n date: (config: FieldInput = {}) => ({ type: 'date', ...config } as const),\n datetime: (config: FieldInput = {}) => ({ type: 'datetime', ...config } as const),\n currency: (config: FieldInput = {}) => ({ type: 'currency', ...config } as const),\n percent: (config: FieldInput = {}) => ({ type: 'percent', ...config } as const),\n url: (config: FieldInput = {}) => ({ type: 'url', ...config } as const),\n email: (config: FieldInput = {}) => ({ type: 'email', ...config } as const),\n phone: (config: FieldInput = {}) => ({ type: 'phone', ...config } as const),\n image: (config: FieldInput = {}) => ({ type: 'image', ...config } as const),\n file: (config: FieldInput = {}) => ({ type: 'file', ...config } as const),\n avatar: (config: FieldInput = {}) => ({ type: 'avatar', ...config } as const),\n formula: (config: FieldInput = {}) => ({ type: 'formula', ...config } as const),\n summary: (config: FieldInput = {}) => ({ type: 'summary', ...config } as const),\n autonumber: (config: FieldInput = {}) => ({ type: 'autonumber', ...config } as const),\n markdown: (config: FieldInput = {}) => ({ type: 'markdown', ...config } as const),\n html: (config: FieldInput = {}) => ({ type: 'html', ...config } as const),\n password: (config: FieldInput = {}) => ({ type: 'password', ...config } as const),\n \n /**\n * Select field helper with backward-compatible API\n * \n * Automatically converts option values to lowercase to enforce naming conventions.\n * \n * @example Old API (array first) - auto-converts to lowercase\n * Field.select(['High', 'Low'], { label: 'Priority' })\n * // Results in: [{ label: 'High', value: 'high' }, { label: 'Low', value: 'low' }]\n * \n * @example New API (config object) - enforces lowercase\n * Field.select({ options: [{label: 'High', value: 'high'}], label: 'Priority' })\n * \n * @example Multi-word values - converts to snake_case\n * Field.select(['In Progress', 'Closed Won'], { label: 'Status' })\n * // Results in: [{ label: 'In Progress', value: 'in_progress' }, { label: 'Closed Won', value: 'closed_won' }]\n */\n select: (optionsOrConfig: SelectOption[] | string[] | FieldInput & { options: SelectOption[] | string[] }, config?: FieldInput) => {\n // Helper function to convert string to lowercase snake_case\n const toSnakeCase = (str: string): string => {\n return str\n .toLowerCase()\n .replace(/\\s+/g, '_') // Replace spaces with underscores\n .replace(/[^a-z0-9_]/g, ''); // Remove invalid characters (keeping underscores only)\n };\n\n // Support both old and new signatures:\n // Old: Field.select(['a', 'b'], { label: 'X' })\n // New: Field.select({ options: [{label: 'A', value: 'a'}], label: 'X' })\n let options: SelectOption[];\n let finalConfig: FieldInput;\n \n if (Array.isArray(optionsOrConfig)) {\n // Old signature: array as first param\n options = optionsOrConfig.map(o => \n typeof o === 'string' \n ? { label: o, value: toSnakeCase(o) } // Auto-convert string to snake_case\n : { ...o, value: o.value.toLowerCase() } // Ensure value is lowercase\n );\n finalConfig = config || {};\n } else {\n // New signature: config object with options\n options = (optionsOrConfig.options || []).map(o => \n typeof o === 'string' \n ? { label: o, value: toSnakeCase(o) } // Auto-convert string to snake_case\n : { ...o, value: o.value.toLowerCase() } // Ensure value is lowercase\n );\n // Remove options from config to avoid confusion\n const { options: _, ...restConfig } = optionsOrConfig;\n finalConfig = restConfig;\n }\n \n return { type: 'select', options, ...finalConfig } as const;\n },\n\n \n lookup: (reference: string, config: FieldInput = {}) => ({ \n type: 'lookup', \n reference, \n ...config \n } as const),\n \n masterDetail: (reference: string, config: FieldInput = {}) => ({ \n type: 'master_detail', \n reference, \n ...config \n } as const),\n\n // Enhanced Field Type Helpers\n location: (config: FieldInput = {}) => ({ \n type: 'location', \n ...config \n } as const),\n \n address: (config: FieldInput = {}) => ({ \n type: 'address', \n ...config \n } as const),\n \n richtext: (config: FieldInput = {}) => ({ \n type: 'richtext', \n ...config \n } as const),\n \n code: (language?: string, config: FieldInput = {}) => ({ \n type: 'code', \n language,\n ...config \n } as const),\n \n color: (config: FieldInput = {}) => ({ \n type: 'color', \n ...config \n } as const),\n \n rating: (maxRating: number = 5, config: FieldInput = {}) => ({ \n type: 'rating', \n maxRating,\n ...config \n } as const),\n \n signature: (config: FieldInput = {}) => ({ \n type: 'signature', \n ...config \n } as const),\n \n slider: (config: FieldInput = {}) => ({ \n type: 'slider', \n ...config \n } as const),\n \n qrcode: (config: FieldInput = {}) => ({ \n type: 'qrcode', \n ...config \n } as const),\n \n vector: (dimensions: number, config: FieldInput = {}) => ({ \n type: 'vector', \n vectorConfig: {\n dimensions,\n distanceMetric: 'cosine' as const,\n normalized: false,\n indexed: true,\n ...config.vectorConfig\n },\n ...config \n } as const),\n};\n","// Copyright (c) 2025 ObjectStack. Licensed under the Apache-2.0 license.\n\nimport { z } from 'zod';\n\n/**\n * Field-level encryption protocol\n * GDPR/HIPAA/PCI-DSS compliant\n */\nexport const EncryptionAlgorithmSchema = z.enum([\n 'aes-256-gcm',\n 'aes-256-cbc',\n 'chacha20-poly1305',\n]).describe('Supported encryption algorithm');\n\nexport type EncryptionAlgorithm = z.infer<typeof EncryptionAlgorithmSchema>;\n\nexport const KeyManagementProviderSchema = z.enum([\n 'local',\n 'aws-kms',\n 'azure-key-vault',\n 'gcp-kms',\n 'hashicorp-vault',\n]).describe('Key management service provider');\n\nexport type KeyManagementProvider = z.infer<typeof KeyManagementProviderSchema>;\n\nexport const KeyRotationPolicySchema = z.object({\n enabled: z.boolean().default(false).describe('Enable automatic key rotation'),\n frequencyDays: z.number().min(1).default(90).describe('Rotation frequency in days'),\n retainOldVersions: z.number().default(3).describe('Number of old key versions to retain'),\n autoRotate: z.boolean().default(true).describe('Automatically rotate without manual approval'),\n}).describe('Policy for automatic encryption key rotation');\n\nexport type KeyRotationPolicy = z.infer<typeof KeyRotationPolicySchema>;\nexport type KeyRotationPolicyInput = z.input<typeof KeyRotationPolicySchema>;\n\nexport const EncryptionConfigSchema = z.object({\n enabled: z.boolean().default(false).describe('Enable field-level encryption'),\n algorithm: EncryptionAlgorithmSchema.default('aes-256-gcm').describe('Encryption algorithm'),\n keyManagement: z.object({\n provider: KeyManagementProviderSchema.describe('Key management service provider'),\n keyId: z.string().optional().describe('Key identifier in the provider'),\n rotationPolicy: KeyRotationPolicySchema.optional().describe('Key rotation policy'),\n }).describe('Key management configuration'),\n scope: z.enum(['field', 'record', 'table', 'database']).describe('Encryption scope level'),\n deterministicEncryption: z.boolean().default(false).describe('Allows equality queries on encrypted data'),\n searchableEncryption: z.boolean().default(false).describe('Allows search on encrypted data'),\n}).describe('Field-level encryption configuration');\n\nexport type EncryptionConfig = z.infer<typeof EncryptionConfigSchema>;\nexport type EncryptionConfigInput = z.input<typeof EncryptionConfigSchema>;\n\nexport const FieldEncryptionSchema = z.object({\n fieldName: z.string().describe('Name of the field to encrypt'),\n encryptionConfig: EncryptionConfigSchema.describe('Encryption settings for this field'),\n indexable: z.boolean().default(false).describe('Allow indexing on encrypted field'),\n}).describe('Per-field encryption assignment');\n\nexport type FieldEncryption = z.infer<typeof FieldEncryptionSchema>;\nexport type FieldEncryptionInput = z.input<typeof FieldEncryptionSchema>;\n","// Copyright (c) 2025 ObjectStack. Licensed under the Apache-2.0 license.\n\nimport { z } from 'zod';\n\n/**\n * Data masking protocol for PII protection\n */\nexport const MaskingStrategySchema = z.enum([\n 'redact', // Complete redaction: ****\n 'partial', // Partial masking: 138****5678\n 'hash', // Hash value: sha256(value)\n 'tokenize', // Tokenization: token-12345\n 'randomize', // Randomize: generate random value\n 'nullify', // Null value: null\n 'substitute', // Substitute with dummy data\n]).describe('Data masking strategy for PII protection');\n\nexport type MaskingStrategy = z.infer<typeof MaskingStrategySchema>;\n\nexport const MaskingRuleSchema = z.object({\n field: z.string().describe('Field name to apply masking to'),\n strategy: MaskingStrategySchema.describe('Masking strategy to use'),\n pattern: z.string().optional().describe('Regex pattern for partial masking'),\n preserveFormat: z.boolean().default(true).describe('Keep the original data format after masking'),\n preserveLength: z.boolean().default(true).describe('Keep the original data length after masking'),\n roles: z.array(z.string()).optional().describe('Roles that see masked data'),\n exemptRoles: z.array(z.string()).optional().describe('Roles that see unmasked data'),\n}).describe('Masking rule for a single field');\n\nexport type MaskingRule = z.infer<typeof MaskingRuleSchema>;\nexport type MaskingRuleInput = z.input<typeof MaskingRuleSchema>;\n\nexport const MaskingConfigSchema = z.object({\n enabled: z.boolean().default(false).describe('Enable data masking'),\n rules: z.array(MaskingRuleSchema).describe('List of field-level masking rules'),\n auditUnmasking: z.boolean().default(true).describe('Log when masked data is accessed unmasked'),\n}).describe('Top-level data masking configuration for PII protection');\n\nexport type MaskingConfig = z.infer<typeof MaskingConfigSchema>;\nexport type MaskingConfigInput = z.input<typeof MaskingConfigSchema>;\n","// Copyright (c) 2025 ObjectStack. Licensed under the Apache-2.0 license.\n\nimport { z } from 'zod';\n\n/**\n * # ObjectStack Validation Protocol\n * \n * This module defines the validation schema protocol for ObjectStack, providing a comprehensive\n * type-safe validation system similar to Salesforce's validation rules but with enhanced capabilities.\n * \n * ## Overview\n * \n * Validation rules are applied at the data layer to ensure data integrity and enforce business logic.\n * The system supports multiple validation types:\n * \n * 1. **Script Validation**: Formula-based validation using expressions\n * 2. **Uniqueness Validation**: Enforce unique constraints across fields\n * 3. **State Machine Validation**: Control allowed state transitions\n * 4. **Format Validation**: Validate field formats (email, URL, regex, etc.)\n * 5. **Cross-Field Validation**: Validate relationships between multiple fields\n * 6. **Async Validation**: Remote validation via API calls\n * 7. **Custom Validation**: User-defined validation functions\n * 8. **Conditional Validation**: Apply validations based on conditions\n * \n * ## Salesforce Comparison\n * \n * ObjectStack validation rules are inspired by Salesforce validation rules but enhanced:\n * - Salesforce: Formula-based validation with `Error Condition Formula`\n * - ObjectStack: Multiple validation types with composable rules\n * \n * Example Salesforce validation rule:\n * ```\n * Rule Name: Discount_Cannot_Exceed_40_Percent\n * Error Condition Formula: Discount_Percent__c > 0.40\n * Error Message: Discount cannot exceed 40%.\n * ```\n * \n * Equivalent ObjectStack rule:\n * ```typescript\n * {\n * type: 'script',\n * name: 'discount_cannot_exceed_40_percent',\n * condition: 'discount_percent > 0.40',\n * message: 'Discount cannot exceed 40%',\n * severity: 'error'\n * }\n * ```\n */\n\n/**\n * Base Validation Rule\n * \n * All validation rules extend from this base schema with common properties.\n * \n * ## Industry Standard Enhancements\n * - **Label/Description**: Essential for governance in large systems with thousands of rules.\n * - **Events**: granular control over validation timing (Context-aware validation).\n * - **Tags**: categorization for reporting and management.\n */\nconst BaseValidationSchema = z.object({\n // Identification\n name: z.string().regex(/^[a-z_][a-z0-9_]*$/).describe('Unique rule name (snake_case)'),\n label: z.string().optional().describe('Human-readable label for the rule listing'),\n description: z.string().optional().describe('Administrative notes explaining the business reason'),\n \n // Execution Control\n active: z.boolean().default(true),\n events: z.array(z.enum(['insert', 'update', 'delete'])).default(['insert', 'update']).describe('Validation contexts'),\n \n // Classification\n tags: z.array(z.string()).optional().describe('Categorization tags (e.g., \"compliance\", \"billing\")'),\n \n // Feedback\n severity: z.enum(['error', 'warning', 'info']).default('error'),\n message: z.string().describe('Error message to display to the user'),\n});\n\n/**\n * 1. Script/Expression Validation\n * Generic formula-based validation.\n */\nexport const ScriptValidationSchema = BaseValidationSchema.extend({\n type: z.literal('script'),\n condition: z.string().describe('Formula expression. If TRUE, validation fails. (e.g. amount < 0)'),\n});\n\n/**\n * 2. Uniqueness Validation\n * specialized optimized check for unique constraints.\n */\nexport const UniquenessValidationSchema = BaseValidationSchema.extend({\n type: z.literal('unique'),\n fields: z.array(z.string()).describe('Fields that must be combined unique'),\n scope: z.string().optional().describe('Formula condition for scope (e.g. active = true)'),\n caseSensitive: z.boolean().default(true),\n});\n\n/**\n * 3. State Machine Validation\n * State transition logic.\n */\nexport const StateMachineValidationSchema = BaseValidationSchema.extend({\n type: z.literal('state_machine'),\n field: z.string().describe('State field (e.g. status)'),\n transitions: z.record(z.string(), z.array(z.string())).describe('Map of { OldState: [AllowedNewStates] }'),\n});\n\n/**\n * 4. Value Format Validation\n * Regex or specialized formats.\n */\nexport const FormatValidationSchema = BaseValidationSchema.extend({\n type: z.literal('format'),\n field: z.string(),\n regex: z.string().optional(),\n format: z.enum(['email', 'url', 'phone', 'json']).optional(),\n});\n\n/**\n * 5. Cross-Field Validation\n * Validates relationships between multiple fields.\n * \n * ## Use Cases\n * - Date range validations (end_date > start_date)\n * - Amount comparisons (discount < total)\n * - Complex business rules involving multiple fields\n * \n * ## Salesforce Examples\n * \n * ### Example 1: Close Date Must Be In Current or Future Month\n * **Salesforce Formula:**\n * ```\n * MONTH(CloseDate) < MONTH(TODAY()) ||\n * YEAR(CloseDate) < YEAR(TODAY())\n * ```\n * \n * **ObjectStack Equivalent:**\n * ```typescript\n * {\n * type: 'cross_field',\n * name: 'close_date_future',\n * condition: 'MONTH(close_date) >= MONTH(TODAY()) AND YEAR(close_date) >= YEAR(TODAY())',\n * fields: ['close_date'],\n * message: 'Close Date must be in the current or a future month'\n * }\n * ```\n * \n * ### Example 2: Discount Validation\n * **Salesforce Formula:**\n * ```\n * Discount__c > (Amount__c * 0.40)\n * ```\n * \n * **ObjectStack Equivalent:**\n * ```typescript\n * {\n * type: 'cross_field',\n * name: 'discount_limit',\n * condition: 'discount > (amount * 0.40)',\n * fields: ['discount', 'amount'],\n * message: 'Discount cannot exceed 40% of the amount'\n * }\n * ```\n * \n * ### Example 3: Opportunity Must Have Products\n * **Salesforce Formula:**\n * ```\n * ISBLANK(Products__c) && ISPICKVAL(StageName, \"Closed Won\")\n * ```\n * \n * **ObjectStack Equivalent:**\n * ```typescript\n * {\n * type: 'cross_field',\n * name: 'products_required_for_won',\n * condition: 'products = null AND stage = \"closed_won\"',\n * fields: ['products', 'stage'],\n * message: 'Opportunity must have products to be marked as Closed Won'\n * }\n * ```\n */\nexport const CrossFieldValidationSchema = BaseValidationSchema.extend({\n type: z.literal('cross_field'),\n condition: z.string().describe('Formula expression comparing fields (e.g. \"end_date > start_date\")'),\n fields: z.array(z.string()).describe('Fields involved in the validation'),\n});\n\n/**\n * 6. JSON Structure Validation\n * Validates JSON fields against a JSON Schema.\n * \n * ## Use Cases\n * - Validating configuration objects stored in JSON fields\n * - Enforcing API payload structures\n * - Complex nested data validation\n */\nexport const JSONValidationSchema = BaseValidationSchema.extend({\n type: z.literal('json_schema'),\n field: z.string().describe('JSON field to validate'),\n schema: z.record(z.string(), z.unknown()).describe('JSON Schema object definition'),\n});\n\n/**\n * 7. Async Validation\n * Remote validation via API call or database query.\n * \n * ## Use Cases\n * \n * ### 1. Email Uniqueness Check\n * Check if an email address is already registered in the system.\n * ```typescript\n * {\n * type: 'async',\n * name: 'unique_email',\n * field: 'email',\n * validatorUrl: '/api/users/check-email',\n * message: 'This email address is already registered',\n * debounce: 500, // Wait 500ms after user stops typing\n * timeout: 3000\n * }\n * ```\n * \n * ### 2. Username Availability\n * Verify username is available before form submission.\n * ```typescript\n * {\n * type: 'async',\n * name: 'username_available',\n * field: 'username',\n * validatorUrl: '/api/users/check-username',\n * message: 'This username is already taken',\n * debounce: 300,\n * timeout: 2000\n * }\n * ```\n * \n * ### 3. Tax ID Validation\n * Validate tax ID with government API (e.g., IRS, HMRC).\n * ```typescript\n * {\n * type: 'async',\n * name: 'validate_tax_id',\n * field: 'tax_id',\n * validatorFunction: 'validateTaxIdWithIRS',\n * message: 'Invalid Tax ID number',\n * timeout: 10000, // Government APIs may be slow\n * params: { country: 'US', format: 'EIN' }\n * }\n * ```\n * \n * ### 4. Credit Card Validation\n * Verify credit card with payment gateway without charging.\n * ```typescript\n * {\n * type: 'async',\n * name: 'validate_card',\n * field: 'card_number',\n * validatorUrl: 'https://api.stripe.com/v1/tokens/validate',\n * message: 'Invalid credit card number',\n * timeout: 5000,\n * params: { \n * mode: 'validate_only',\n * checkFunds: false \n * }\n * }\n * ```\n * \n * ### 5. Address Validation\n * Validate and standardize addresses using geocoding services.\n * ```typescript\n * {\n * type: 'async',\n * name: 'validate_address',\n * field: 'street_address',\n * validatorFunction: 'validateAddressWithGoogleMaps',\n * message: 'Unable to verify address',\n * timeout: 4000,\n * params: {\n * includeFields: ['city', 'state', 'zip'],\n * strictMode: true,\n * country: 'US'\n * }\n * }\n * ```\n * \n * ### 6. Domain Name Availability\n * Check if domain name is available for registration.\n * ```typescript\n * {\n * type: 'async',\n * name: 'domain_available',\n * field: 'domain_name',\n * validatorUrl: '/api/domains/check-availability',\n * message: 'This domain is already taken or reserved',\n * debounce: 500,\n * timeout: 2000\n * }\n * ```\n * \n * ### 7. Coupon Code Validation\n * Verify coupon code is valid and not expired.\n * ```typescript\n * {\n * type: 'async',\n * name: 'validate_coupon',\n * field: 'coupon_code',\n * validatorUrl: '/api/coupons/validate',\n * message: 'Invalid or expired coupon code',\n * timeout: 2000,\n * params: {\n * checkExpiration: true,\n * checkUsageLimit: true,\n * userId: '{{current_user_id}}'\n * }\n * }\n * ```\n */\nexport const AsyncValidationSchema = BaseValidationSchema.extend({\n type: z.literal('async'),\n field: z.string().describe('Field to validate'),\n validatorUrl: z.string().optional().describe('External API endpoint for validation'),\n method: z.enum(['GET', 'POST']).default('GET').describe('HTTP method for external call'),\n headers: z.record(z.string(), z.string()).optional().describe('Custom headers for the request'),\n validatorFunction: z.string().optional().describe('Reference to custom validator function'),\n timeout: z.number().optional().default(5000).describe('Timeout in milliseconds'),\n debounce: z.number().optional().describe('Debounce delay in milliseconds'),\n params: z.record(z.string(), z.unknown()).optional().describe('Additional parameters to pass to validator'),\n});\n\n/**\n * 8. Custom Validator Function\n * User-defined validation logic with code reference.\n */\nexport const CustomValidatorSchema = BaseValidationSchema.extend({\n type: z.literal('custom'),\n handler: z.string().describe('Name of the custom validation function registered in the system'),\n params: z.record(z.string(), z.unknown()).optional().describe('Parameters passed to the custom handler'),\n});\n\n/**\n * 9. Master Validation Rule Schema\n */\n/** Base type for validation rules - used for z.lazy() recursive type annotation */\nexport interface BaseValidationRuleShape {\n type: string;\n name: string;\n message: string;\n label?: string;\n description?: string;\n active?: boolean;\n events?: ('insert' | 'update' | 'delete')[];\n tags?: string[];\n severity?: 'error' | 'warning' | 'info';\n [key: string]: unknown;\n}\n\nexport const ValidationRuleSchema: z.ZodType<BaseValidationRuleShape> = z.lazy(() =>\n z.discriminatedUnion('type', [\n ScriptValidationSchema,\n UniquenessValidationSchema,\n StateMachineValidationSchema,\n FormatValidationSchema,\n CrossFieldValidationSchema,\n JSONValidationSchema,\n AsyncValidationSchema,\n CustomValidatorSchema,\n ConditionalValidationSchema,\n ])\n);\n\n/**\n * 8. Conditional Validation\n * Validation that only applies when a condition is met.\n * \n * ## Overview\n * Conditional validations follow the pattern: \"Validate X only if Y is true\"\n * This allows for context-aware validation rules that adapt to different scenarios.\n * \n * ## Use Cases\n * \n * ### 1. Validate Based on Record Type\n * Apply different validation rules based on the type of record.\n * ```typescript\n * {\n * type: 'conditional',\n * name: 'enterprise_approval_required',\n * when: 'account_type = \"enterprise\"',\n * message: 'Enterprise validation',\n * then: {\n * type: 'script',\n * name: 'require_approval',\n * message: 'Enterprise accounts require manager approval',\n * condition: 'approval_status = null'\n * }\n * }\n * ```\n * \n * ### 2. Conditional Field Requirements\n * Require certain fields only when specific conditions are met.\n * ```typescript\n * {\n * type: 'conditional',\n * name: 'shipping_address_when_required',\n * when: 'requires_shipping = true',\n * message: 'Shipping validation',\n * then: {\n * type: 'script',\n * name: 'shipping_address_required',\n * message: 'Shipping address is required for physical products',\n * condition: 'shipping_address = null OR shipping_address = \"\"'\n * }\n * }\n * ```\n * \n * ### 3. Amount-Based Validation\n * Apply different rules based on transaction amount.\n * ```typescript\n * {\n * type: 'conditional',\n * name: 'high_value_approval',\n * when: 'order_total > 10000',\n * message: 'High value order validation',\n * then: {\n * type: 'script',\n * name: 'manager_approval_required',\n * message: 'Orders over $10,000 require manager approval',\n * condition: 'manager_approval_id = null'\n * },\n * otherwise: {\n * type: 'script',\n * name: 'standard_validation',\n * message: 'Payment method is required',\n * condition: 'payment_method = null'\n * }\n * }\n * ```\n * \n * ### 4. Regional Compliance\n * Apply region-specific validation rules.\n * ```typescript\n * {\n * type: 'conditional',\n * name: 'regional_compliance',\n * when: 'region = \"EU\"',\n * message: 'EU compliance validation',\n * then: {\n * type: 'script',\n * name: 'gdpr_consent',\n * message: 'GDPR consent is required for EU customers',\n * condition: 'gdpr_consent_given = false'\n * },\n * otherwise: {\n * type: 'script',\n * name: 'tos_acceptance',\n * message: 'Terms of Service acceptance required',\n * condition: 'tos_accepted = false'\n * }\n * }\n * ```\n * \n * ### 5. Nested Conditional Validation\n * Create complex validation logic with nested conditions.\n * ```typescript\n * {\n * type: 'conditional',\n * name: 'country_state_validation',\n * when: 'country = \"US\"',\n * message: 'US-specific validation',\n * then: {\n * type: 'conditional',\n * name: 'california_validation',\n * when: 'state = \"CA\"',\n * message: 'California-specific validation',\n * then: {\n * type: 'script',\n * name: 'ca_tax_id_required',\n * message: 'California requires a valid tax ID',\n * condition: 'tax_id = null OR NOT(REGEX(tax_id, \"^\\\\d{2}-\\\\d{7}$\"))'\n * }\n * }\n * }\n * ```\n * \n * ### 6. Tax Validation for Taxable Items\n * Only validate tax fields when the item is taxable.\n * ```typescript\n * {\n * type: 'conditional',\n * name: 'tax_field_validation',\n * when: 'is_taxable = true',\n * message: 'Tax validation',\n * then: {\n * type: 'script',\n * name: 'tax_code_required',\n * message: 'Tax code is required for taxable items',\n * condition: 'tax_code = null OR tax_code = \"\"'\n * }\n * }\n * ```\n * \n * ### 7. Role-Based Validation\n * Apply validation based on user role.\n * ```typescript\n * {\n * type: 'conditional',\n * name: 'role_based_approval_limit',\n * when: 'user_role = \"manager\"',\n * message: 'Manager approval limits',\n * then: {\n * type: 'script',\n * name: 'manager_limit',\n * message: 'Managers can approve up to $50,000',\n * condition: 'approval_amount > 50000'\n * }\n * }\n * ```\n * \n * ## Salesforce Pattern Comparison\n * \n * Salesforce doesn't have explicit \"conditional validation\" rules but achieves similar\n * behavior using formula logic. ObjectStack makes this pattern explicit and composable.\n * \n * **Salesforce Approach:**\n * ```\n * IF(\n * ISPICKVAL(Type, \"Enterprise\"),\n * AND(Amount > 100000, ISBLANK(Approval__c)),\n * FALSE\n * )\n * ```\n * \n * **ObjectStack Approach:**\n * ```typescript\n * {\n * type: 'conditional',\n * name: 'enterprise_high_value',\n * when: 'type = \"enterprise\"',\n * then: {\n * type: 'cross_field',\n * name: 'amount_approval',\n * condition: 'amount > 100000 AND approval = null',\n * fields: ['amount', 'approval']\n * }\n * }\n * ```\n */\nexport const ConditionalValidationSchema = BaseValidationSchema.extend({\n type: z.literal('conditional'),\n when: z.string().describe('Condition formula (e.g. \"type = \\'enterprise\\'\")'),\n then: ValidationRuleSchema.describe('Validation rule to apply when condition is true'),\n otherwise: ValidationRuleSchema.optional().describe('Validation rule to apply when condition is false'),\n});\n\nexport type ValidationRule = z.infer<typeof ValidationRuleSchema>;\nexport type ScriptValidation = z.infer<typeof ScriptValidationSchema>;\nexport type UniquenessValidation = z.infer<typeof UniquenessValidationSchema>;\nexport type StateMachineValidation = z.infer<typeof StateMachineValidationSchema>;\nexport type FormatValidation = z.infer<typeof FormatValidationSchema>;\nexport type CrossFieldValidation = z.infer<typeof CrossFieldValidationSchema>;\nexport type JSONValidation = z.infer<typeof JSONValidationSchema>;\nexport type AsyncValidation = z.infer<typeof AsyncValidationSchema>;\nexport type CustomValidation = z.infer<typeof CustomValidatorSchema>;\nexport type ConditionalValidation = z.infer<typeof ConditionalValidationSchema>;","// Copyright (c) 2025 ObjectStack. Licensed under the Apache-2.0 license.\n\nimport { z } from 'zod';\nimport { SnakeCaseIdentifierSchema } from '../shared/identifiers.zod';\n\n/**\n * XState-inspired State Machine Protocol\n * Used to define strict business logic constraints and lifecycle management.\n * Prevent AI \"hallucinations\" by enforcing valid valid transitions.\n */\n\n// --- Primitives ---\n\n/**\n * References a named action (side effect)\n * Can be a script, a webhook, or a field update.\n */\nexport const ActionRefSchema = z.union([\n z.string().describe('Action Name'),\n z.object({\n type: z.string(), // e.g., 'xstate.assign', 'log', 'email'\n params: z.record(z.string(), z.unknown()).optional()\n })\n]);\n\n/**\n * References a named condition (guard)\n * Must evaluate to true for the transition to occur.\n */\nexport const GuardRefSchema = z.union([\n z.string().describe('Guard Name (e.g., \"isManager\", \"amountGT1000\")'),\n z.object({\n type: z.string(),\n params: z.record(z.string(), z.unknown()).optional()\n })\n]);\n\n// --- Core Structure ---\n\n/**\n * State Transition Definition\n * \"When EVENT happens, if GUARD is true, go to TARGET and run ACTIONS\"\n */\nexport const TransitionSchema = z.object({\n target: z.string().optional().describe('Target State ID'),\n cond: GuardRefSchema.optional().describe('Condition (Guard) required to take this path'),\n actions: z.array(ActionRefSchema).optional().describe('Actions to execute during transition'),\n description: z.string().optional().describe('Human readable description of this rule'),\n});\n\n/**\n * Event Definition (Signals)\n */\nexport const EventSchema = z.object({\n type: z.string().describe('Event Type (e.g. \"APPROVE\", \"REJECT\", \"Submit\")'),\n // Payload validation schema could go here if we want deep validation\n schema: z.record(z.string(), z.unknown()).optional().describe('Expected event payload structure'),\n});\n\nexport type ActionRef = z.infer<typeof ActionRefSchema>;\nexport type Transition = z.infer<typeof TransitionSchema>;\n\nexport type StateNodeConfig = {\n type?: 'atomic' | 'compound' | 'parallel' | 'final' | 'history';\n entry?: ActionRef[];\n exit?: ActionRef[];\n on?: Record<string, string | Transition | Transition[]>;\n always?: Transition[];\n initial?: string;\n states?: Record<string, StateNodeConfig>;\n meta?: {\n label?: string;\n description?: string;\n color?: string;\n aiInstructions?: string;\n };\n};\n\n/**\n * State Node Definition\n */\nexport const StateNodeSchema: z.ZodType<StateNodeConfig> = z.lazy(() => z.object({\n /** Type of state */\n type: z.enum(['atomic', 'compound', 'parallel', 'final', 'history']).default('atomic'),\n \n /** Entry/Exit Actions */\n entry: z.array(ActionRefSchema).optional().describe('Actions to run when entering this state'),\n exit: z.array(ActionRefSchema).optional().describe('Actions to run when leaving this state'),\n \n /** Transitions (Events) */\n on: z.record(z.string(), z.union([\n z.string(), // Shorthand target\n TransitionSchema, \n z.array(TransitionSchema)\n ])).optional().describe('Map of Event Type -> Transition Definition'),\n \n /** Always Transitions (Eventless) */\n always: z.array(TransitionSchema).optional(),\n\n /** Nesting (Hierarchical States) */\n initial: z.string().optional().describe('Initial child state (if compound)'),\n states: z.record(z.string(), StateNodeSchema).optional(),\n \n /** Metadata for UI/AI */\n meta: z.object({\n label: z.string().optional(),\n description: z.string().optional(),\n color: z.string().optional(), // For UI diagrams\n // Instructions for AI Agent when in this state\n aiInstructions: z.string().optional().describe('Specific instructions for AI when in this state'),\n }).optional(),\n}));\n\n/**\n * Top-Level State Machine Definition\n */\nexport const StateMachineSchema = z.object({\n id: SnakeCaseIdentifierSchema.describe('Unique Machine ID'),\n description: z.string().optional(),\n \n /** Context (Memory) Schema */\n contextSchema: z.record(z.string(), z.unknown()).optional().describe('Zod Schema for the machine context/memory'),\n \n /** Initial State */\n initial: z.string().describe('Initial State ID'),\n \n /** State Definitions */\n states: z.record(z.string(), StateNodeSchema).describe('State Nodes'),\n \n /** Global Listeners */\n on: z.record(z.string(), z.union([z.string(), TransitionSchema, z.array(TransitionSchema)])).optional(),\n});\n\nexport type StateMachineConfig = z.infer<typeof StateMachineSchema>;\n","// Copyright (c) 2025 ObjectStack. Licensed under the Apache-2.0 license.\n\nimport { z } from 'zod';\nimport { SnakeCaseIdentifierSchema } from '../shared/identifiers.zod';\nimport { I18nLabelSchema, AriaPropsSchema } from './i18n.zod';\n\n/**\n * Base Navigation Item Schema\n * Shared properties for all navigation types.\n * \n * **NAMING CONVENTION:**\n * Navigation item IDs are used in URLs and configuration and must be lowercase snake_case.\n * \n * @example Good IDs\n * - 'menu_accounts'\n * - 'page_dashboard'\n * - 'nav_settings'\n * \n * @example Bad IDs (will be rejected)\n * - 'MenuAccounts' (PascalCase)\n * - 'Page Dashboard' (spaces)\n */\nconst BaseNavItemSchema = z.object({\n /** Unique identifier for the item */\n id: SnakeCaseIdentifierSchema.describe('Unique identifier for this navigation item (lowercase snake_case)'),\n \n /** Display label */\n label: I18nLabelSchema.describe('Display proper label'),\n \n /** Icon name (Lucide) */\n icon: z.string().optional().describe('Icon name'),\n\n /** \n * Visibility condition. \n * Formula expression returning boolean. \n * e.g. \"user.is_admin || user.department == 'sales'\"\n */\n visible: z.string().optional().describe('Visibility formula condition'),\n});\n\n/**\n * 1. Object Navigation Item\n * Navigates to an object's list view.\n */\nexport const ObjectNavItemSchema = BaseNavItemSchema.extend({\n type: z.literal('object'),\n objectName: z.string().describe('Target object name'),\n viewName: z.string().optional().describe('Default list view to open. Defaults to \"all\"'),\n});\n\n/**\n * 2. Dashboard Navigation Item\n * Navigates to a specific dashboard.\n */\nexport const DashboardNavItemSchema = BaseNavItemSchema.extend({\n type: z.literal('dashboard'),\n dashboardName: z.string().describe('Target dashboard name'),\n});\n\n/**\n * 3. Page Navigation Item\n * Navigates to a custom UI page/component.\n */\nexport const PageNavItemSchema = BaseNavItemSchema.extend({\n type: z.literal('page'),\n pageName: z.string().describe('Target custom page component name'),\n params: z.record(z.string(), z.unknown()).optional().describe('Parameters passed to the page context'),\n});\n\n/**\n * 4. URL Navigation Item\n * Navigates to an external or absolute URL.\n */\nexport const UrlNavItemSchema = BaseNavItemSchema.extend({\n type: z.literal('url'),\n url: z.string().describe('Target external URL'),\n target: z.enum(['_self', '_blank']).default('_self').describe('Link target window'),\n});\n\n/**\n * 5. Group Navigation Item\n * A container for child navigation items (Sub-menu).\n * Does not perform navigation itself.\n */\nexport const GroupNavItemSchema = BaseNavItemSchema.extend({\n type: z.literal('group'),\n expanded: z.boolean().default(false).describe('Default expansion state in sidebar'),\n // children property is added in the recursive definition below\n});\n\n/**\n * Recursive Union of all navigation item types.\n * Allows constructing a navigation tree.\n */\nexport const NavigationItemSchema: z.ZodType<any> = z.lazy(() => \n z.union([\n // Object Item can now have children (Airtable style: Object -> Views)\n ObjectNavItemSchema.extend({\n children: z.array(NavigationItemSchema).optional().describe('Child navigation items (e.g. specific views)'),\n }),\n DashboardNavItemSchema,\n PageNavItemSchema,\n UrlNavItemSchema,\n GroupNavItemSchema.extend({\n children: z.array(NavigationItemSchema).describe('Child navigation items'),\n })\n ])\n);\n\n/**\n * App Branding Configuration\n * Allows configuring the look and feel of the specific app.\n */\nexport const AppBrandingSchema = z.object({\n primaryColor: z.string().optional().describe('Primary theme color hex code'),\n logo: z.string().optional().describe('Custom logo URL for this app'),\n favicon: z.string().optional().describe('Custom favicon URL for this app'),\n});\n\n/**\n * Schema for Applications (Apps).\n * A logical container for business functionality (e.g., \"Sales CRM\", \"HR Portal\").\n * \n * **NAMING CONVENTION:**\n * App names are used in URLs and routing and must be lowercase snake_case.\n * Prefix with 'app_' is recommended for clarity.\n * \n * @example Good app names\n * - 'app_crm'\n * - 'app_finance'\n * - 'app_portal'\n * - 'sales_app'\n * \n * @example Bad app names (will be rejected)\n * - 'CRM' (uppercase)\n * - 'FinanceApp' (mixed case)\n * - 'Sales App' (spaces)\n */\n/**\n * App Configuration Schema\n * Defines a business application container, including its navigation, branding, and permissions.\n * \n * @example CRM App\n * {\n * name: \"crm\",\n * label: \"Sales CRM\",\n * icon: \"briefcase\",\n * navigation: [\n * { type: \"object\", id: \"nav_leads\", label: \"Leads\", objectName: \"leads\" },\n * { type: \"object\", id: \"nav_deals\", label: \"Deals\", objectName: \"deals\" }\n * ],\n * requiredPermissions: [\"app.crm.access\"]\n * }\n */\nexport const AppSchema = z.object({\n /** Machine name (id) */\n name: SnakeCaseIdentifierSchema.describe('App unique machine name (lowercase snake_case)'),\n \n /** Display label */\n label: I18nLabelSchema.describe('App display label'),\n\n /** App version */\n version: z.string().optional().describe('App version'),\n \n /** Description */\n description: I18nLabelSchema.optional().describe('App description'),\n \n /** Icon name (Lucide) */\n icon: z.string().optional().describe('App icon used in the App Launcher'),\n \n /** Branding/Theming Configuration */\n branding: AppBrandingSchema.optional().describe('App-specific branding'),\n \n /** Application status */\n active: z.boolean().optional().default(true).describe('Whether the app is enabled'),\n\n /** Is this the default app for new users? */\n isDefault: z.boolean().optional().default(false).describe('Is default app'),\n \n /** \n * Navigation Tree Structure.\n * Replaces the old flat 'tabs' list with a structured menu.\n */\n navigation: z.array(NavigationItemSchema).optional().describe('Structured navigation menu tree'),\n \n /** \n * App-level Home Page Override\n * ID of the navigation item to act as the landing page.\n * If not set, usually defaults to the first navigation item.\n */\n homePageId: z.string().optional().describe('ID of the navigation item to serve as landing page'),\n\n /** \n * Access Control\n * List of permissions required to access this app.\n * Modern replacement for role/profile based assignment.\n * Example: [\"app.access.crm\"]\n */\n requiredPermissions: z.array(z.string()).optional().describe('Permissions required to access this app'),\n \n /** \n * Package Components (For config file convenience)\n * In a real monorepo these might be auto-discovered, but here we allow explicit registration.\n */\n objects: z.array(z.unknown()).optional().describe('Objects belonging to this app'),\n apis: z.array(z.unknown()).optional().describe('Custom APIs belonging to this app'),\n\n /** Mobile navigation mode */\n mobileNavigation: z.object({\n mode: z.enum(['drawer', 'bottom_nav', 'hamburger']).default('drawer')\n .describe('Mobile navigation mode: drawer sidebar, bottom navigation bar, or hamburger menu'),\n bottomNavItems: z.array(z.string()).optional()\n .describe('Navigation item IDs to show in bottom nav (max 5)'),\n }).optional().describe('Mobile-specific navigation configuration'),\n\n /** ARIA accessibility attributes */\n aria: AriaPropsSchema.optional().describe('ARIA accessibility attributes for the application'),\n});\n\n/**\n * App Factory Helper\n */\nexport const App = {\n create: (config: z.input<typeof AppSchema>): App => AppSchema.parse(config),\n} as const;\n\n// Main Types\nexport type App = z.infer<typeof AppSchema>;\nexport type AppInput = z.input<typeof AppSchema>;\nexport type AppBranding = z.infer<typeof AppBrandingSchema>;\nexport type NavigationItem = z.infer<typeof NavigationItemSchema>;\n\n// Discriminated Item Types (Helper exports)\nexport type ObjectNavItem = z.infer<typeof ObjectNavItemSchema>;\nexport type DashboardNavItem = z.infer<typeof DashboardNavItemSchema>;\nexport type PageNavItem = z.infer<typeof PageNavItemSchema>;\nexport type UrlNavItem = z.infer<typeof UrlNavItemSchema>;\nexport type GroupNavItem = z.infer<typeof GroupNavItemSchema> & { children: NavigationItem[] };\n","// Copyright (c) 2025 ObjectStack. Licensed under the Apache-2.0 license.\n\nimport { z } from 'zod';\nimport { CoreServiceName, ServiceCriticalitySchema } from '../system/core-services.zod';\n\n/**\n * # HttpDispatcher Protocol\n * \n * Defines how the ObjectStack HttpDispatcher routes incoming API requests\n * to the correct kernel service based on URL prefix matching.\n * \n * The dispatcher is the central routing component that:\n * 1. Matches incoming request URLs against registered route prefixes\n * 2. Delegates to the corresponding CoreService implementation\n * 3. Returns 503 Service Unavailable when a service is not registered\n * 4. Supports dynamic route registration from plugins via contributes.routes\n * \n * Architecture alignment:\n * - Kubernetes: API server aggregation layer\n * - Eclipse: Extension registry routing\n * - VS Code: Command palette routing\n */\n\n// ============================================================================\n// Route Definition\n// ============================================================================\n\n/**\n * Dispatcher Route Schema\n * Maps a URL prefix to a kernel service.\n * \n * @example\n * {\n * \"prefix\": \"/api/v1/data\",\n * \"service\": \"data\",\n * \"authRequired\": true,\n * \"criticality\": \"required\"\n * }\n */\nexport const DispatcherRouteSchema = z.object({\n /**\n * URL path prefix for routing.\n * Incoming requests matching this prefix are routed to the target service.\n * Must start with '/'.\n */\n prefix: z.string().regex(/^\\//).describe('URL path prefix for routing (e.g. /api/v1/data)'),\n \n /**\n * Target core service name.\n * The service that handles requests matching this prefix.\n */\n service: CoreServiceName.describe('Target core service name'),\n \n /**\n * Whether requests to this route require authentication.\n * Discovery endpoint is typically public; most others require auth.\n * @default true\n */\n authRequired: z.boolean().default(true).describe('Whether authentication is required'),\n \n /**\n * Service criticality level.\n * Determines behavior when the service is unavailable:\n * - required: return 500 Internal Server Error\n * - core: return 503 with degraded notice\n * - optional: return 503 Service Unavailable\n * @default 'optional'\n */\n criticality: ServiceCriticalitySchema.default('optional')\n .describe('Service criticality level for unavailability handling'),\n \n /**\n * Required permissions for accessing this route namespace.\n * Applied as a baseline before individual endpoint permission checks.\n */\n permissions: z.array(z.string()).optional()\n .describe('Required permissions for this route namespace'),\n});\n\nexport type DispatcherRoute = z.infer<typeof DispatcherRouteSchema>;\nexport type DispatcherRouteInput = z.input<typeof DispatcherRouteSchema>;\n\n// ============================================================================\n// Dispatcher Configuration\n// ============================================================================\n\n/**\n * Dispatcher Configuration Schema\n * Complete configuration for the HttpDispatcher routing table.\n * \n * @example\n * {\n * \"routes\": [\n * { \"prefix\": \"/api/v1/discovery\", \"service\": \"metadata\", \"authRequired\": false },\n * { \"prefix\": \"/api/v1/meta\", \"service\": \"metadata\" },\n * { \"prefix\": \"/api/v1/data\", \"service\": \"data\", \"criticality\": \"required\" },\n * { \"prefix\": \"/api/v1/auth\", \"service\": \"auth\", \"criticality\": \"required\" },\n * { \"prefix\": \"/api/v1/ai\", \"service\": \"ai\" }\n * ],\n * \"fallback\": \"404\"\n * }\n */\nexport const DispatcherConfigSchema = z.object({\n /**\n * Registered route mappings.\n * Routes are matched by longest-prefix-first strategy.\n */\n routes: z.array(DispatcherRouteSchema).describe('Route-to-service mappings'),\n \n /**\n * Behavior when no route matches the request.\n * - 404: Return 404 Not Found (default)\n * - proxy: Forward to a configured proxy target\n * - custom: Delegate to a custom handler\n * @default '404'\n */\n fallback: z.enum(['404', 'proxy', 'custom']).default('404')\n .describe('Behavior when no route matches'),\n \n /**\n * Proxy target URL for fallback: 'proxy' mode.\n */\n proxyTarget: z.string().url().optional()\n .describe('Proxy target URL when fallback is \"proxy\"'),\n});\n\nexport type DispatcherConfig = z.infer<typeof DispatcherConfigSchema>;\nexport type DispatcherConfigInput = z.input<typeof DispatcherConfigSchema>;\n\n// ============================================================================\n// Default Route Table\n// ============================================================================\n\n/**\n * Default route table for the ObjectStack HttpDispatcher.\n * Maps all Protocol namespaces to their corresponding services.\n * \n * This is the recommended baseline configuration. Plugins can extend\n * this table by declaring routes in their manifest's contributes.routes.\n */\nexport const DEFAULT_DISPATCHER_ROUTES: DispatcherRouteInput[] = [\n // Discovery (public)\n { prefix: '/api/v1/discovery', service: 'metadata', authRequired: false, criticality: 'required' },\n \n // Required Services\n { prefix: '/api/v1/meta', service: 'metadata', criticality: 'required' },\n { prefix: '/api/v1/data', service: 'data', criticality: 'required' },\n { prefix: '/api/v1/auth', service: 'auth', criticality: 'required' },\n \n // Optional Services (plugin-provided)\n { prefix: '/api/v1/packages', service: 'metadata' },\n { prefix: '/api/v1/ui', service: 'ui' },\n { prefix: '/api/v1/workflow', service: 'workflow' },\n { prefix: '/api/v1/analytics', service: 'analytics' },\n { prefix: '/api/v1/automation', service: 'automation' },\n { prefix: '/api/v1/i18n', service: 'i18n' },\n { prefix: '/api/v1/notifications', service: 'notification' },\n { prefix: '/api/v1/realtime', service: 'realtime' },\n { prefix: '/api/v1/ai', service: 'ai' },\n];\n","// Copyright (c) 2025 ObjectStack. Licensed under the Apache-2.0 license.\n\nimport { z } from 'zod';\n\n/**\n * # Service Registry Protocol\n * \n * Defines the standard built-in services that constitute the ObjectStack Kernel.\n * This registry is used by the `ObjectKernel` and `HttpDispatcher` to:\n * 1. Verify service availability.\n * 2. Route requests to the correct service handler.\n * 3. Type-check service interactions.\n */\n\n// ==========================================\n// Service Identifiers\n// ==========================================\n\nexport const CoreServiceName = z.enum([\n // Core Data & Metadata\n 'metadata', // Object/Field Definitions\n 'data', // CRUD & Query Engine\n 'auth', // Authentication & Identity\n \n // Infrastructure\n 'file-storage', // Storage Driver (Local/S3)\n 'search', // Search Engine (Elastic/Meili)\n 'cache', // Cache Driver (Redis/Memory)\n 'queue', // Job Queue (BullMQ/Redis)\n \n // Advanced Capabilities\n 'automation', // Flow & Script Engine\n 'graphql', // GraphQL API Engine\n 'analytics', // BI & Semantic Layer\n 'realtime', // WebSocket & PubSub\n 'job', // Background Job Manager\n 'notification', // Email/Push/SMS\n 'ai', // AI Engine (NLQ, Chat, Suggest, Insights)\n 'i18n', // Internationalization Service\n 'ui', // UI Metadata Service (View CRUD)\n 'workflow', // Workflow State Machine Engine\n]);\n\nexport type CoreServiceName = z.infer<typeof CoreServiceName>;\n\n/**\n * Service Criticality Level\n * Defines the startup behavior when a service is missing.\n */\nexport const ServiceCriticalitySchema = z.enum([\n 'required', // System fails to start if missing (Exit Code 1)\n 'core', // System warns if missing, functionality degraded (Warn)\n 'optional', // System ignores if missing, feature disabled (Info)\n]);\n\n/**\n * Service Requirement Definition\n */\nexport const ServiceRequirementDef = {\n // Required: The kernel cannot function without these\n metadata: 'required',\n data: 'required',\n\n // Core: Highly recommended, defaults to in-memory / no-op if missing\n auth: 'core',\n\n // Core: Highly recommended, defaults to in-memory if missing\n cache: 'core',\n queue: 'core',\n job: 'core',\n\n // Optional: Add-on capabilities\n 'file-storage': 'optional',\n search: 'optional',\n automation: 'optional',\n graphql: 'optional',\n analytics: 'optional',\n realtime: 'optional',\n notification: 'optional',\n ai: 'optional',\n i18n: 'optional',\n ui: 'optional',\n workflow: 'optional',\n} as const;\n\n// ==========================================\n// Service Capabilities\n// ==========================================\n\n/**\n * Describes the availability and health of a service\n */\nexport const ServiceStatusSchema = z.object({\n name: CoreServiceName,\n enabled: z.boolean(),\n status: z.enum(['running', 'stopped', 'degraded', 'initializing']),\n version: z.string().optional(),\n provider: z.string().optional().describe('Implementation provider (e.g. \"s3\" for storage)'),\n features: z.array(z.string()).optional().describe('List of supported sub-features'),\n});\n\n/**\n * The Contract definition for what the Kernel MUST expose\n * map<ServiceName, ServiceInstance>\n */\nexport const KernelServiceMapSchema = z.record(\n CoreServiceName, \n z.unknown().describe('Service Instance implementing the protocol interface')\n);\n\n// ==========================================\n// Service Interfaces (Stub definitions)\n// ==========================================\n// Ideally, we would define strict Typescript interfaces here \n// for what methods each service must expose to the Registry.\n// For Zod, we primarily validate configuration and status.\n\n// e.g.\nexport const ServiceConfigSchema = z.object({\n id: z.string(),\n name: CoreServiceName,\n options: z.record(z.string(), z.unknown()).optional(),\n});\n","// Copyright (c) 2025 ObjectStack. Licensed under the Apache-2.0 license.\n\nimport { z } from 'zod';\nimport { HttpMethod } from '../shared/http.zod';\nimport { MiddlewareConfigSchema } from '../system/http-server.zod';\n\n/**\n * REST API Plugin Protocol\n * \n * Defines the schema for REST API plugins that register Discovery, Metadata,\n * Data CRUD, Batch, and Permission routes with the HTTP Dispatcher.\n * \n * This plugin type implements Phase 2 of the API Protocol implementation plan,\n * providing standardized REST endpoints with:\n * - Request validation middleware using Zod schemas\n * - Response envelope wrapping with BaseResponseSchema\n * - Error handling using ApiErrorSchema\n * - OpenAPI documentation auto-generation\n * \n * Features:\n * - Route registration for core API endpoints\n * - Automatic schema-based validation\n * - Standardized request/response envelopes\n * - OpenAPI/Swagger documentation generation\n * \n * Architecture Alignment:\n * - Salesforce: REST API with metadata and data CRUD\n * - Microsoft Dynamics: Web API with entity operations\n * - Strapi: Auto-generated REST endpoints from schemas\n * \n * @example Plugin Manifest\n * ```typescript\n * {\n * \"name\": \"rest_api\",\n * \"version\": \"1.0.0\",\n * \"type\": \"server\",\n * \"contributes\": {\n * \"routes\": [\n * {\n * \"prefix\": \"/api/v1/discovery\",\n * \"service\": \"metadata\",\n * \"methods\": [\"getDiscovery\"],\n * \"middleware\": [\n * { \"name\": \"response_envelope\", \"type\": \"transformation\", \"enabled\": true }\n * ]\n * },\n * {\n * \"prefix\": \"/api/v1/meta\",\n * \"service\": \"metadata\",\n * \"methods\": [\"getMetaTypes\", \"getMetaItems\", \"getMetaItem\", \"saveMetaItem\"],\n * \"middleware\": [\n * { \"name\": \"auth\", \"type\": \"authentication\", \"enabled\": true },\n * { \"name\": \"request_validation\", \"type\": \"validation\", \"enabled\": true }\n * ]\n * },\n * {\n * \"prefix\": \"/api/v1/data\",\n * \"service\": \"data\",\n * \"methods\": [\"findData\", \"getData\", \"createData\", \"updateData\", \"deleteData\"]\n * }\n * ]\n * }\n * }\n * ```\n */\n\n// ==========================================\n// REST API Route Categories\n// ==========================================\n\n/**\n * REST API Route Category Enum\n * Categorizes REST API routes by their primary function\n */\nexport const RestApiRouteCategory = z.enum([\n 'discovery', // API discovery and capabilities\n 'metadata', // Metadata operations (objects, fields, views)\n 'data', // Data CRUD operations\n 'batch', // Batch/bulk operations\n 'permission', // Permission/authorization checks\n 'analytics', // Analytics and reporting\n 'automation', // Automation triggers and flows\n 'workflow', // Workflow state management\n 'ui', // UI metadata (views, layouts)\n 'realtime', // Realtime/WebSocket\n 'notification', // Notification management\n 'ai', // AI operations (NLQ, chat)\n 'i18n', // Internationalization\n]);\n\nexport type RestApiRouteCategory = z.infer<typeof RestApiRouteCategory>;\n\n// ==========================================\n// Route Registration Schema\n// ==========================================\n\n/**\n * REST API Endpoint Schema\n * Defines a single REST API endpoint with its metadata\n * \n * @example Discovery Endpoint\n * {\n * \"method\": \"GET\",\n * \"path\": \"/api/v1/discovery\",\n * \"handler\": \"getDiscovery\",\n * \"category\": \"discovery\",\n * \"public\": true,\n * \"description\": \"Get API discovery information\"\n * }\n */\nexport const RestApiEndpointSchema = z.object({\n /**\n * HTTP method\n */\n method: HttpMethod.describe('HTTP method for this endpoint'),\n \n /**\n * URL path pattern (supports parameters like :id)\n */\n path: z.string().describe('URL path pattern (e.g., /api/v1/data/:object/:id)'),\n \n /**\n * Handler reference (protocol method name)\n */\n handler: z.string().describe('Protocol method name or handler identifier'),\n \n /**\n * Route category\n */\n category: RestApiRouteCategory.describe('Route category'),\n \n /**\n * Whether endpoint is publicly accessible (no auth required)\n */\n public: z.boolean().default(false).describe('Is publicly accessible without authentication'),\n \n /**\n * Required permissions\n */\n permissions: z.array(z.string()).optional().describe('Required permissions (e.g., [\"data.read\", \"object.account.read\"])'),\n \n /**\n * OpenAPI documentation metadata\n */\n summary: z.string().optional().describe('Short description for OpenAPI'),\n description: z.string().optional().describe('Detailed description for OpenAPI'),\n tags: z.array(z.string()).optional().describe('OpenAPI tags for grouping'),\n \n /**\n * Request/Response schema references\n */\n requestSchema: z.string().optional().describe('Request schema name (for validation)'),\n responseSchema: z.string().optional().describe('Response schema name (for documentation)'),\n \n /**\n * Performance and reliability settings\n */\n timeout: z.number().int().optional().describe('Request timeout in milliseconds'),\n rateLimit: z.string().optional().describe('Rate limit policy name'),\n cacheable: z.boolean().default(false).describe('Whether response can be cached'),\n cacheTtl: z.number().int().optional().describe('Cache TTL in seconds'),\n});\n\nexport type RestApiEndpoint = z.infer<typeof RestApiEndpointSchema>;\n\n/**\n * REST API Route Registration Schema\n * Registers a group of related endpoints under a common prefix\n * \n * @example Data CRUD Routes\n * {\n * \"prefix\": \"/api/v1/data\",\n * \"service\": \"data\",\n * \"category\": \"data\",\n * \"endpoints\": [\n * { \"method\": \"GET\", \"path\": \"/:object\", \"handler\": \"findData\" },\n * { \"method\": \"GET\", \"path\": \"/:object/:id\", \"handler\": \"getData\" },\n * { \"method\": \"POST\", \"path\": \"/:object\", \"handler\": \"createData\" },\n * { \"method\": \"PATCH\", \"path\": \"/:object/:id\", \"handler\": \"updateData\" },\n * { \"method\": \"DELETE\", \"path\": \"/:object/:id\", \"handler\": \"deleteData\" }\n * ],\n * \"middleware\": [\n * { \"name\": \"auth\", \"type\": \"authentication\", \"enabled\": true },\n * { \"name\": \"validation\", \"type\": \"validation\", \"enabled\": true },\n * { \"name\": \"response_envelope\", \"type\": \"transformation\", \"enabled\": true }\n * ]\n * }\n */\nexport const RestApiRouteRegistrationSchema = z.object({\n /**\n * URL prefix for this route group (e.g., /api/v1/data)\n */\n prefix: z.string().regex(/^\\//).describe('URL path prefix for this route group'),\n \n /**\n * Service name that handles these routes\n */\n service: z.string().describe('Core service name (metadata, data, auth, etc.)'),\n \n /**\n * Route category\n */\n category: RestApiRouteCategory.describe('Primary category for this route group'),\n \n /**\n * Protocol methods implemented\n */\n methods: z.array(z.string()).optional().describe('Protocol method names implemented'),\n \n /**\n * Detailed endpoint definitions\n */\n endpoints: z.array(RestApiEndpointSchema).optional().describe('Endpoint definitions'),\n \n /**\n * Middleware applied to all routes in this group\n */\n middleware: z.array(MiddlewareConfigSchema).optional().describe('Middleware stack for this route group'),\n \n /**\n * Whether authentication is required for all routes\n */\n authRequired: z.boolean().default(true).describe('Whether authentication is required by default'),\n \n /**\n * OpenAPI documentation\n */\n documentation: z.object({\n title: z.string().optional().describe('Route group title'),\n description: z.string().optional().describe('Route group description'),\n tags: z.array(z.string()).optional().describe('OpenAPI tags'),\n }).optional().describe('Documentation metadata for this route group'),\n});\n\nexport type RestApiRouteRegistration = z.infer<typeof RestApiRouteRegistrationSchema>;\n\n// ==========================================\n// Request Validation Configuration\n// ==========================================\n\n/**\n * Request Validation Mode Enum\n * Defines how validation errors are handled\n */\nexport const ValidationMode = z.enum([\n 'strict', // Reject requests with validation errors (400 Bad Request)\n 'permissive', // Log validation errors but allow request to proceed\n 'strip', // Remove invalid fields and continue with valid data\n]);\n\nexport type ValidationMode = z.infer<typeof ValidationMode>;\n\n/**\n * Request Validation Configuration Schema\n * Configures Zod-based request validation middleware\n * \n * @example\n * {\n * \"enabled\": true,\n * \"mode\": \"strict\",\n * \"validateBody\": true,\n * \"validateQuery\": true,\n * \"validateParams\": true,\n * \"includeFieldErrors\": true\n * }\n */\nexport const RequestValidationConfigSchema = z.object({\n /**\n * Enable request validation\n */\n enabled: z.boolean().default(true).describe('Enable automatic request validation'),\n \n /**\n * Validation mode\n */\n mode: ValidationMode.default('strict').describe('How to handle validation errors'),\n \n /**\n * Validate request body\n */\n validateBody: z.boolean().default(true).describe('Validate request body against schema'),\n \n /**\n * Validate query parameters\n */\n validateQuery: z.boolean().default(true).describe('Validate query string parameters'),\n \n /**\n * Validate URL parameters\n */\n validateParams: z.boolean().default(true).describe('Validate URL path parameters'),\n \n /**\n * Validate request headers\n */\n validateHeaders: z.boolean().default(false).describe('Validate request headers'),\n \n /**\n * Include detailed field errors in response\n */\n includeFieldErrors: z.boolean().default(true).describe('Include field-level error details in response'),\n \n /**\n * Custom error message prefix\n */\n errorPrefix: z.string().optional().describe('Custom prefix for validation error messages'),\n \n /**\n * Schema registry reference\n */\n schemaRegistry: z.string().optional().describe('Schema registry name to use for validation'),\n});\n\nexport type RequestValidationConfig = z.infer<typeof RequestValidationConfigSchema>;\nexport type RequestValidationConfigInput = z.input<typeof RequestValidationConfigSchema>;\n\n// ==========================================\n// Response Envelope Configuration\n// ==========================================\n\n/**\n * Response Envelope Configuration Schema\n * Configures automatic response wrapping with BaseResponseSchema\n * \n * @example\n * {\n * \"enabled\": true,\n * \"includeMetadata\": true,\n * \"includeTimestamp\": true,\n * \"includeRequestId\": true,\n * \"includeDuration\": true\n * }\n */\nexport const ResponseEnvelopeConfigSchema = z.object({\n /**\n * Enable response envelope wrapping\n */\n enabled: z.boolean().default(true).describe('Enable automatic response envelope wrapping'),\n \n /**\n * Include metadata object\n */\n includeMetadata: z.boolean().default(true).describe('Include meta object in responses'),\n \n /**\n * Include timestamp in metadata\n */\n includeTimestamp: z.boolean().default(true).describe('Include timestamp in response metadata'),\n \n /**\n * Include request ID in metadata\n */\n includeRequestId: z.boolean().default(true).describe('Include requestId in response metadata'),\n \n /**\n * Include request duration in metadata\n */\n includeDuration: z.boolean().default(false).describe('Include request duration in ms'),\n \n /**\n * Include trace ID for distributed tracing\n */\n includeTraceId: z.boolean().default(false).describe('Include distributed traceId'),\n \n /**\n * Custom metadata fields\n */\n customMetadata: z.record(z.string(), z.unknown()).optional().describe('Additional metadata fields to include'),\n \n /**\n * Whether to wrap already-wrapped responses\n */\n skipIfWrapped: z.boolean().default(true).describe('Skip wrapping if response already has success field'),\n});\n\nexport type ResponseEnvelopeConfig = z.infer<typeof ResponseEnvelopeConfigSchema>;\nexport type ResponseEnvelopeConfigInput = z.input<typeof ResponseEnvelopeConfigSchema>;\n\n// ==========================================\n// Error Handling Configuration\n// ==========================================\n\n/**\n * Error Handling Configuration Schema\n * Configures error handling and ApiErrorSchema formatting\n * \n * @example\n * {\n * \"enabled\": true,\n * \"includeStackTrace\": false,\n * \"logErrors\": true,\n * \"exposeInternalErrors\": false,\n * \"customErrorMessages\": {\n * \"validation_error\": \"The request data is invalid. Please check your input.\"\n * }\n * }\n */\nexport const ErrorHandlingConfigSchema = z.object({\n /**\n * Enable standardized error handling\n */\n enabled: z.boolean().default(true).describe('Enable standardized error handling'),\n \n /**\n * Include stack traces in error responses (dev only)\n */\n includeStackTrace: z.boolean().default(false).describe('Include stack traces in error responses'),\n \n /**\n * Log errors to logger\n */\n logErrors: z.boolean().default(true).describe('Log errors to system logger'),\n \n /**\n * Expose internal error details\n */\n exposeInternalErrors: z.boolean().default(false).describe('Expose internal error details in responses'),\n \n /**\n * Include request ID in errors\n */\n includeRequestId: z.boolean().default(true).describe('Include requestId in error responses'),\n \n /**\n * Include timestamp in errors\n */\n includeTimestamp: z.boolean().default(true).describe('Include timestamp in error responses'),\n \n /**\n * Include error documentation URLs\n */\n includeDocumentation: z.boolean().default(true).describe('Include documentation URLs for errors'),\n \n /**\n * Documentation base URL\n */\n documentationBaseUrl: z.string().url().optional().describe('Base URL for error documentation'),\n \n /**\n * Custom error messages by code\n */\n customErrorMessages: z.record(z.string(), z.string()).optional()\n .describe('Custom error messages by error code'),\n \n /**\n * Sensitive fields to redact from error details\n */\n redactFields: z.array(z.string()).optional().describe('Field names to redact from error details'),\n});\n\nexport type ErrorHandlingConfig = z.infer<typeof ErrorHandlingConfigSchema>;\nexport type ErrorHandlingConfigInput = z.input<typeof ErrorHandlingConfigSchema>;\n\n// ==========================================\n// OpenAPI Documentation Configuration\n// ==========================================\n\n/**\n * OpenAPI Generation Configuration Schema\n * Configures automatic OpenAPI documentation generation\n * \n * @example\n * {\n * \"enabled\": true,\n * \"version\": \"3.0.0\",\n * \"title\": \"ObjectStack API\",\n * \"description\": \"ObjectStack REST API\",\n * \"outputPath\": \"/api/docs/openapi.json\",\n * \"uiPath\": \"/api/docs\",\n * \"includeInternal\": false,\n * \"generateSchemas\": true\n * }\n */\nexport const OpenApiGenerationConfigSchema = z.object({\n /**\n * Enable OpenAPI generation\n */\n enabled: z.boolean().default(true).describe('Enable automatic OpenAPI documentation generation'),\n \n /**\n * OpenAPI specification version\n */\n version: z.enum(['3.0.0', '3.0.1', '3.0.2', '3.0.3', '3.1.0']).default('3.0.3')\n .describe('OpenAPI specification version'),\n \n /**\n * API title\n */\n title: z.string().default('ObjectStack API').describe('API title'),\n \n /**\n * API description\n */\n description: z.string().optional().describe('API description'),\n \n /**\n * API version\n */\n apiVersion: z.string().default('1.0.0').describe('API version'),\n \n /**\n * Output path for OpenAPI spec\n */\n outputPath: z.string().default('/api/docs/openapi.json').describe('URL path to serve OpenAPI JSON'),\n \n /**\n * UI path for Swagger/Redoc\n */\n uiPath: z.string().default('/api/docs').describe('URL path to serve documentation UI'),\n \n /**\n * UI framework to use\n */\n uiFramework: z.enum(['swagger-ui', 'redoc', 'rapidoc', 'elements']).default('swagger-ui')\n .describe('Documentation UI framework'),\n \n /**\n * Include internal/admin endpoints\n */\n includeInternal: z.boolean().default(false).describe('Include internal endpoints in documentation'),\n \n /**\n * Generate JSON schemas from Zod\n */\n generateSchemas: z.boolean().default(true).describe('Auto-generate schemas from Zod definitions'),\n \n /**\n * Include examples in documentation\n */\n includeExamples: z.boolean().default(true).describe('Include request/response examples'),\n \n /**\n * Server URLs\n */\n servers: z.array(z.object({\n url: z.string().describe('Server URL'),\n description: z.string().optional().describe('Server description'),\n })).optional().describe('Server URLs for API'),\n \n /**\n * Contact information\n */\n contact: z.object({\n name: z.string().optional(),\n url: z.string().url().optional(),\n email: z.string().email().optional(),\n }).optional().describe('API contact information'),\n \n /**\n * License information\n */\n license: z.object({\n name: z.string().describe('License name'),\n url: z.string().url().optional().describe('License URL'),\n }).optional().describe('API license information'),\n \n /**\n * Security schemes\n */\n securitySchemes: z.record(z.string(), z.object({\n type: z.enum(['apiKey', 'http', 'oauth2', 'openIdConnect']),\n scheme: z.string().optional(),\n bearerFormat: z.string().optional(),\n })).optional().describe('Security scheme definitions'),\n});\n\nexport type OpenApiGenerationConfig = z.infer<typeof OpenApiGenerationConfigSchema>;\nexport type OpenApiGenerationConfigInput = z.input<typeof OpenApiGenerationConfigSchema>;\n\n// ==========================================\n// REST API Plugin Configuration\n// ==========================================\n\n/**\n * REST API Plugin Configuration Schema\n * Complete configuration for REST API plugin\n * \n * @example\n * {\n * \"enabled\": true,\n * \"basePath\": \"/api\",\n * \"version\": \"v1\",\n * \"routes\": [...],\n * \"validation\": { \"enabled\": true, \"mode\": \"strict\" },\n * \"responseEnvelope\": { \"enabled\": true, \"includeMetadata\": true },\n * \"errorHandling\": { \"enabled\": true, \"includeStackTrace\": false },\n * \"openApi\": { \"enabled\": true, \"title\": \"ObjectStack API\" }\n * }\n */\nexport const RestApiPluginConfigSchema = z.object({\n /**\n * Enable REST API plugin\n */\n enabled: z.boolean().default(true).describe('Enable REST API plugin'),\n \n /**\n * API base path\n */\n basePath: z.string().default('/api').describe('Base path for all API routes'),\n \n /**\n * API version\n */\n version: z.string().default('v1').describe('API version identifier'),\n \n /**\n * Route registrations\n */\n routes: z.array(RestApiRouteRegistrationSchema).describe('Route registrations'),\n \n /**\n * Request validation configuration\n */\n validation: RequestValidationConfigSchema.optional().describe('Request validation configuration'),\n \n /**\n * Response envelope configuration\n */\n responseEnvelope: ResponseEnvelopeConfigSchema.optional().describe('Response envelope configuration'),\n \n /**\n * Error handling configuration\n */\n errorHandling: ErrorHandlingConfigSchema.optional().describe('Error handling configuration'),\n \n /**\n * OpenAPI documentation configuration\n */\n openApi: OpenApiGenerationConfigSchema.optional().describe('OpenAPI documentation configuration'),\n \n /**\n * Global middleware applied to all routes\n */\n globalMiddleware: z.array(MiddlewareConfigSchema).optional().describe('Global middleware stack'),\n \n /**\n * CORS configuration\n */\n cors: z.object({\n enabled: z.boolean().default(true),\n origins: z.array(z.string()).optional(),\n methods: z.array(HttpMethod).optional(),\n credentials: z.boolean().default(true),\n }).optional().describe('CORS configuration'),\n \n /**\n * Performance settings\n */\n performance: z.object({\n enableCompression: z.boolean().default(true).describe('Enable response compression'),\n enableETag: z.boolean().default(true).describe('Enable ETag generation'),\n enableCaching: z.boolean().default(true).describe('Enable HTTP caching'),\n defaultCacheTtl: z.number().int().default(300).describe('Default cache TTL in seconds'),\n }).optional().describe('Performance optimization settings'),\n});\n\nexport type RestApiPluginConfig = z.infer<typeof RestApiPluginConfigSchema>;\nexport type RestApiPluginConfigInput = z.input<typeof RestApiPluginConfigSchema>;\n\n// ==========================================\n// Default Route Registrations\n// ==========================================\n\n/**\n * Default Discovery Routes\n * Standard routes for API discovery endpoint\n */\nexport const DEFAULT_DISCOVERY_ROUTES: RestApiRouteRegistration = {\n prefix: '/api/v1/discovery',\n service: 'metadata',\n category: 'discovery',\n methods: ['getDiscovery'],\n authRequired: false,\n endpoints: [{\n method: 'GET',\n path: '',\n handler: 'getDiscovery',\n category: 'discovery',\n public: true,\n summary: 'Get API discovery information',\n description: 'Returns API version, capabilities, and available routes',\n tags: ['Discovery'],\n responseSchema: 'GetDiscoveryResponseSchema',\n cacheable: true,\n cacheTtl: 3600, // Cache for 1 hour as discovery info rarely changes\n }],\n middleware: [\n { name: 'response_envelope', type: 'transformation', enabled: true, order: 100 },\n ],\n};\n\n/**\n * Default Metadata Routes\n * Standard routes for metadata operations\n * \n * Note: getMetaItemCached is not a separate endpoint - it's handled by the getMetaItem\n * endpoint with HTTP cache headers (ETag, If-None-Match, etc.) for conditional requests.\n */\nexport const DEFAULT_METADATA_ROUTES: RestApiRouteRegistration = {\n prefix: '/api/v1/meta',\n service: 'metadata',\n category: 'metadata',\n methods: ['getMetaTypes', 'getMetaItems', 'getMetaItem', 'saveMetaItem'],\n authRequired: true,\n endpoints: [\n {\n method: 'GET',\n path: '',\n handler: 'getMetaTypes',\n category: 'metadata',\n public: false,\n summary: 'List all metadata types',\n description: 'Returns available metadata types (object, field, view, etc.)',\n tags: ['Metadata'],\n responseSchema: 'GetMetaTypesResponseSchema',\n cacheable: true,\n cacheTtl: 3600,\n },\n {\n method: 'GET',\n path: '/:type',\n handler: 'getMetaItems',\n category: 'metadata',\n public: false,\n summary: 'List metadata items of a type',\n description: 'Returns all items of the specified metadata type',\n tags: ['Metadata'],\n responseSchema: 'GetMetaItemsResponseSchema',\n cacheable: true,\n cacheTtl: 3600,\n },\n {\n method: 'GET',\n path: '/:type/:name',\n handler: 'getMetaItem',\n category: 'metadata',\n public: false,\n summary: 'Get specific metadata item',\n description: 'Returns a specific metadata item by type and name',\n tags: ['Metadata'],\n requestSchema: 'GetMetaItemRequestSchema',\n responseSchema: 'GetMetaItemResponseSchema',\n cacheable: true,\n cacheTtl: 3600,\n },\n {\n method: 'PUT',\n path: '/:type/:name',\n handler: 'saveMetaItem',\n category: 'metadata',\n public: false,\n summary: 'Create or update metadata item',\n description: 'Creates or updates a metadata item',\n tags: ['Metadata'],\n requestSchema: 'SaveMetaItemRequestSchema',\n responseSchema: 'SaveMetaItemResponseSchema',\n permissions: ['metadata.write'],\n cacheable: false,\n },\n ],\n middleware: [\n { name: 'auth', type: 'authentication', enabled: true, order: 10 },\n { name: 'validation', type: 'validation', enabled: true, order: 20 },\n { name: 'response_envelope', type: 'transformation', enabled: true, order: 100 },\n ],\n};\n\n/**\n * Default Data CRUD Routes\n * Standard routes for data operations\n */\nexport const DEFAULT_DATA_CRUD_ROUTES: RestApiRouteRegistration = {\n prefix: '/api/v1/data',\n service: 'data',\n category: 'data',\n methods: ['findData', 'getData', 'createData', 'updateData', 'deleteData'],\n authRequired: true,\n endpoints: [\n {\n method: 'GET',\n path: '/:object',\n handler: 'findData',\n category: 'data',\n public: false,\n summary: 'Query records',\n description: 'Query records with filtering, sorting, and pagination',\n tags: ['Data'],\n requestSchema: 'FindDataRequestSchema',\n responseSchema: 'ListRecordResponseSchema',\n permissions: ['data.read'],\n cacheable: false,\n },\n {\n method: 'GET',\n path: '/:object/:id',\n handler: 'getData',\n category: 'data',\n public: false,\n summary: 'Get record by ID',\n description: 'Retrieve a single record by its ID',\n tags: ['Data'],\n requestSchema: 'IdRequestSchema',\n responseSchema: 'SingleRecordResponseSchema',\n permissions: ['data.read'],\n cacheable: false,\n },\n {\n method: 'POST',\n path: '/:object',\n handler: 'createData',\n category: 'data',\n public: false,\n summary: 'Create record',\n description: 'Create a new record',\n tags: ['Data'],\n requestSchema: 'CreateRequestSchema',\n responseSchema: 'SingleRecordResponseSchema',\n permissions: ['data.create'],\n cacheable: false,\n },\n {\n method: 'PATCH',\n path: '/:object/:id',\n handler: 'updateData',\n category: 'data',\n public: false,\n summary: 'Update record',\n description: 'Update an existing record',\n tags: ['Data'],\n requestSchema: 'UpdateRequestSchema',\n responseSchema: 'SingleRecordResponseSchema',\n permissions: ['data.update'],\n cacheable: false,\n },\n {\n method: 'DELETE',\n path: '/:object/:id',\n handler: 'deleteData',\n category: 'data',\n public: false,\n summary: 'Delete record',\n description: 'Delete a record by ID',\n tags: ['Data'],\n requestSchema: 'IdRequestSchema',\n responseSchema: 'DeleteResponseSchema',\n permissions: ['data.delete'],\n cacheable: false,\n },\n ],\n middleware: [\n { name: 'auth', type: 'authentication', enabled: true, order: 10 },\n { name: 'validation', type: 'validation', enabled: true, order: 20 },\n { name: 'response_envelope', type: 'transformation', enabled: true, order: 100 },\n { name: 'error_handler', type: 'error', enabled: true, order: 200 },\n ],\n};\n\n/**\n * Default Batch Routes\n * Standard routes for batch operations\n */\nexport const DEFAULT_BATCH_ROUTES: RestApiRouteRegistration = {\n prefix: '/api/v1/data/:object',\n service: 'data',\n category: 'batch',\n methods: ['batchData', 'createManyData', 'updateManyData', 'deleteManyData'],\n authRequired: true,\n endpoints: [\n {\n method: 'POST',\n path: '/batch',\n handler: 'batchData',\n category: 'batch',\n public: false,\n summary: 'Batch operation',\n description: 'Execute a batch operation (create, update, upsert, delete)',\n tags: ['Batch'],\n requestSchema: 'BatchUpdateRequestSchema',\n responseSchema: 'BatchUpdateResponseSchema',\n permissions: ['data.batch'],\n timeout: 60000, // 60 seconds for batch operations\n cacheable: false,\n },\n {\n method: 'POST',\n path: '/createMany',\n handler: 'createManyData',\n category: 'batch',\n public: false,\n summary: 'Batch create',\n description: 'Create multiple records in a single operation',\n tags: ['Batch'],\n requestSchema: 'CreateManyRequestSchema',\n responseSchema: 'BatchUpdateResponseSchema',\n permissions: ['data.create', 'data.batch'],\n timeout: 60000,\n cacheable: false,\n },\n {\n method: 'POST',\n path: '/updateMany',\n handler: 'updateManyData',\n category: 'batch',\n public: false,\n summary: 'Batch update',\n description: 'Update multiple records in a single operation',\n tags: ['Batch'],\n requestSchema: 'UpdateManyRequestSchema',\n responseSchema: 'BatchUpdateResponseSchema',\n permissions: ['data.update', 'data.batch'],\n timeout: 60000,\n cacheable: false,\n },\n {\n method: 'POST',\n path: '/deleteMany',\n handler: 'deleteManyData',\n category: 'batch',\n public: false,\n summary: 'Batch delete',\n description: 'Delete multiple records in a single operation',\n tags: ['Batch'],\n requestSchema: 'DeleteManyRequestSchema',\n responseSchema: 'BatchUpdateResponseSchema',\n permissions: ['data.delete', 'data.batch'],\n timeout: 60000,\n cacheable: false,\n },\n ],\n middleware: [\n { name: 'auth', type: 'authentication', enabled: true, order: 10 },\n { name: 'validation', type: 'validation', enabled: true, order: 20 },\n { name: 'response_envelope', type: 'transformation', enabled: true, order: 100 },\n { name: 'error_handler', type: 'error', enabled: true, order: 200 },\n ],\n};\n\n/**\n * Default Permission Routes\n * Standard routes for permission checking\n */\nexport const DEFAULT_PERMISSION_ROUTES: RestApiRouteRegistration = {\n prefix: '/api/v1/auth',\n service: 'auth',\n category: 'permission',\n methods: ['checkPermission', 'getObjectPermissions', 'getEffectivePermissions'],\n authRequired: true,\n endpoints: [\n {\n method: 'POST',\n path: '/check',\n handler: 'checkPermission',\n category: 'permission',\n public: false,\n summary: 'Check permission',\n description: 'Check if current user has a specific permission',\n tags: ['Permission'],\n requestSchema: 'CheckPermissionRequestSchema',\n responseSchema: 'CheckPermissionResponseSchema',\n cacheable: false,\n },\n {\n method: 'GET',\n path: '/permissions/:object',\n handler: 'getObjectPermissions',\n category: 'permission',\n public: false,\n summary: 'Get object permissions',\n description: 'Get all permissions for a specific object',\n tags: ['Permission'],\n responseSchema: 'ObjectPermissionsResponseSchema',\n cacheable: true,\n cacheTtl: 300,\n },\n {\n method: 'GET',\n path: '/permissions/effective',\n handler: 'getEffectivePermissions',\n category: 'permission',\n public: false,\n summary: 'Get effective permissions',\n description: 'Get all effective permissions for current user',\n tags: ['Permission'],\n responseSchema: 'EffectivePermissionsResponseSchema',\n cacheable: true,\n cacheTtl: 300,\n },\n ],\n middleware: [\n { name: 'auth', type: 'authentication', enabled: true, order: 10 },\n { name: 'response_envelope', type: 'transformation', enabled: true, order: 100 },\n ],\n};\n\n// ==========================================\n// View Management Routes\n// ==========================================\n\n/**\n * Default View Management Routes\n * Standard routes for UI view CRUD operations\n */\nexport const DEFAULT_VIEW_ROUTES: RestApiRouteRegistration = {\n prefix: '/api/v1/ui',\n service: 'ui',\n category: 'ui',\n methods: ['listViews', 'getView', 'createView', 'updateView', 'deleteView'],\n authRequired: true,\n endpoints: [\n {\n method: 'GET',\n path: '/views/:object',\n handler: 'listViews',\n category: 'ui',\n public: false,\n summary: 'List views for an object',\n description: 'Returns all views (list, form) for the specified object',\n tags: ['Views', 'UI'],\n responseSchema: 'ListViewsResponseSchema',\n cacheable: true,\n cacheTtl: 1800,\n },\n {\n method: 'GET',\n path: '/views/:object/:viewId',\n handler: 'getView',\n category: 'ui',\n public: false,\n summary: 'Get a specific view',\n description: 'Returns a specific view definition by object and view ID',\n tags: ['Views', 'UI'],\n responseSchema: 'GetViewResponseSchema',\n cacheable: true,\n cacheTtl: 1800,\n },\n {\n method: 'POST',\n path: '/views/:object',\n handler: 'createView',\n category: 'ui',\n public: false,\n summary: 'Create a new view',\n description: 'Creates a new view definition for the specified object',\n tags: ['Views', 'UI'],\n requestSchema: 'CreateViewRequestSchema',\n responseSchema: 'CreateViewResponseSchema',\n permissions: ['ui.view.create'],\n cacheable: false,\n },\n {\n method: 'PATCH',\n path: '/views/:object/:viewId',\n handler: 'updateView',\n category: 'ui',\n public: false,\n summary: 'Update a view',\n description: 'Updates an existing view definition',\n tags: ['Views', 'UI'],\n requestSchema: 'UpdateViewRequestSchema',\n responseSchema: 'UpdateViewResponseSchema',\n permissions: ['ui.view.update'],\n cacheable: false,\n },\n {\n method: 'DELETE',\n path: '/views/:object/:viewId',\n handler: 'deleteView',\n category: 'ui',\n public: false,\n summary: 'Delete a view',\n description: 'Deletes a view definition',\n tags: ['Views', 'UI'],\n responseSchema: 'DeleteViewResponseSchema',\n permissions: ['ui.view.delete'],\n cacheable: false,\n },\n ],\n middleware: [\n { name: 'auth', type: 'authentication', enabled: true, order: 10 },\n { name: 'validation', type: 'validation', enabled: true, order: 20 },\n { name: 'response_envelope', type: 'transformation', enabled: true, order: 100 },\n ],\n};\n\n// ==========================================\n// Workflow Routes\n// ==========================================\n\n/**\n * Default Workflow Routes\n * Standard routes for workflow state management and transitions\n */\nexport const DEFAULT_WORKFLOW_ROUTES: RestApiRouteRegistration = {\n prefix: '/api/v1/workflow',\n service: 'workflow',\n category: 'workflow',\n methods: ['getWorkflowConfig', 'getWorkflowState', 'workflowTransition', 'workflowApprove', 'workflowReject'],\n authRequired: true,\n endpoints: [\n {\n method: 'GET',\n path: '/:object/config',\n handler: 'getWorkflowConfig',\n category: 'workflow',\n public: false,\n summary: 'Get workflow configuration',\n description: 'Returns workflow rules and state machine configuration for an object',\n tags: ['Workflow'],\n responseSchema: 'GetWorkflowConfigResponseSchema',\n cacheable: true,\n cacheTtl: 3600,\n },\n {\n method: 'GET',\n path: '/:object/:recordId/state',\n handler: 'getWorkflowState',\n category: 'workflow',\n public: false,\n summary: 'Get workflow state',\n description: 'Returns current workflow state and available transitions for a record',\n tags: ['Workflow'],\n responseSchema: 'GetWorkflowStateResponseSchema',\n cacheable: false,\n },\n {\n method: 'POST',\n path: '/:object/:recordId/transition',\n handler: 'workflowTransition',\n category: 'workflow',\n public: false,\n summary: 'Execute workflow transition',\n description: 'Transitions a record to a new workflow state',\n tags: ['Workflow'],\n requestSchema: 'WorkflowTransitionRequestSchema',\n responseSchema: 'WorkflowTransitionResponseSchema',\n permissions: ['workflow.transition'],\n cacheable: false,\n },\n {\n method: 'POST',\n path: '/:object/:recordId/approve',\n handler: 'workflowApprove',\n category: 'workflow',\n public: false,\n summary: 'Approve workflow step',\n description: 'Approves a pending workflow approval step',\n tags: ['Workflow'],\n requestSchema: 'WorkflowApproveRequestSchema',\n responseSchema: 'WorkflowApproveResponseSchema',\n permissions: ['workflow.approve'],\n cacheable: false,\n },\n {\n method: 'POST',\n path: '/:object/:recordId/reject',\n handler: 'workflowReject',\n category: 'workflow',\n public: false,\n summary: 'Reject workflow step',\n description: 'Rejects a pending workflow approval step',\n tags: ['Workflow'],\n requestSchema: 'WorkflowRejectRequestSchema',\n responseSchema: 'WorkflowRejectResponseSchema',\n permissions: ['workflow.reject'],\n cacheable: false,\n },\n ],\n middleware: [\n { name: 'auth', type: 'authentication', enabled: true, order: 10 },\n { name: 'validation', type: 'validation', enabled: true, order: 20 },\n { name: 'response_envelope', type: 'transformation', enabled: true, order: 100 },\n { name: 'error_handler', type: 'error', enabled: true, order: 200 },\n ],\n};\n\n// ==========================================\n// Realtime Routes\n// ==========================================\n\n/**\n * Default Realtime Routes\n * Standard routes for realtime connection management and subscriptions\n */\nexport const DEFAULT_REALTIME_ROUTES: RestApiRouteRegistration = {\n prefix: '/api/v1/realtime',\n service: 'realtime',\n category: 'realtime',\n methods: ['realtimeConnect', 'realtimeDisconnect', 'realtimeSubscribe', 'realtimeUnsubscribe', 'setPresence', 'getPresence'],\n authRequired: true,\n endpoints: [\n {\n method: 'POST',\n path: '/connect',\n handler: 'realtimeConnect',\n category: 'realtime',\n public: false,\n summary: 'Establish realtime connection',\n description: 'Negotiates a realtime connection (WebSocket/SSE) and returns connection details',\n tags: ['Realtime'],\n requestSchema: 'RealtimeConnectRequestSchema',\n responseSchema: 'RealtimeConnectResponseSchema',\n cacheable: false,\n },\n {\n method: 'POST',\n path: '/disconnect',\n handler: 'realtimeDisconnect',\n category: 'realtime',\n public: false,\n summary: 'Close realtime connection',\n description: 'Closes an active realtime connection',\n tags: ['Realtime'],\n requestSchema: 'RealtimeDisconnectRequestSchema',\n responseSchema: 'RealtimeDisconnectResponseSchema',\n cacheable: false,\n },\n {\n method: 'POST',\n path: '/subscribe',\n handler: 'realtimeSubscribe',\n category: 'realtime',\n public: false,\n summary: 'Subscribe to channel',\n description: 'Subscribes to a realtime channel for receiving events',\n tags: ['Realtime'],\n requestSchema: 'RealtimeSubscribeRequestSchema',\n responseSchema: 'RealtimeSubscribeResponseSchema',\n cacheable: false,\n },\n {\n method: 'POST',\n path: '/unsubscribe',\n handler: 'realtimeUnsubscribe',\n category: 'realtime',\n public: false,\n summary: 'Unsubscribe from channel',\n description: 'Unsubscribes from a realtime channel',\n tags: ['Realtime'],\n requestSchema: 'RealtimeUnsubscribeRequestSchema',\n responseSchema: 'RealtimeUnsubscribeResponseSchema',\n cacheable: false,\n },\n {\n method: 'PUT',\n path: '/presence/:channel',\n handler: 'setPresence',\n category: 'realtime',\n public: false,\n summary: 'Set presence state',\n description: 'Sets the current user\\'s presence state in a channel',\n tags: ['Realtime'],\n requestSchema: 'SetPresenceRequestSchema',\n responseSchema: 'SetPresenceResponseSchema',\n cacheable: false,\n },\n {\n method: 'GET',\n path: '/presence/:channel',\n handler: 'getPresence',\n category: 'realtime',\n public: false,\n summary: 'Get channel presence',\n description: 'Returns all active members and their presence state in a channel',\n tags: ['Realtime'],\n responseSchema: 'GetPresenceResponseSchema',\n cacheable: false,\n },\n ],\n middleware: [\n { name: 'auth', type: 'authentication', enabled: true, order: 10 },\n { name: 'response_envelope', type: 'transformation', enabled: true, order: 100 },\n ],\n};\n\n// ==========================================\n// Notification Routes\n// ==========================================\n\n/**\n * Default Notification Routes\n * Standard routes for notification management (device registration, preferences, listing)\n */\nexport const DEFAULT_NOTIFICATION_ROUTES: RestApiRouteRegistration = {\n prefix: '/api/v1/notifications',\n service: 'notification',\n category: 'notification',\n methods: [\n 'registerDevice', 'unregisterDevice',\n 'getNotificationPreferences', 'updateNotificationPreferences',\n 'listNotifications', 'markNotificationsRead', 'markAllNotificationsRead',\n ],\n authRequired: true,\n endpoints: [\n {\n method: 'POST',\n path: '/devices',\n handler: 'registerDevice',\n category: 'notification',\n public: false,\n summary: 'Register device for push notifications',\n description: 'Registers a device token for receiving push notifications',\n tags: ['Notifications'],\n requestSchema: 'RegisterDeviceRequestSchema',\n responseSchema: 'RegisterDeviceResponseSchema',\n cacheable: false,\n },\n {\n method: 'DELETE',\n path: '/devices/:deviceId',\n handler: 'unregisterDevice',\n category: 'notification',\n public: false,\n summary: 'Unregister device',\n description: 'Removes a device from push notification registration',\n tags: ['Notifications'],\n responseSchema: 'UnregisterDeviceResponseSchema',\n cacheable: false,\n },\n {\n method: 'GET',\n path: '/preferences',\n handler: 'getNotificationPreferences',\n category: 'notification',\n public: false,\n summary: 'Get notification preferences',\n description: 'Returns current user notification preferences',\n tags: ['Notifications'],\n responseSchema: 'GetNotificationPreferencesResponseSchema',\n cacheable: false,\n },\n {\n method: 'PATCH',\n path: '/preferences',\n handler: 'updateNotificationPreferences',\n category: 'notification',\n public: false,\n summary: 'Update notification preferences',\n description: 'Updates user notification preferences',\n tags: ['Notifications'],\n requestSchema: 'UpdateNotificationPreferencesRequestSchema',\n responseSchema: 'UpdateNotificationPreferencesResponseSchema',\n cacheable: false,\n },\n {\n method: 'GET',\n path: '',\n handler: 'listNotifications',\n category: 'notification',\n public: false,\n summary: 'List notifications',\n description: 'Returns paginated list of notifications for the current user',\n tags: ['Notifications'],\n responseSchema: 'ListNotificationsResponseSchema',\n cacheable: false,\n },\n {\n method: 'POST',\n path: '/read',\n handler: 'markNotificationsRead',\n category: 'notification',\n public: false,\n summary: 'Mark notifications as read',\n description: 'Marks specific notifications as read by their IDs',\n tags: ['Notifications'],\n requestSchema: 'MarkNotificationsReadRequestSchema',\n responseSchema: 'MarkNotificationsReadResponseSchema',\n cacheable: false,\n },\n {\n method: 'POST',\n path: '/read/all',\n handler: 'markAllNotificationsRead',\n category: 'notification',\n public: false,\n summary: 'Mark all notifications as read',\n description: 'Marks all notifications as read for the current user',\n tags: ['Notifications'],\n responseSchema: 'MarkAllNotificationsReadResponseSchema',\n cacheable: false,\n },\n ],\n middleware: [\n { name: 'auth', type: 'authentication', enabled: true, order: 10 },\n { name: 'validation', type: 'validation', enabled: true, order: 20 },\n { name: 'response_envelope', type: 'transformation', enabled: true, order: 100 },\n ],\n};\n\n// ==========================================\n// AI Routes\n// ==========================================\n\n/**\n * Default AI Routes\n * Standard routes for AI operations (NLQ, Chat, Suggest, Insights)\n */\nexport const DEFAULT_AI_ROUTES: RestApiRouteRegistration = {\n prefix: '/api/v1/ai',\n service: 'ai',\n category: 'ai',\n methods: ['aiNlq', 'aiChat', 'aiSuggest', 'aiInsights'],\n authRequired: true,\n endpoints: [\n {\n method: 'POST',\n path: '/nlq',\n handler: 'aiNlq',\n category: 'ai',\n public: false,\n summary: 'Natural language query',\n description: 'Converts a natural language query to a structured query AST',\n tags: ['AI'],\n requestSchema: 'AiNlqRequestSchema',\n responseSchema: 'AiNlqResponseSchema',\n timeout: 30000,\n cacheable: false,\n },\n {\n method: 'POST',\n path: '/chat',\n handler: 'aiChat',\n category: 'ai',\n public: false,\n summary: 'AI chat interaction',\n description: 'Sends a message to the AI assistant and receives a response',\n tags: ['AI'],\n requestSchema: 'AiChatRequestSchema',\n responseSchema: 'AiChatResponseSchema',\n timeout: 60000,\n cacheable: false,\n },\n {\n method: 'POST',\n path: '/suggest',\n handler: 'aiSuggest',\n category: 'ai',\n public: false,\n summary: 'Get AI-powered suggestions',\n description: 'Returns AI-generated field value suggestions based on context',\n tags: ['AI'],\n requestSchema: 'AiSuggestRequestSchema',\n responseSchema: 'AiSuggestResponseSchema',\n timeout: 15000,\n cacheable: false,\n },\n {\n method: 'POST',\n path: '/insights',\n handler: 'aiInsights',\n category: 'ai',\n public: false,\n summary: 'Get AI-generated insights',\n description: 'Returns AI-generated insights (summaries, trends, anomalies, recommendations)',\n tags: ['AI'],\n requestSchema: 'AiInsightsRequestSchema',\n responseSchema: 'AiInsightsResponseSchema',\n timeout: 60000,\n cacheable: false,\n },\n ],\n middleware: [\n { name: 'auth', type: 'authentication', enabled: true, order: 10 },\n { name: 'validation', type: 'validation', enabled: true, order: 20 },\n { name: 'response_envelope', type: 'transformation', enabled: true, order: 100 },\n { name: 'error_handler', type: 'error', enabled: true, order: 200 },\n ],\n};\n\n// ==========================================\n// i18n Routes\n// ==========================================\n\n/**\n * Default i18n Routes\n * Standard routes for internationalization operations\n */\nexport const DEFAULT_I18N_ROUTES: RestApiRouteRegistration = {\n prefix: '/api/v1/i18n',\n service: 'i18n',\n category: 'i18n',\n methods: ['getLocales', 'getTranslations', 'getFieldLabels'],\n authRequired: true,\n endpoints: [\n {\n method: 'GET',\n path: '/locales',\n handler: 'getLocales',\n category: 'i18n',\n public: false,\n summary: 'Get available locales',\n description: 'Returns all available locales with their metadata',\n tags: ['i18n'],\n responseSchema: 'GetLocalesResponseSchema',\n cacheable: true,\n cacheTtl: 86400, // 24 hours — locales change very rarely\n },\n {\n method: 'GET',\n path: '/translations/:locale',\n handler: 'getTranslations',\n category: 'i18n',\n public: false,\n summary: 'Get translations for a locale',\n description: 'Returns translation strings for the specified locale and optional namespace',\n tags: ['i18n'],\n responseSchema: 'GetTranslationsResponseSchema',\n cacheable: true,\n cacheTtl: 3600,\n },\n {\n method: 'GET',\n path: '/labels/:object/:locale',\n handler: 'getFieldLabels',\n category: 'i18n',\n public: false,\n summary: 'Get translated field labels',\n description: 'Returns translated field labels, help text, and option labels for an object',\n tags: ['i18n'],\n responseSchema: 'GetFieldLabelsResponseSchema',\n cacheable: true,\n cacheTtl: 3600,\n },\n ],\n middleware: [\n { name: 'auth', type: 'authentication', enabled: true, order: 10 },\n { name: 'response_envelope', type: 'transformation', enabled: true, order: 100 },\n ],\n};\n\n// ==========================================\n// Analytics Routes\n// ==========================================\n\n/**\n * Default Analytics Routes\n * Standard routes for analytics and BI operations\n */\nexport const DEFAULT_ANALYTICS_ROUTES: RestApiRouteRegistration = {\n prefix: '/api/v1/analytics',\n service: 'analytics',\n category: 'analytics',\n methods: ['analyticsQuery', 'getAnalyticsMeta'],\n authRequired: true,\n endpoints: [\n {\n method: 'POST',\n path: '/query',\n handler: 'analyticsQuery',\n category: 'analytics',\n public: false,\n summary: 'Execute analytics query',\n description: 'Executes a structured analytics query against the semantic layer',\n tags: ['Analytics'],\n requestSchema: 'AnalyticsQueryRequestSchema',\n responseSchema: 'AnalyticsResultResponseSchema',\n permissions: ['analytics.query'],\n timeout: 120000, // 2 minutes for analytics queries\n cacheable: false,\n },\n {\n method: 'GET',\n path: '/meta',\n handler: 'getAnalyticsMeta',\n category: 'analytics',\n public: false,\n summary: 'Get analytics metadata',\n description: 'Returns available cubes, dimensions, measures, and segments',\n tags: ['Analytics'],\n responseSchema: 'AnalyticsMetadataResponseSchema',\n cacheable: true,\n cacheTtl: 3600,\n },\n ],\n middleware: [\n { name: 'auth', type: 'authentication', enabled: true, order: 10 },\n { name: 'validation', type: 'validation', enabled: true, order: 20 },\n { name: 'response_envelope', type: 'transformation', enabled: true, order: 100 },\n { name: 'error_handler', type: 'error', enabled: true, order: 200 },\n ],\n};\n\n// ==========================================\n// Automation Routes\n// ==========================================\n\n/**\n * Default Automation Routes\n * Standard routes for automation triggers\n */\nexport const DEFAULT_AUTOMATION_ROUTES: RestApiRouteRegistration = {\n prefix: '/api/v1/automation',\n service: 'automation',\n category: 'automation',\n methods: ['triggerAutomation'],\n authRequired: true,\n endpoints: [\n {\n method: 'POST',\n path: '/trigger',\n handler: 'triggerAutomation',\n category: 'automation',\n public: false,\n summary: 'Trigger automation',\n description: 'Triggers an automation flow or script by name',\n tags: ['Automation'],\n requestSchema: 'AutomationTriggerRequestSchema',\n responseSchema: 'AutomationTriggerResponseSchema',\n permissions: ['automation.trigger'],\n timeout: 120000, // 2 minutes for long-running automations\n cacheable: false,\n },\n ],\n middleware: [\n { name: 'auth', type: 'authentication', enabled: true, order: 10 },\n { name: 'validation', type: 'validation', enabled: true, order: 20 },\n { name: 'response_envelope', type: 'transformation', enabled: true, order: 100 },\n { name: 'error_handler', type: 'error', enabled: true, order: 200 },\n ],\n};\n\n// ==========================================\n// Helper Functions\n// ==========================================\n\n/**\n * Helper to create REST API plugin configuration\n */\nexport const RestApiPluginConfig = Object.assign(RestApiPluginConfigSchema, {\n create: <T extends z.input<typeof RestApiPluginConfigSchema>>(config: T) => config,\n});\n\n/**\n * Helper to create route registration\n */\nexport const RestApiRouteRegistration = Object.assign(RestApiRouteRegistrationSchema, {\n create: <T extends z.input<typeof RestApiRouteRegistrationSchema>>(registration: T) => registration,\n});\n\n/**\n * Get all default route registrations.\n * Returns the complete set of standard REST API routes covering all protocol namespaces.\n * \n * Route groups (13 total):\n * 1. Discovery - API capabilities and routing info\n * 2. Metadata - Object/field schema CRUD\n * 3. Data CRUD - Record operations\n * 4. Batch - Bulk operations\n * 5. Permission - Authorization checks\n * 6. Views - UI view CRUD\n * 7. Workflow - State machine transitions\n * 8. Realtime - WebSocket/SSE connections\n * 9. Notification - Push notifications and preferences\n * 10. AI - NLQ, chat, suggestions, insights\n * 11. i18n - Locales and translations\n * 12. Analytics - BI queries and metadata\n * 13. Automation - Trigger flows and scripts\n */\nexport function getDefaultRouteRegistrations(): RestApiRouteRegistration[] {\n return [\n DEFAULT_DISCOVERY_ROUTES,\n DEFAULT_METADATA_ROUTES,\n DEFAULT_DATA_CRUD_ROUTES,\n DEFAULT_BATCH_ROUTES,\n DEFAULT_PERMISSION_ROUTES,\n DEFAULT_VIEW_ROUTES,\n DEFAULT_WORKFLOW_ROUTES,\n DEFAULT_REALTIME_ROUTES,\n DEFAULT_NOTIFICATION_ROUTES,\n DEFAULT_AI_ROUTES,\n DEFAULT_I18N_ROUTES,\n DEFAULT_ANALYTICS_ROUTES,\n DEFAULT_AUTOMATION_ROUTES,\n ];\n}\n","// Copyright (c) 2025 ObjectStack. Licensed under the Apache-2.0 license.\n\nimport { z } from 'zod';\nimport { HttpMethod, CorsConfigSchema, RateLimitConfigSchema, StaticMountSchema } from '../shared/http.zod';\n\n/**\n * HTTP Server Protocol\n * \n * Defines the runtime HTTP server configuration and capabilities.\n * Provides abstractions for HTTP server implementations (Express, Fastify, Hono, etc.)\n * \n * Architecture alignment:\n * - Kubernetes: Service and Ingress resources\n * - AWS: API Gateway configuration\n * - Spring Boot: Application properties\n */\n\n// ==========================================\n// Server Configuration\n// ==========================================\n\n/**\n * HTTP Server Configuration Schema\n * Core configuration for HTTP server instances\n * \n * @example\n * {\n * \"port\": 3000,\n * \"host\": \"0.0.0.0\",\n * \"cors\": {\n * \"enabled\": true,\n * \"origins\": [\"http://localhost:3000\"]\n * },\n * \"compression\": true,\n * \"requestTimeout\": 30000\n * }\n */\nexport const HttpServerConfigSchema = z.object({\n /**\n * Server port number\n */\n port: z.number().int().min(1).max(65535).default(3000).describe('Port number to listen on'),\n \n /**\n * Server host address\n */\n host: z.string().default('0.0.0.0').describe('Host address to bind to'),\n \n /**\n * CORS configuration\n */\n cors: CorsConfigSchema.optional().describe('CORS configuration'),\n \n /**\n * Request handling options\n */\n requestTimeout: z.number().int().default(30000).describe('Request timeout in milliseconds'),\n bodyLimit: z.string().default('10mb').describe('Maximum request body size'),\n \n /**\n * Compression settings\n */\n compression: z.boolean().default(true).describe('Enable response compression'),\n \n /**\n * Security headers\n */\n security: z.object({\n helmet: z.boolean().default(true).describe('Enable security headers via helmet'),\n rateLimit: RateLimitConfigSchema.optional().describe('Global rate limiting configuration'),\n }).optional().describe('Security configuration'),\n \n /**\n * Static file serving\n */\n static: z.array(StaticMountSchema).optional().describe('Static file serving configuration'),\n \n /**\n * Trust proxy settings\n */\n trustProxy: z.boolean().default(false).describe('Trust X-Forwarded-* headers'),\n});\n\nexport type HttpServerConfig = z.infer<typeof HttpServerConfigSchema>;\nexport type HttpServerConfigInput = z.input<typeof HttpServerConfigSchema>;\n\n// ==========================================\n// Route Registration\n// ==========================================\n\n/**\n * Route Handler Metadata Schema\n * Metadata for route handlers used in registration\n */\nexport const RouteHandlerMetadataSchema = z.object({\n /**\n * HTTP method\n */\n method: HttpMethod.describe('HTTP method'),\n \n /**\n * URL path pattern (supports parameters like /api/users/:id)\n */\n path: z.string().describe('URL path pattern'),\n \n /**\n * Handler function name or identifier\n */\n handler: z.string().describe('Handler identifier or name'),\n \n /**\n * Route metadata\n */\n metadata: z.object({\n summary: z.string().optional().describe('Route summary for documentation'),\n description: z.string().optional().describe('Route description'),\n tags: z.array(z.string()).optional().describe('Tags for grouping'),\n operationId: z.string().optional().describe('Unique operation identifier'),\n }).optional(),\n \n /**\n * Security requirements\n */\n security: z.object({\n authRequired: z.boolean().default(true).describe('Require authentication'),\n permissions: z.array(z.string()).optional().describe('Required permissions'),\n rateLimit: z.string().optional().describe('Rate limit policy override'),\n }).optional(),\n});\n\nexport type RouteHandlerMetadata = z.infer<typeof RouteHandlerMetadataSchema>;\nexport type RouteHandlerMetadataInput = z.input<typeof RouteHandlerMetadataSchema>;\n\n// ==========================================\n// Middleware Configuration\n// ==========================================\n\n/**\n * Middleware Type Enum\n */\nexport const MiddlewareType = z.enum([\n 'authentication', // Authentication middleware\n 'authorization', // Authorization/permission checks\n 'logging', // Request/response logging\n 'validation', // Input validation\n 'transformation', // Request/response transformation\n 'error', // Error handling\n 'custom', // Custom middleware\n]);\n\nexport type MiddlewareType = z.infer<typeof MiddlewareType>;\n\n/**\n * Middleware Configuration Schema\n * Defines middleware execution order and configuration\n * \n * @example\n * {\n * \"name\": \"auth_middleware\",\n * \"type\": \"authentication\",\n * \"enabled\": true,\n * \"order\": 10,\n * \"config\": {\n * \"jwtSecret\": \"secret\",\n * \"excludePaths\": [\"/health\", \"/metrics\"]\n * }\n * }\n */\nexport const MiddlewareConfigSchema = z.object({\n /**\n * Middleware identifier\n */\n name: z.string().regex(/^[a-z_][a-z0-9_]*$/).describe('Middleware name (snake_case)'),\n \n /**\n * Middleware type\n */\n type: MiddlewareType.describe('Middleware type'),\n \n /**\n * Enable/disable middleware\n */\n enabled: z.boolean().default(true).describe('Whether middleware is enabled'),\n \n /**\n * Execution order (lower numbers execute first)\n */\n order: z.number().int().default(100).describe('Execution order priority'),\n \n /**\n * Middleware-specific configuration\n */\n config: z.record(z.string(), z.unknown()).optional().describe('Middleware configuration object'),\n \n /**\n * Path patterns to apply middleware to\n */\n paths: z.object({\n include: z.array(z.string()).optional().describe('Include path patterns (glob)'),\n exclude: z.array(z.string()).optional().describe('Exclude path patterns (glob)'),\n }).optional().describe('Path filtering'),\n});\n\nexport type MiddlewareConfig = z.infer<typeof MiddlewareConfigSchema>;\nexport type MiddlewareConfigInput = z.input<typeof MiddlewareConfigSchema>;\n\n// ==========================================\n// Server Lifecycle Events\n// ==========================================\n\n/**\n * Server Event Type Enum\n */\nexport const ServerEventType = z.enum([\n 'starting', // Server is starting\n 'started', // Server has started and is listening\n 'stopping', // Server is stopping\n 'stopped', // Server has stopped\n 'request', // Request received\n 'response', // Response sent\n 'error', // Error occurred\n]);\n\nexport type ServerEventType = z.infer<typeof ServerEventType>;\n\n/**\n * Server Event Schema\n * Events emitted by the HTTP server during lifecycle\n */\nexport const ServerEventSchema = z.object({\n /**\n * Event type\n */\n type: ServerEventType.describe('Event type'),\n \n /**\n * Timestamp\n */\n timestamp: z.string().datetime().describe('Event timestamp (ISO 8601)'),\n \n /**\n * Event payload\n */\n data: z.record(z.string(), z.unknown()).optional().describe('Event-specific data'),\n});\n\nexport type ServerEvent = z.infer<typeof ServerEventSchema>;\n\n// ==========================================\n// Server Capability Declaration\n// ==========================================\n\n/**\n * Server Capabilities Schema\n * Declares what features a server implementation supports\n */\nexport const ServerCapabilitiesSchema = z.object({\n /**\n * Supported HTTP versions\n */\n httpVersions: z.array(z.enum(['1.0', '1.1', '2.0', '3.0'])).default(['1.1']).describe('Supported HTTP versions'),\n \n /**\n * WebSocket support\n */\n websocket: z.boolean().default(false).describe('WebSocket support'),\n \n /**\n * Server-Sent Events support\n */\n sse: z.boolean().default(false).describe('Server-Sent Events support'),\n \n /**\n * HTTP/2 Server Push\n */\n serverPush: z.boolean().default(false).describe('HTTP/2 Server Push support'),\n \n /**\n * Streaming support\n */\n streaming: z.boolean().default(true).describe('Response streaming support'),\n \n /**\n * Middleware support\n */\n middleware: z.boolean().default(true).describe('Middleware chain support'),\n \n /**\n * Route parameterization\n */\n routeParams: z.boolean().default(true).describe('URL parameter support (/users/:id)'),\n \n /**\n * Built-in compression\n */\n compression: z.boolean().default(true).describe('Built-in compression support'),\n});\n\nexport type ServerCapabilities = z.infer<typeof ServerCapabilitiesSchema>;\nexport type ServerCapabilitiesInput = z.input<typeof ServerCapabilitiesSchema>;\n\n// ==========================================\n// Server Status & Metrics\n// ==========================================\n\n/**\n * Server Status Schema\n * Current operational status of the server\n */\nexport const ServerStatusSchema = z.object({\n /**\n * Server state\n */\n state: z.enum(['stopped', 'starting', 'running', 'stopping', 'error']).describe('Current server state'),\n \n /**\n * Uptime in milliseconds\n */\n uptime: z.number().int().optional().describe('Server uptime in milliseconds'),\n \n /**\n * Server information\n */\n server: z.object({\n port: z.number().int().describe('Listening port'),\n host: z.string().describe('Bound host'),\n url: z.string().optional().describe('Full server URL'),\n }).optional(),\n \n /**\n * Connection metrics\n */\n connections: z.object({\n active: z.number().int().describe('Active connections'),\n total: z.number().int().describe('Total connections handled'),\n }).optional(),\n \n /**\n * Request metrics\n */\n requests: z.object({\n total: z.number().int().describe('Total requests processed'),\n success: z.number().int().describe('Successful requests'),\n errors: z.number().int().describe('Failed requests'),\n }).optional(),\n});\n\nexport type ServerStatus = z.infer<typeof ServerStatusSchema>;\n\n// ==========================================\n// Helper Functions\n// ==========================================\n\n/**\n * Helper to create HTTP server configuration\n */\nexport const HttpServerConfig = Object.assign(HttpServerConfigSchema, {\n create: <T extends z.input<typeof HttpServerConfigSchema>>(config: T) => config,\n});\n\n/**\n * Helper to create middleware configuration\n */\nexport const MiddlewareConfig = Object.assign(MiddlewareConfigSchema, {\n create: <T extends z.input<typeof MiddlewareConfigSchema>>(config: T) => config,\n});\n","// Copyright (c) 2025 ObjectStack. Licensed under the Apache-2.0 license.\n\nimport { z } from 'zod';\n\n/**\n * API Query DSL Adapter Protocol\n * \n * Defines mapping rules between the internal unified query DSL\n * (defined in `data/query.zod.ts`) and external API protocol formats:\n * REST, GraphQL, and OData.\n * \n * This enables ObjectStack to expose a single internal query representation\n * while supporting multiple API standards for external consumers.\n * \n * @see data/query.zod.ts - Unified internal query DSL\n * @see api/rest-server.zod.ts - REST API configuration\n * @see api/graphql.zod.ts - GraphQL API configuration\n * @see api/odata.zod.ts - OData API configuration\n */\n\n// ==========================================\n// 1. Shared Adapter Types\n// ==========================================\n\n/**\n * Query Adapter Target Protocol\n */\nexport const QueryAdapterTargetSchema = z.enum([\n 'rest', // REST API (?filter[field][op]=value)\n 'graphql', // GraphQL (where: \\{ field: \\{ op: value \\}\\})\n 'odata', // OData ($filter=field op value)\n]);\n\nexport type QueryAdapterTarget = z.infer<typeof QueryAdapterTargetSchema>;\n\n/**\n * Operator Mapping Entry\n * \n * Maps a unified DSL operator to its protocol-specific syntax.\n */\nexport const OperatorMappingSchema = z.object({\n /** Unified DSL operator (e.g., 'eq', 'gt', 'contains') */\n operator: z.string().describe('Unified DSL operator'),\n\n /** REST query parameter format (e.g., 'filter[{field}][{op}]') */\n rest: z.string().optional().describe('REST query parameter template'),\n\n /** GraphQL where clause format (e.g., '{field}: { {op}: $value }') */\n graphql: z.string().optional().describe('GraphQL where clause template'),\n\n /** OData $filter expression format (e.g., '{field} {op} {value}') */\n odata: z.string().optional().describe('OData $filter expression template'),\n});\n\nexport type OperatorMapping = z.infer<typeof OperatorMappingSchema>;\n\n// ==========================================\n// 2. REST Adapter Configuration\n// ==========================================\n\n/**\n * REST Query Adapter Configuration\n * \n * Defines how unified query DSL maps to REST query parameters.\n * \n * @example\n * Unified: { filters: [['status', '=', 'active']], top: 10 }\n * REST: ?filter[status][eq]=active&limit=10\n */\nexport const RestQueryAdapterSchema = z.object({\n /** Filter parameter style */\n filterStyle: z.enum([\n 'bracket', // ?filter[field][op]=value (JSON API style)\n 'dot', // ?filter.field.op=value\n 'flat', // ?field=value (simple equality)\n 'rsql', // ?filter=field==value;field=gt=10 (RSQL / FIQL)\n ]).default('bracket').describe('REST filter parameter encoding style'),\n\n /** Pagination parameter names */\n pagination: z.object({\n /** Page size parameter name */\n limitParam: z.string().default('limit').describe('Page size parameter name'),\n\n /** Offset parameter name */\n offsetParam: z.string().default('offset').describe('Offset parameter name'),\n\n /** Cursor parameter name (for cursor-based pagination) */\n cursorParam: z.string().default('cursor').describe('Cursor parameter name'),\n\n /** Page number parameter name (for page-based pagination) */\n pageParam: z.string().default('page').describe('Page number parameter name'),\n }).optional().describe('Pagination parameter name mappings'),\n\n /** Sort parameter name and format */\n sorting: z.object({\n /** Sort parameter name */\n param: z.string().default('sort').describe('Sort parameter name'),\n\n /** Sort format */\n format: z.enum([\n 'comma', // ?sort=field1,-field2\n 'array', // ?sort[]=field1&sort[]=-field2\n 'pipe', // ?sort=field1|asc,field2|desc\n ]).default('comma').describe('Sort parameter encoding format'),\n }).optional().describe('Sort parameter mapping'),\n\n /** Field selection parameter name */\n fieldsParam: z.string().default('fields').describe('Field selection parameter name'),\n});\n\nexport type RestQueryAdapter = z.infer<typeof RestQueryAdapterSchema>;\nexport type RestQueryAdapterInput = z.input<typeof RestQueryAdapterSchema>;\n\n// ==========================================\n// 3. GraphQL Adapter Configuration\n// ==========================================\n\n/**\n * GraphQL Query Adapter Configuration\n * \n * Defines how unified query DSL maps to GraphQL arguments.\n * \n * @example\n * Unified: { filters: [['status', '=', 'active']], top: 10, sort: [{ field: 'name', order: 'asc' }] }\n * GraphQL: query { items(where: { status: { eq: \"active\" } }, limit: 10, orderBy: { name: ASC }) { ... } }\n */\nexport const GraphQLQueryAdapterSchema = z.object({\n /** Filter argument name in GraphQL queries */\n filterArgName: z.string().default('where').describe('GraphQL filter argument name'),\n\n /** Filter nesting style */\n filterStyle: z.enum([\n 'nested', // where: { field: { op: value } } (Prisma style)\n 'flat', // where: { field_op: value } (Hasura style)\n 'array', // where: [{ field, op, value }] (Array of conditions)\n ]).default('nested').describe('GraphQL filter nesting style'),\n\n /** Pagination argument names */\n pagination: z.object({\n limitArg: z.string().default('limit').describe('Page size argument name'),\n offsetArg: z.string().default('offset').describe('Offset argument name'),\n firstArg: z.string().default('first').describe('Relay \"first\" argument name'),\n afterArg: z.string().default('after').describe('Relay \"after\" cursor argument name'),\n }).optional().describe('Pagination argument name mappings'),\n\n /** Sort argument configuration */\n sorting: z.object({\n argName: z.string().default('orderBy').describe('Sort argument name'),\n format: z.enum([\n 'enum', // orderBy: { field: ASC }\n 'array', // orderBy: [{ field: \"name\", direction: \"ASC\" }]\n ]).default('enum').describe('Sort argument format'),\n }).optional().describe('Sort argument mapping'),\n});\n\nexport type GraphQLQueryAdapter = z.infer<typeof GraphQLQueryAdapterSchema>;\nexport type GraphQLQueryAdapterInput = z.input<typeof GraphQLQueryAdapterSchema>;\n\n// ==========================================\n// 4. OData Adapter Configuration\n// ==========================================\n\n/**\n * OData Query Adapter Configuration\n * \n * Defines how unified query DSL maps to OData system query options.\n * \n * @example\n * Unified: { filters: [['status', '=', 'active']], top: 10, sort: [{ field: 'name', order: 'asc' }] }\n * OData: ?$filter=status eq 'active'&$top=10&$orderby=name asc\n */\nexport const ODataQueryAdapterSchema = z.object({\n /** OData version */\n version: z.enum(['v2', 'v4']).default('v4').describe('OData version'),\n\n /** System query option prefixes */\n usePrefix: z.boolean().default(true).describe('Use $ prefix for system query options ($filter vs filter)'),\n\n /** String function support */\n stringFunctions: z.array(z.enum([\n 'contains',\n 'startswith',\n 'endswith',\n 'tolower',\n 'toupper',\n 'trim',\n 'concat',\n 'substring',\n 'length',\n ])).optional().describe('Supported OData string functions'),\n\n /** Expand (nested resource) configuration */\n expand: z.object({\n enabled: z.boolean().default(true).describe('Enable $expand support'),\n maxDepth: z.number().int().min(1).default(3).describe('Maximum expand depth'),\n }).optional().describe('$expand configuration'),\n});\n\nexport type ODataQueryAdapter = z.infer<typeof ODataQueryAdapterSchema>;\nexport type ODataQueryAdapterInput = z.input<typeof ODataQueryAdapterSchema>;\n\n// ==========================================\n// 5. Complete Query Adapter Configuration\n// ==========================================\n\n/**\n * Query Adapter Configuration\n * \n * Root configuration for query DSL adapters across all supported protocols.\n * Controls how the internal unified DSL is translated to external API formats.\n */\nexport const QueryAdapterConfigSchema = z.object({\n /** Default operator mappings */\n operatorMappings: z.array(OperatorMappingSchema).optional().describe('Custom operator mappings'),\n\n /** REST adapter configuration */\n rest: RestQueryAdapterSchema.optional().describe('REST query adapter configuration'),\n\n /** GraphQL adapter configuration */\n graphql: GraphQLQueryAdapterSchema.optional().describe('GraphQL query adapter configuration'),\n\n /** OData adapter configuration */\n odata: ODataQueryAdapterSchema.optional().describe('OData query adapter configuration'),\n});\n\nexport type QueryAdapterConfig = z.infer<typeof QueryAdapterConfigSchema>;\nexport type QueryAdapterConfigInput = z.input<typeof QueryAdapterConfigSchema>;\n"],"mappings":";AAEA,SAAS,KAAAA,UAAS;;;ACAlB,SAAS,KAAAC,UAAS;;;ACAlB,SAAS,SAAS;AAiCX,IAAM,uBAAuB,EAAE,OAAO;AAAA,EAC3C,QAAQ,EAAE,OAAO,EAAE,SAAS,6BAA6B;AAC3D,CAAC;AAYM,IAAM,yBAAyB,EAAE,OAAO;AAAA;AAAA,EAE7C,KAAK,EAAE,IAAI,EAAE,SAAS;AAAA;AAAA,EAGtB,KAAK,EAAE,IAAI,EAAE,SAAS;AACxB,CAAC;AAMM,IAAM,2BAA2B,EAAE,OAAO;AAAA;AAAA,EAE/C,KAAK,EAAE,MAAM,CAAC,EAAE,OAAO,GAAG,EAAE,KAAK,GAAG,oBAAoB,CAAC,EAAE,SAAS;AAAA;AAAA,EAGpE,MAAM,EAAE,MA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MAAMA,IAAE,KAAK;AAAA,IAC9B;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,EACF,CAAC,CAAC,EAAE,SAAS,EAAE,SAAS,kCAAkC;AAAA;AAAA,EAG1D,QAAQA,IAAE,OAAO;AAAA,IACf,SAASA,IAAE,QAAQ,EAAE,QAAQ,IAAI,EAAE,SAAS,wBAAwB;AAAA,IACpE,UAAUA,IAAE,OAAO,EAAE,IAAI,EAAE,IAAI,CAAC,EAAE,QAAQ,CAAC,EAAE,SAAS,sBAAsB;AAAA,EAC9E,CAAC,EAAE,SAAS,EAAE,SAAS,uBAAuB;AAChD,CAAC;AAeM,IAAM,2BAA2BA,IAAE,OAAO;AAAA;AAAA,EAE/C,kBAAkBA,IAAE,MAAM,qBAAqB,EAAE,SAAS,EAAE,SAAS,0BAA0B;AAAA;AAAA,EAG/F,MAAM,uBAAuB,SAAS,EAAE,SAAS,kCAAkC;AAAA;AAAA,EAGnF,SAAS,0BAA0B,SAAS,EAAE,SAAS,qCAAqC;AAAA;AAAA,EAG5F,OAAO,wBAAwB,SAAS,EAAE,SAAS,mCAAmC;AACxF,CAAC;","names":["z","z","z","z","z","z","z","z","z","z","z","z","z","z","z","z","z","z","z","z","z","z","z","z","z","z","z","z","z","z","z","z","z","z","z","z","z","z","z","z","z","z","z","z","z","z","z","z","z","z","z","z","z","z","z","z","z","z","z","z","z","z","z","z","z","z","z","z","VersioningConfigSchema","z","z","z","z","z","z","z","z","z","z","z","z"]}
|