@objectstack/spec 0.3.0 → 0.3.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/ai/conversation.zod.d.ts +1059 -0
- package/dist/ai/conversation.zod.d.ts.map +1 -0
- package/dist/ai/conversation.zod.js +248 -0
- package/dist/ai/cost.zod.d.ts +2025 -0
- package/dist/ai/cost.zod.d.ts.map +1 -0
- package/dist/ai/cost.zod.js +324 -0
- package/dist/ai/index.d.ts +8 -0
- package/dist/ai/index.d.ts.map +1 -1
- package/dist/ai/index.js +8 -0
- package/dist/ai/model-registry.zod.d.ts +53 -53
- package/dist/ai/nlq.zod.d.ts +24 -24
- package/dist/ai/predictive.zod.d.ts +838 -0
- package/dist/ai/predictive.zod.d.ts.map +1 -0
- package/dist/ai/predictive.zod.js +244 -0
- package/dist/ai/rag-pipeline.zod.d.ts +22 -22
- package/dist/ai/workflow-automation.zod.d.ts +590 -0
- package/dist/ai/workflow-automation.zod.d.ts.map +1 -0
- package/dist/ai/workflow-automation.zod.js +197 -0
- package/dist/api/contract.zod.d.ts +22 -22
- package/dist/data/field.zod.d.ts +409 -4
- package/dist/data/field.zod.d.ts.map +1 -1
- package/dist/data/field.zod.js +28 -2
- package/dist/data/mapping.zod.d.ts +6 -6
- package/dist/data/object.zod.d.ts +80 -10
- package/dist/data/object.zod.d.ts.map +1 -1
- package/dist/data/workflow.zod.d.ts +809 -18
- package/dist/data/workflow.zod.d.ts.map +1 -1
- package/dist/data/workflow.zod.js +115 -7
- package/dist/system/api.zod.d.ts +4 -4
- package/dist/system/audit.zod.d.ts +1172 -0
- package/dist/system/audit.zod.d.ts.map +1 -0
- package/dist/system/audit.zod.js +596 -0
- package/dist/system/auth.zod.d.ts +8 -8
- package/dist/system/driver.zod.d.ts +4 -4
- package/dist/system/events.zod.d.ts +177 -0
- package/dist/system/events.zod.d.ts.map +1 -0
- package/dist/system/events.zod.js +51 -0
- package/dist/system/identity.zod.d.ts +4 -4
- package/dist/system/index.d.ts +5 -0
- package/dist/system/index.d.ts.map +1 -1
- package/dist/system/index.js +5 -0
- package/dist/system/job.zod.d.ts +237 -0
- package/dist/system/job.zod.d.ts.map +1 -0
- package/dist/system/job.zod.js +82 -0
- package/dist/system/manifest.zod.d.ts +10 -10
- package/dist/system/realtime.zod.d.ts +135 -0
- package/dist/system/realtime.zod.d.ts.map +1 -0
- package/dist/system/realtime.zod.js +83 -0
- package/dist/system/tenant.zod.d.ts +1151 -0
- package/dist/system/tenant.zod.d.ts.map +1 -0
- package/dist/system/tenant.zod.js +498 -0
- package/dist/system/webhook.zod.d.ts +2 -2
- package/dist/ui/action.zod.d.ts +8 -8
- package/dist/ui/theme.zod.d.ts +12 -12
- package/dist/ui/view.zod.d.ts +2315 -54
- package/dist/ui/view.zod.d.ts.map +1 -1
- package/dist/ui/view.zod.js +102 -3
- package/dist/ui/widget.zod.d.ts +40 -5
- package/dist/ui/widget.zod.d.ts.map +1 -1
- package/json-schema/README.md +127 -0
- package/json-schema/ai/AITask.json +123 -0
- package/json-schema/ai/AITaskType.json +21 -0
- package/json-schema/ai/AIWorkflowAutomation.json +379 -0
- package/json-schema/ai/AIWorkflowExecutionResult.json +105 -0
- package/json-schema/ai/AIWorkflowTrigger.json +18 -0
- package/json-schema/ai/BatchAIWorkflowExecution.json +48 -0
- package/json-schema/ai/BillingPeriod.json +18 -0
- package/json-schema/ai/BudgetLimit.json +111 -0
- package/json-schema/ai/BudgetStatus.json +91 -0
- package/json-schema/ai/BudgetType.json +17 -0
- package/json-schema/ai/ConversationAnalytics.json +86 -0
- package/json-schema/ai/ConversationContext.json +48 -0
- package/json-schema/ai/ConversationMessage.json +209 -0
- package/json-schema/ai/ConversationSession.json +458 -0
- package/json-schema/ai/ConversationSummary.json +73 -0
- package/json-schema/ai/CostAlert.json +107 -0
- package/json-schema/ai/CostAlertType.json +16 -0
- package/json-schema/ai/CostAnalytics.json +589 -0
- package/json-schema/ai/CostBreakdownDimension.json +20 -0
- package/json-schema/ai/CostBreakdownEntry.json +60 -0
- package/json-schema/ai/CostEntry.json +106 -0
- package/json-schema/ai/CostMetricType.json +17 -0
- package/json-schema/ai/CostOptimizationRecommendation.json +100 -0
- package/json-schema/ai/CostQueryFilters.json +112 -0
- package/json-schema/ai/CostReport.json +964 -0
- package/json-schema/ai/EvaluationMetrics.json +64 -0
- package/json-schema/ai/FunctionCall.json +28 -0
- package/json-schema/ai/Hyperparameters.json +80 -0
- package/json-schema/ai/MessageContent.json +46 -0
- package/json-schema/ai/MessageContentType.json +16 -0
- package/json-schema/ai/MessagePruningEvent.json +92 -0
- package/json-schema/ai/MessageRole.json +16 -0
- package/json-schema/ai/ModelDrift.json +73 -0
- package/json-schema/ai/ModelFeature.json +71 -0
- package/json-schema/ai/PostProcessingAction.json +41 -0
- package/json-schema/ai/PredictionRequest.json +39 -0
- package/json-schema/ai/PredictionResult.json +82 -0
- package/json-schema/ai/PredictiveModel.json +445 -0
- package/json-schema/ai/PredictiveModelType.json +18 -0
- package/json-schema/ai/TokenBudgetConfig.json +92 -0
- package/json-schema/ai/TokenBudgetStrategy.json +16 -0
- package/json-schema/ai/TokenUsageStats.json +66 -0
- package/json-schema/ai/ToolCall.json +49 -0
- package/json-schema/ai/TrainingConfig.json +88 -0
- package/json-schema/ai/WorkflowFieldCondition.json +33 -0
- package/json-schema/ai/WorkflowSchedule.json +51 -0
- package/json-schema/data/CustomScriptAction.json +49 -0
- package/json-schema/{Field.json → data/Field.json} +50 -1
- package/json-schema/{FieldType.json → data/FieldType.json} +4 -1
- package/json-schema/data/HttpCallAction.json +81 -0
- package/json-schema/{Object.json → data/Object.json} +50 -1
- package/json-schema/data/PushNotificationAction.json +59 -0
- package/json-schema/data/SlackMessageAction.json +45 -0
- package/json-schema/data/SmsNotificationAction.json +50 -0
- package/json-schema/data/TaskCreationAction.json +59 -0
- package/json-schema/data/TeamsMessageAction.json +45 -0
- package/json-schema/data/WebhookTriggerAction.json +58 -0
- package/json-schema/data/WorkflowAction.json +465 -0
- package/json-schema/data/WorkflowRule.json +509 -0
- package/json-schema/system/AuditConfig.json +587 -0
- package/json-schema/system/AuditEvent.json +232 -0
- package/json-schema/system/AuditEventActor.json +48 -0
- package/json-schema/system/AuditEventChange.json +25 -0
- package/json-schema/system/AuditEventFilter.json +127 -0
- package/json-schema/system/AuditEventSeverity.json +19 -0
- package/json-schema/system/AuditEventTarget.json +33 -0
- package/json-schema/system/AuditEventType.json +53 -0
- package/json-schema/system/AuditRetentionPolicy.json +73 -0
- package/json-schema/system/AuditStorageConfig.json +60 -0
- package/json-schema/system/CronSchedule.json +29 -0
- package/json-schema/system/DatabaseLevelIsolationStrategy.json +139 -0
- package/json-schema/system/Event.json +52 -0
- package/json-schema/system/EventHandler.json +29 -0
- package/json-schema/system/EventMetadata.json +33 -0
- package/json-schema/system/EventPersistence.json +25 -0
- package/json-schema/system/EventRoute.json +27 -0
- package/json-schema/system/IntervalSchedule.json +25 -0
- package/json-schema/system/Job.json +127 -0
- package/json-schema/system/JobExecution.json +49 -0
- package/json-schema/system/JobExecutionStatus.json +15 -0
- package/json-schema/system/LevelIsolationStrategySchema.json +93 -0
- package/json-schema/system/OnceSchedule.json +25 -0
- package/json-schema/system/Presence.json +40 -0
- package/json-schema/system/PresenceStatus.json +14 -0
- package/json-schema/system/RealtimeAction.json +14 -0
- package/json-schema/system/RealtimeEvent.json +51 -0
- package/json-schema/system/RealtimeEventType.json +15 -0
- package/json-schema/system/RetryPolicy.json +30 -0
- package/json-schema/system/RowLevelIsolationStrategy.json +74 -0
- package/json-schema/system/Schedule.json +71 -0
- package/json-schema/system/Subscription.json +65 -0
- package/json-schema/system/SubscriptionEvent.json +32 -0
- package/json-schema/system/SuspiciousActivityRule.json +175 -0
- package/json-schema/system/Tenant.json +61 -0
- package/json-schema/system/TenantIsolationConfig.json +298 -0
- package/json-schema/system/TenantIsolationLevel.json +14 -0
- package/json-schema/system/TenantQuota.json +27 -0
- package/json-schema/system/TenantSecurityPolicy.json +115 -0
- package/json-schema/system/TransportProtocol.json +14 -0
- package/json-schema/{Action.json → ui/Action.json} +4 -1
- package/json-schema/{ActionParam.json → ui/ActionParam.json} +4 -1
- package/json-schema/{FieldWidgetProps.json → ui/FieldWidgetProps.json} +50 -1
- package/json-schema/ui/FormField.json +61 -0
- package/json-schema/ui/FormSection.json +101 -0
- package/json-schema/ui/FormView.json +354 -0
- package/json-schema/ui/HttpMethod.json +16 -0
- package/json-schema/ui/HttpRequest.json +46 -0
- package/json-schema/ui/ListColumn.json +57 -0
- package/json-schema/ui/ListView.json +398 -0
- package/json-schema/ui/PaginationConfig.json +26 -0
- package/json-schema/ui/SelectionConfig.json +22 -0
- package/json-schema/ui/View.json +1500 -0
- package/json-schema/ui/ViewData.json +142 -0
- package/package.json +12 -12
- package/json-schema/AuthenticationConfig.json +0 -601
- package/json-schema/AuthenticationProvider.json +0 -617
- package/json-schema/FormSection.json +0 -42
- package/json-schema/FormView.json +0 -99
- package/json-schema/ListView.json +0 -153
- package/json-schema/MenuItem.json +0 -28
- package/json-schema/View.json +0 -500
- package/json-schema/WorkflowAction.json +0 -84
- package/json-schema/WorkflowRule.json +0 -128
- /package/json-schema/{AIKnowledge.json → ai/AIKnowledge.json} +0 -0
- /package/json-schema/{AIModelConfig.json → ai/AIModelConfig.json} +0 -0
- /package/json-schema/{AITool.json → ai/AITool.json} +0 -0
- /package/json-schema/{Agent.json → ai/Agent.json} +0 -0
- /package/json-schema/{ChunkingStrategy.json → ai/ChunkingStrategy.json} +0 -0
- /package/json-schema/{DocumentChunk.json → ai/DocumentChunk.json} +0 -0
- /package/json-schema/{DocumentLoaderConfig.json → ai/DocumentLoaderConfig.json} +0 -0
- /package/json-schema/{DocumentMetadata.json → ai/DocumentMetadata.json} +0 -0
- /package/json-schema/{EmbeddingModel.json → ai/EmbeddingModel.json} +0 -0
- /package/json-schema/{Entity.json → ai/Entity.json} +0 -0
- /package/json-schema/{FieldSynonymConfig.json → ai/FieldSynonymConfig.json} +0 -0
- /package/json-schema/{ModelCapability.json → ai/ModelCapability.json} +0 -0
- /package/json-schema/{ModelConfig.json → ai/ModelConfig.json} +0 -0
- /package/json-schema/{ModelLimits.json → ai/ModelLimits.json} +0 -0
- /package/json-schema/{ModelPricing.json → ai/ModelPricing.json} +0 -0
- /package/json-schema/{ModelProvider.json → ai/ModelProvider.json} +0 -0
- /package/json-schema/{ModelRegistry.json → ai/ModelRegistry.json} +0 -0
- /package/json-schema/{ModelRegistryEntry.json → ai/ModelRegistryEntry.json} +0 -0
- /package/json-schema/{ModelSelectionCriteria.json → ai/ModelSelectionCriteria.json} +0 -0
- /package/json-schema/{NLQAnalytics.json → ai/NLQAnalytics.json} +0 -0
- /package/json-schema/{NLQFieldMapping.json → ai/NLQFieldMapping.json} +0 -0
- /package/json-schema/{NLQModelConfig.json → ai/NLQModelConfig.json} +0 -0
- /package/json-schema/{NLQParseResult.json → ai/NLQParseResult.json} +0 -0
- /package/json-schema/{NLQRequest.json → ai/NLQRequest.json} +0 -0
- /package/json-schema/{NLQResponse.json → ai/NLQResponse.json} +0 -0
- /package/json-schema/{NLQTrainingExample.json → ai/NLQTrainingExample.json} +0 -0
- /package/json-schema/{PromptTemplate.json → ai/PromptTemplate.json} +0 -0
- /package/json-schema/{PromptVariable.json → ai/PromptVariable.json} +0 -0
- /package/json-schema/{QueryContext.json → ai/QueryContext.json} +0 -0
- /package/json-schema/{QueryIntent.json → ai/QueryIntent.json} +0 -0
- /package/json-schema/{QueryTemplate.json → ai/QueryTemplate.json} +0 -0
- /package/json-schema/{RAGPipelineConfig.json → ai/RAGPipelineConfig.json} +0 -0
- /package/json-schema/{RAGPipelineStatus.json → ai/RAGPipelineStatus.json} +0 -0
- /package/json-schema/{RAGQueryRequest.json → ai/RAGQueryRequest.json} +0 -0
- /package/json-schema/{RAGQueryResponse.json → ai/RAGQueryResponse.json} +0 -0
- /package/json-schema/{RerankingConfig.json → ai/RerankingConfig.json} +0 -0
- /package/json-schema/{RetrievalStrategy.json → ai/RetrievalStrategy.json} +0 -0
- /package/json-schema/{Timeframe.json → ai/Timeframe.json} +0 -0
- /package/json-schema/{VectorStoreConfig.json → ai/VectorStoreConfig.json} +0 -0
- /package/json-schema/{VectorStoreProvider.json → ai/VectorStoreProvider.json} +0 -0
- /package/json-schema/{ApiError.json → api/ApiError.json} +0 -0
- /package/json-schema/{BaseResponse.json → api/BaseResponse.json} +0 -0
- /package/json-schema/{BulkRequest.json → api/BulkRequest.json} +0 -0
- /package/json-schema/{BulkResponse.json → api/BulkResponse.json} +0 -0
- /package/json-schema/{CreateRequest.json → api/CreateRequest.json} +0 -0
- /package/json-schema/{DeleteResponse.json → api/DeleteResponse.json} +0 -0
- /package/json-schema/{ExportRequest.json → api/ExportRequest.json} +0 -0
- /package/json-schema/{ListRecordResponse.json → api/ListRecordResponse.json} +0 -0
- /package/json-schema/{ModificationResult.json → api/ModificationResult.json} +0 -0
- /package/json-schema/{RecordData.json → api/RecordData.json} +0 -0
- /package/json-schema/{SingleRecordResponse.json → api/SingleRecordResponse.json} +0 -0
- /package/json-schema/{UpdateRequest.json → api/UpdateRequest.json} +0 -0
- /package/json-schema/{Address.json → data/Address.json} +0 -0
- /package/json-schema/{AggregationFunction.json → data/AggregationFunction.json} +0 -0
- /package/json-schema/{AggregationNode.json → data/AggregationNode.json} +0 -0
- /package/json-schema/{AsyncValidation.json → data/AsyncValidation.json} +0 -0
- /package/json-schema/{ComparisonOperator.json → data/ComparisonOperator.json} +0 -0
- /package/json-schema/{ConditionalValidation.json → data/ConditionalValidation.json} +0 -0
- /package/json-schema/{CrossFieldValidation.json → data/CrossFieldValidation.json} +0 -0
- /package/json-schema/{CustomValidator.json → data/CustomValidator.json} +0 -0
- /package/json-schema/{Dataset.json → data/Dataset.json} +0 -0
- /package/json-schema/{DatasetMode.json → data/DatasetMode.json} +0 -0
- /package/json-schema/{EmailAlertAction.json → data/EmailAlertAction.json} +0 -0
- /package/json-schema/{EqualityOperator.json → data/EqualityOperator.json} +0 -0
- /package/json-schema/{FieldMapping.json → data/FieldMapping.json} +0 -0
- /package/json-schema/{FieldNode.json → data/FieldNode.json} +0 -0
- /package/json-schema/{FieldOperators.json → data/FieldOperators.json} +0 -0
- /package/json-schema/{FieldPermission.json → data/FieldPermission.json} +0 -0
- /package/json-schema/{FieldUpdateAction.json → data/FieldUpdateAction.json} +0 -0
- /package/json-schema/{FilterCondition.json → data/FilterCondition.json} +0 -0
- /package/json-schema/{FilterNode.json → data/FilterNode.json} +0 -0
- /package/json-schema/{FilterOperator.json → data/FilterOperator.json} +0 -0
- /package/json-schema/{Flow.json → data/Flow.json} +0 -0
- /package/json-schema/{FlowEdge.json → data/FlowEdge.json} +0 -0
- /package/json-schema/{FlowNode.json → data/FlowNode.json} +0 -0
- /package/json-schema/{FlowNodeAction.json → data/FlowNodeAction.json} +0 -0
- /package/json-schema/{FlowVariable.json → data/FlowVariable.json} +0 -0
- /package/json-schema/{FormatValidation.json → data/FormatValidation.json} +0 -0
- /package/json-schema/{Index.json → data/Index.json} +0 -0
- /package/json-schema/{JoinNode.json → data/JoinNode.json} +0 -0
- /package/json-schema/{JoinType.json → data/JoinType.json} +0 -0
- /package/json-schema/{LocationCoordinates.json → data/LocationCoordinates.json} +0 -0
- /package/json-schema/{LogicOperator.json → data/LogicOperator.json} +0 -0
- /package/json-schema/{Mapping.json → data/Mapping.json} +0 -0
- /package/json-schema/{NormalizedFilter.json → data/NormalizedFilter.json} +0 -0
- /package/json-schema/{OWDModel.json → data/OWDModel.json} +0 -0
- /package/json-schema/{ObjectCapabilities.json → data/ObjectCapabilities.json} +0 -0
- /package/json-schema/{ObjectPermission.json → data/ObjectPermission.json} +0 -0
- /package/json-schema/{PermissionSet.json → data/PermissionSet.json} +0 -0
- /package/json-schema/{Query.json → data/Query.json} +0 -0
- /package/json-schema/{QueryFilter.json → data/QueryFilter.json} +0 -0
- /package/json-schema/{RangeOperator.json → data/RangeOperator.json} +0 -0
- /package/json-schema/{ScriptValidation.json → data/ScriptValidation.json} +0 -0
- /package/json-schema/{SelectOption.json → data/SelectOption.json} +0 -0
- /package/json-schema/{SetOperator.json → data/SetOperator.json} +0 -0
- /package/json-schema/{SharingLevel.json → data/SharingLevel.json} +0 -0
- /package/json-schema/{SharingRule.json → data/SharingRule.json} +0 -0
- /package/json-schema/{SharingRuleType.json → data/SharingRuleType.json} +0 -0
- /package/json-schema/{SortNode.json → data/SortNode.json} +0 -0
- /package/json-schema/{SpecialOperator.json → data/SpecialOperator.json} +0 -0
- /package/json-schema/{StateMachineValidation.json → data/StateMachineValidation.json} +0 -0
- /package/json-schema/{StringOperator.json → data/StringOperator.json} +0 -0
- /package/json-schema/{TransformType.json → data/TransformType.json} +0 -0
- /package/json-schema/{Trigger.json → data/Trigger.json} +0 -0
- /package/json-schema/{TriggerAction.json → data/TriggerAction.json} +0 -0
- /package/json-schema/{TriggerContext.json → data/TriggerContext.json} +0 -0
- /package/json-schema/{TriggerTiming.json → data/TriggerTiming.json} +0 -0
- /package/json-schema/{UniquenessValidation.json → data/UniquenessValidation.json} +0 -0
- /package/json-schema/{ValidationRule.json → data/ValidationRule.json} +0 -0
- /package/json-schema/{WindowFunction.json → data/WindowFunction.json} +0 -0
- /package/json-schema/{WindowFunctionNode.json → data/WindowFunctionNode.json} +0 -0
- /package/json-schema/{WindowSpec.json → data/WindowSpec.json} +0 -0
- /package/json-schema/{WorkflowTriggerType.json → data/WorkflowTriggerType.json} +0 -0
- /package/json-schema/{Account.json → system/Account.json} +0 -0
- /package/json-schema/{AccountLinkingConfig.json → system/AccountLinkingConfig.json} +0 -0
- /package/json-schema/{ApiCapabilities.json → system/ApiCapabilities.json} +0 -0
- /package/json-schema/{ApiEndpoint.json → system/ApiEndpoint.json} +0 -0
- /package/json-schema/{ApiMapping.json → system/ApiMapping.json} +0 -0
- /package/json-schema/{ApiRoutes.json → system/ApiRoutes.json} +0 -0
- /package/json-schema/{AuditPolicy.json → system/AuditPolicy.json} +0 -0
- /package/json-schema/{AuthConfig.json → system/AuthConfig.json} +0 -0
- /package/json-schema/{AuthPluginConfig.json → system/AuthPluginConfig.json} +0 -0
- /package/json-schema/{AuthStrategy.json → system/AuthStrategy.json} +0 -0
- /package/json-schema/{CSRFConfig.json → system/CSRFConfig.json} +0 -0
- /package/json-schema/{DatabaseAdapter.json → system/DatabaseAdapter.json} +0 -0
- /package/json-schema/{DatabaseMapping.json → system/DatabaseMapping.json} +0 -0
- /package/json-schema/{Datasource.json → system/Datasource.json} +0 -0
- /package/json-schema/{DatasourceCapabilities.json → system/DatasourceCapabilities.json} +0 -0
- /package/json-schema/{Discovery.json → system/Discovery.json} +0 -0
- /package/json-schema/{DriverCapabilities.json → system/DriverCapabilities.json} +0 -0
- /package/json-schema/{DriverDefinition.json → system/DriverDefinition.json} +0 -0
- /package/json-schema/{DriverInterface.json → system/DriverInterface.json} +0 -0
- /package/json-schema/{DriverOptions.json → system/DriverOptions.json} +0 -0
- /package/json-schema/{DriverType.json → system/DriverType.json} +0 -0
- /package/json-schema/{EmailPasswordConfig.json → system/EmailPasswordConfig.json} +0 -0
- /package/json-schema/{EnterpriseAuthConfig.json → system/EnterpriseAuthConfig.json} +0 -0
- /package/json-schema/{Feature.json → system/Feature.json} +0 -0
- /package/json-schema/{HttpMethod.json → system/HttpMethod.json} +0 -0
- /package/json-schema/{I18nContext.json → system/I18nContext.json} +0 -0
- /package/json-schema/{Invitation.json → system/Invitation.json} +0 -0
- /package/json-schema/{InvitationStatus.json → system/InvitationStatus.json} +0 -0
- /package/json-schema/{LDAPConfig.json → system/LDAPConfig.json} +0 -0
- /package/json-schema/{License.json → system/License.json} +0 -0
- /package/json-schema/{Locale.json → system/Locale.json} +0 -0
- /package/json-schema/{Logger.json → system/Logger.json} +0 -0
- /package/json-schema/{MagicLinkConfig.json → system/MagicLinkConfig.json} +0 -0
- /package/json-schema/{Manifest.json → system/Manifest.json} +0 -0
- /package/json-schema/{Member.json → system/Member.json} +0 -0
- /package/json-schema/{MetricType.json → system/MetricType.json} +0 -0
- /package/json-schema/{NetworkPolicy.json → system/NetworkPolicy.json} +0 -0
- /package/json-schema/{OAuthProvider.json → system/OAuthProvider.json} +0 -0
- /package/json-schema/{OIDCConfig.json → system/OIDCConfig.json} +0 -0
- /package/json-schema/{ObjectQLClient.json → system/ObjectQLClient.json} +0 -0
- /package/json-schema/{Organization.json → system/Organization.json} +0 -0
- /package/json-schema/{PasskeyConfig.json → system/PasskeyConfig.json} +0 -0
- /package/json-schema/{PasswordPolicy.json → system/PasswordPolicy.json} +0 -0
- /package/json-schema/{Plan.json → system/Plan.json} +0 -0
- /package/json-schema/{Plugin.json → system/Plugin.json} +0 -0
- /package/json-schema/{PluginContext.json → system/PluginContext.json} +0 -0
- /package/json-schema/{PluginLifecycle.json → system/PluginLifecycle.json} +0 -0
- /package/json-schema/{Policy.json → system/Policy.json} +0 -0
- /package/json-schema/{RateLimit.json → system/RateLimit.json} +0 -0
- /package/json-schema/{RateLimitConfig.json → system/RateLimitConfig.json} +0 -0
- /package/json-schema/{Role.json → system/Role.json} +0 -0
- /package/json-schema/{Router.json → system/Router.json} +0 -0
- /package/json-schema/{SAMLConfig.json → system/SAMLConfig.json} +0 -0
- /package/json-schema/{Scheduler.json → system/Scheduler.json} +0 -0
- /package/json-schema/{ScopedStorage.json → system/ScopedStorage.json} +0 -0
- /package/json-schema/{Session.json → system/Session.json} +0 -0
- /package/json-schema/{SessionConfig.json → system/SessionConfig.json} +0 -0
- /package/json-schema/{SessionPolicy.json → system/SessionPolicy.json} +0 -0
- /package/json-schema/{StandardAuthProvider.json → system/StandardAuthProvider.json} +0 -0
- /package/json-schema/{SystemAPI.json → system/SystemAPI.json} +0 -0
- /package/json-schema/{Territory.json → system/Territory.json} +0 -0
- /package/json-schema/{TerritoryModel.json → system/TerritoryModel.json} +0 -0
- /package/json-schema/{TerritoryType.json → system/TerritoryType.json} +0 -0
- /package/json-schema/{TranslationBundle.json → system/TranslationBundle.json} +0 -0
- /package/json-schema/{TranslationData.json → system/TranslationData.json} +0 -0
- /package/json-schema/{TwoFactorConfig.json → system/TwoFactorConfig.json} +0 -0
- /package/json-schema/{User.json → system/User.json} +0 -0
- /package/json-schema/{UserFieldMapping.json → system/UserFieldMapping.json} +0 -0
- /package/json-schema/{VerificationToken.json → system/VerificationToken.json} +0 -0
- /package/json-schema/{Webhook.json → system/Webhook.json} +0 -0
- /package/json-schema/{WebhookReceiver.json → system/WebhookReceiver.json} +0 -0
- /package/json-schema/{WebhookTriggerType.json → system/WebhookTriggerType.json} +0 -0
- /package/json-schema/{Animation.json → ui/Animation.json} +0 -0
- /package/json-schema/{App.json → ui/App.json} +0 -0
- /package/json-schema/{AppBranding.json → ui/AppBranding.json} +0 -0
- /package/json-schema/{BorderRadius.json → ui/BorderRadius.json} +0 -0
- /package/json-schema/{Breakpoints.json → ui/Breakpoints.json} +0 -0
- /package/json-schema/{CalendarConfig.json → ui/CalendarConfig.json} +0 -0
- /package/json-schema/{ChartType.json → ui/ChartType.json} +0 -0
- /package/json-schema/{ColorPalette.json → ui/ColorPalette.json} +0 -0
- /package/json-schema/{Dashboard.json → ui/Dashboard.json} +0 -0
- /package/json-schema/{DashboardNavItem.json → ui/DashboardNavItem.json} +0 -0
- /package/json-schema/{DashboardWidget.json → ui/DashboardWidget.json} +0 -0
- /package/json-schema/{GanttConfig.json → ui/GanttConfig.json} +0 -0
- /package/json-schema/{GroupNavItem.json → ui/GroupNavItem.json} +0 -0
- /package/json-schema/{KanbanConfig.json → ui/KanbanConfig.json} +0 -0
- /package/json-schema/{NavigationItem.json → ui/NavigationItem.json} +0 -0
- /package/json-schema/{ObjectNavItem.json → ui/ObjectNavItem.json} +0 -0
- /package/json-schema/{Page.json → ui/Page.json} +0 -0
- /package/json-schema/{PageComponent.json → ui/PageComponent.json} +0 -0
- /package/json-schema/{PageNavItem.json → ui/PageNavItem.json} +0 -0
- /package/json-schema/{PageRegion.json → ui/PageRegion.json} +0 -0
- /package/json-schema/{Report.json → ui/Report.json} +0 -0
- /package/json-schema/{ReportChart.json → ui/ReportChart.json} +0 -0
- /package/json-schema/{ReportColumn.json → ui/ReportColumn.json} +0 -0
- /package/json-schema/{ReportGrouping.json → ui/ReportGrouping.json} +0 -0
- /package/json-schema/{ReportType.json → ui/ReportType.json} +0 -0
- /package/json-schema/{Shadow.json → ui/Shadow.json} +0 -0
- /package/json-schema/{Spacing.json → ui/Spacing.json} +0 -0
- /package/json-schema/{Theme.json → ui/Theme.json} +0 -0
- /package/json-schema/{ThemeMode.json → ui/ThemeMode.json} +0 -0
- /package/json-schema/{Typography.json → ui/Typography.json} +0 -0
- /package/json-schema/{UrlNavItem.json → ui/UrlNavItem.json} +0 -0
- /package/json-schema/{ZIndex.json → ui/ZIndex.json} +0 -0
|
@@ -0,0 +1,1151 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
/**
|
|
3
|
+
* Tenant Schema (Multi-Tenant Architecture)
|
|
4
|
+
*
|
|
5
|
+
* Defines the tenant/tenancy model for ObjectStack SaaS deployments.
|
|
6
|
+
* Supports different levels of data isolation to meet varying security,
|
|
7
|
+
* performance, and compliance requirements.
|
|
8
|
+
*
|
|
9
|
+
* Isolation Levels:
|
|
10
|
+
* - shared_schema: All tenants share the same database and schema (row-level isolation)
|
|
11
|
+
* - isolated_schema: Tenants have separate schemas within a shared database
|
|
12
|
+
* - isolated_db: Each tenant has a completely separate database
|
|
13
|
+
*/
|
|
14
|
+
/**
|
|
15
|
+
* Tenant Isolation Level Enum
|
|
16
|
+
* Defines how tenant data is separated in the system
|
|
17
|
+
*/
|
|
18
|
+
export declare const TenantIsolationLevel: z.ZodEnum<["shared_schema", "isolated_schema", "isolated_db"]>;
|
|
19
|
+
export type TenantIsolationLevel = z.infer<typeof TenantIsolationLevel>;
|
|
20
|
+
/**
|
|
21
|
+
* Tenant Quota Schema
|
|
22
|
+
* Defines resource limits and usage quotas for a tenant
|
|
23
|
+
*/
|
|
24
|
+
export declare const TenantQuotaSchema: z.ZodObject<{
|
|
25
|
+
/**
|
|
26
|
+
* Maximum number of users allowed for this tenant
|
|
27
|
+
*/
|
|
28
|
+
maxUsers: z.ZodOptional<z.ZodNumber>;
|
|
29
|
+
/**
|
|
30
|
+
* Maximum storage space in bytes
|
|
31
|
+
*/
|
|
32
|
+
maxStorage: z.ZodOptional<z.ZodNumber>;
|
|
33
|
+
/**
|
|
34
|
+
* API rate limit (requests per minute)
|
|
35
|
+
*/
|
|
36
|
+
apiRateLimit: z.ZodOptional<z.ZodNumber>;
|
|
37
|
+
}, "strip", z.ZodTypeAny, {
|
|
38
|
+
maxUsers?: number | undefined;
|
|
39
|
+
maxStorage?: number | undefined;
|
|
40
|
+
apiRateLimit?: number | undefined;
|
|
41
|
+
}, {
|
|
42
|
+
maxUsers?: number | undefined;
|
|
43
|
+
maxStorage?: number | undefined;
|
|
44
|
+
apiRateLimit?: number | undefined;
|
|
45
|
+
}>;
|
|
46
|
+
export type TenantQuota = z.infer<typeof TenantQuotaSchema>;
|
|
47
|
+
/**
|
|
48
|
+
* Tenant Schema
|
|
49
|
+
* Represents a tenant in a multi-tenant SaaS deployment
|
|
50
|
+
*/
|
|
51
|
+
export declare const TenantSchema: z.ZodObject<{
|
|
52
|
+
/**
|
|
53
|
+
* Unique tenant identifier
|
|
54
|
+
*/
|
|
55
|
+
id: z.ZodString;
|
|
56
|
+
/**
|
|
57
|
+
* Tenant name (display name)
|
|
58
|
+
*/
|
|
59
|
+
name: z.ZodString;
|
|
60
|
+
/**
|
|
61
|
+
* Data isolation level for this tenant
|
|
62
|
+
* Determines how tenant data is segregated from other tenants
|
|
63
|
+
*/
|
|
64
|
+
isolationLevel: z.ZodEnum<["shared_schema", "isolated_schema", "isolated_db"]>;
|
|
65
|
+
/**
|
|
66
|
+
* Custom configurations and metadata specific to this tenant
|
|
67
|
+
* Can store tenant-specific settings, branding, features, etc.
|
|
68
|
+
*/
|
|
69
|
+
customizations: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodAny>>;
|
|
70
|
+
/**
|
|
71
|
+
* Resource quotas and limits for this tenant
|
|
72
|
+
*/
|
|
73
|
+
quotas: z.ZodOptional<z.ZodObject<{
|
|
74
|
+
/**
|
|
75
|
+
* Maximum number of users allowed for this tenant
|
|
76
|
+
*/
|
|
77
|
+
maxUsers: z.ZodOptional<z.ZodNumber>;
|
|
78
|
+
/**
|
|
79
|
+
* Maximum storage space in bytes
|
|
80
|
+
*/
|
|
81
|
+
maxStorage: z.ZodOptional<z.ZodNumber>;
|
|
82
|
+
/**
|
|
83
|
+
* API rate limit (requests per minute)
|
|
84
|
+
*/
|
|
85
|
+
apiRateLimit: z.ZodOptional<z.ZodNumber>;
|
|
86
|
+
}, "strip", z.ZodTypeAny, {
|
|
87
|
+
maxUsers?: number | undefined;
|
|
88
|
+
maxStorage?: number | undefined;
|
|
89
|
+
apiRateLimit?: number | undefined;
|
|
90
|
+
}, {
|
|
91
|
+
maxUsers?: number | undefined;
|
|
92
|
+
maxStorage?: number | undefined;
|
|
93
|
+
apiRateLimit?: number | undefined;
|
|
94
|
+
}>>;
|
|
95
|
+
}, "strip", z.ZodTypeAny, {
|
|
96
|
+
name: string;
|
|
97
|
+
id: string;
|
|
98
|
+
isolationLevel: "shared_schema" | "isolated_schema" | "isolated_db";
|
|
99
|
+
customizations?: Record<string, any> | undefined;
|
|
100
|
+
quotas?: {
|
|
101
|
+
maxUsers?: number | undefined;
|
|
102
|
+
maxStorage?: number | undefined;
|
|
103
|
+
apiRateLimit?: number | undefined;
|
|
104
|
+
} | undefined;
|
|
105
|
+
}, {
|
|
106
|
+
name: string;
|
|
107
|
+
id: string;
|
|
108
|
+
isolationLevel: "shared_schema" | "isolated_schema" | "isolated_db";
|
|
109
|
+
customizations?: Record<string, any> | undefined;
|
|
110
|
+
quotas?: {
|
|
111
|
+
maxUsers?: number | undefined;
|
|
112
|
+
maxStorage?: number | undefined;
|
|
113
|
+
apiRateLimit?: number | undefined;
|
|
114
|
+
} | undefined;
|
|
115
|
+
}>;
|
|
116
|
+
export type Tenant = z.infer<typeof TenantSchema>;
|
|
117
|
+
/**
|
|
118
|
+
* Tenant Isolation Strategy Documentation
|
|
119
|
+
*
|
|
120
|
+
* Comprehensive documentation of three isolation strategies for multi-tenant systems.
|
|
121
|
+
* Each strategy has different trade-offs in terms of security, cost, complexity, and compliance.
|
|
122
|
+
*/
|
|
123
|
+
/**
|
|
124
|
+
* Row-Level Isolation Strategy (shared_schema)
|
|
125
|
+
*
|
|
126
|
+
* Recommended for: Most SaaS applications, cost-sensitive deployments
|
|
127
|
+
*
|
|
128
|
+
* IMPLEMENTATION:
|
|
129
|
+
* - All tenants share the same database and schema
|
|
130
|
+
* - Each table includes a tenant_id column
|
|
131
|
+
* - PostgreSQL Row-Level Security (RLS) enforces isolation
|
|
132
|
+
* - Queries automatically filter by tenant_id via RLS policies
|
|
133
|
+
*
|
|
134
|
+
* ADVANTAGES:
|
|
135
|
+
* ✅ Simple backup and restore (single database)
|
|
136
|
+
* ✅ Cost-effective (shared resources, minimal overhead)
|
|
137
|
+
* ✅ Easy tenant migration (update tenant_id)
|
|
138
|
+
* ✅ Efficient resource utilization (connection pooling)
|
|
139
|
+
* ✅ Simple schema migrations (single schema to update)
|
|
140
|
+
* ✅ Lower operational complexity
|
|
141
|
+
*
|
|
142
|
+
* DISADVANTAGES:
|
|
143
|
+
* ❌ RLS misconfiguration can lead to data leakage
|
|
144
|
+
* ❌ Performance impact from RLS policy evaluation
|
|
145
|
+
* ❌ Noisy neighbor problem (one tenant can affect others)
|
|
146
|
+
* ❌ Cannot easily isolate tenant to different hardware
|
|
147
|
+
* ❌ Compliance challenges for regulated industries
|
|
148
|
+
*
|
|
149
|
+
* SECURITY CONSIDERATIONS:
|
|
150
|
+
* - Requires careful RLS policy configuration
|
|
151
|
+
* - Must validate tenant_id in all queries
|
|
152
|
+
* - Need comprehensive testing of RLS policies
|
|
153
|
+
* - Audit all database access patterns
|
|
154
|
+
* - Implement application-level validation as defense-in-depth
|
|
155
|
+
*
|
|
156
|
+
* EXAMPLE RLS POLICY (PostgreSQL):
|
|
157
|
+
* ```sql
|
|
158
|
+
* -- Example: Apply RLS policy to a table (e.g., "app_data")
|
|
159
|
+
* CREATE POLICY tenant_isolation ON app_data
|
|
160
|
+
* USING (tenant_id = current_setting('app.current_tenant')::text);
|
|
161
|
+
*
|
|
162
|
+
* ALTER TABLE app_data ENABLE ROW LEVEL SECURITY;
|
|
163
|
+
* ```
|
|
164
|
+
*/
|
|
165
|
+
export declare const RowLevelIsolationStrategySchema: z.ZodObject<{
|
|
166
|
+
strategy: z.ZodLiteral<"shared_schema">;
|
|
167
|
+
/**
|
|
168
|
+
* Database configuration for row-level isolation
|
|
169
|
+
*/
|
|
170
|
+
database: z.ZodOptional<z.ZodObject<{
|
|
171
|
+
/**
|
|
172
|
+
* Whether to enable Row-Level Security (RLS)
|
|
173
|
+
*/
|
|
174
|
+
enableRLS: z.ZodDefault<z.ZodBoolean>;
|
|
175
|
+
/**
|
|
176
|
+
* Tenant context setting method
|
|
177
|
+
*/
|
|
178
|
+
contextMethod: z.ZodDefault<z.ZodEnum<["session_variable", "search_path", "application_name"]>>;
|
|
179
|
+
/**
|
|
180
|
+
* Session variable name for tenant context
|
|
181
|
+
*/
|
|
182
|
+
contextVariable: z.ZodDefault<z.ZodString>;
|
|
183
|
+
/**
|
|
184
|
+
* Whether to validate tenant_id at application level
|
|
185
|
+
*/
|
|
186
|
+
applicationValidation: z.ZodDefault<z.ZodBoolean>;
|
|
187
|
+
}, "strip", z.ZodTypeAny, {
|
|
188
|
+
enableRLS: boolean;
|
|
189
|
+
contextMethod: "session_variable" | "search_path" | "application_name";
|
|
190
|
+
contextVariable: string;
|
|
191
|
+
applicationValidation: boolean;
|
|
192
|
+
}, {
|
|
193
|
+
enableRLS?: boolean | undefined;
|
|
194
|
+
contextMethod?: "session_variable" | "search_path" | "application_name" | undefined;
|
|
195
|
+
contextVariable?: string | undefined;
|
|
196
|
+
applicationValidation?: boolean | undefined;
|
|
197
|
+
}>>;
|
|
198
|
+
/**
|
|
199
|
+
* Performance optimization settings
|
|
200
|
+
*/
|
|
201
|
+
performance: z.ZodOptional<z.ZodObject<{
|
|
202
|
+
/**
|
|
203
|
+
* Whether to use partial indexes for tenant_id
|
|
204
|
+
*/
|
|
205
|
+
usePartialIndexes: z.ZodDefault<z.ZodBoolean>;
|
|
206
|
+
/**
|
|
207
|
+
* Whether to use table partitioning
|
|
208
|
+
*/
|
|
209
|
+
usePartitioning: z.ZodDefault<z.ZodBoolean>;
|
|
210
|
+
/**
|
|
211
|
+
* Connection pool size per tenant
|
|
212
|
+
*/
|
|
213
|
+
poolSizePerTenant: z.ZodOptional<z.ZodNumber>;
|
|
214
|
+
}, "strip", z.ZodTypeAny, {
|
|
215
|
+
usePartialIndexes: boolean;
|
|
216
|
+
usePartitioning: boolean;
|
|
217
|
+
poolSizePerTenant?: number | undefined;
|
|
218
|
+
}, {
|
|
219
|
+
usePartialIndexes?: boolean | undefined;
|
|
220
|
+
usePartitioning?: boolean | undefined;
|
|
221
|
+
poolSizePerTenant?: number | undefined;
|
|
222
|
+
}>>;
|
|
223
|
+
}, "strip", z.ZodTypeAny, {
|
|
224
|
+
strategy: "shared_schema";
|
|
225
|
+
database?: {
|
|
226
|
+
enableRLS: boolean;
|
|
227
|
+
contextMethod: "session_variable" | "search_path" | "application_name";
|
|
228
|
+
contextVariable: string;
|
|
229
|
+
applicationValidation: boolean;
|
|
230
|
+
} | undefined;
|
|
231
|
+
performance?: {
|
|
232
|
+
usePartialIndexes: boolean;
|
|
233
|
+
usePartitioning: boolean;
|
|
234
|
+
poolSizePerTenant?: number | undefined;
|
|
235
|
+
} | undefined;
|
|
236
|
+
}, {
|
|
237
|
+
strategy: "shared_schema";
|
|
238
|
+
database?: {
|
|
239
|
+
enableRLS?: boolean | undefined;
|
|
240
|
+
contextMethod?: "session_variable" | "search_path" | "application_name" | undefined;
|
|
241
|
+
contextVariable?: string | undefined;
|
|
242
|
+
applicationValidation?: boolean | undefined;
|
|
243
|
+
} | undefined;
|
|
244
|
+
performance?: {
|
|
245
|
+
usePartialIndexes?: boolean | undefined;
|
|
246
|
+
usePartitioning?: boolean | undefined;
|
|
247
|
+
poolSizePerTenant?: number | undefined;
|
|
248
|
+
} | undefined;
|
|
249
|
+
}>;
|
|
250
|
+
export type RowLevelIsolationStrategy = z.infer<typeof RowLevelIsolationStrategySchema>;
|
|
251
|
+
/**
|
|
252
|
+
* Schema-Level Isolation Strategy (isolated_schema)
|
|
253
|
+
*
|
|
254
|
+
* Recommended for: Enterprise SaaS, B2B platforms with compliance needs
|
|
255
|
+
*
|
|
256
|
+
* IMPLEMENTATION:
|
|
257
|
+
* - All tenants share the same database server
|
|
258
|
+
* - Each tenant has a separate database schema
|
|
259
|
+
* - Schema name typically: tenant_<tenant_id>
|
|
260
|
+
* - Application switches schema using SET search_path
|
|
261
|
+
*
|
|
262
|
+
* ADVANTAGES:
|
|
263
|
+
* ✅ Better isolation than row-level (schema boundaries)
|
|
264
|
+
* ✅ Easier to debug (separate schemas)
|
|
265
|
+
* ✅ Can grant different database permissions per schema
|
|
266
|
+
* ✅ Reduced risk of data leakage
|
|
267
|
+
* ✅ Performance isolation (indexes, statistics per schema)
|
|
268
|
+
* ✅ Simplified queries (no tenant_id filtering needed)
|
|
269
|
+
*
|
|
270
|
+
* DISADVANTAGES:
|
|
271
|
+
* ❌ More complex backups (must backup all schemas)
|
|
272
|
+
* ❌ Higher migration costs (schema changes across all tenants)
|
|
273
|
+
* ❌ Schema proliferation (PostgreSQL has limits)
|
|
274
|
+
* ❌ Connection overhead (switching schemas)
|
|
275
|
+
* ❌ More complex monitoring and maintenance
|
|
276
|
+
*
|
|
277
|
+
* SECURITY CONSIDERATIONS:
|
|
278
|
+
* - Ensure proper schema permissions (GRANT USAGE ON SCHEMA)
|
|
279
|
+
* - Validate schema name to prevent SQL injection
|
|
280
|
+
* - Implement connection-level schema switching
|
|
281
|
+
* - Audit schema access patterns
|
|
282
|
+
* - Prevent cross-schema queries in application
|
|
283
|
+
*
|
|
284
|
+
* EXAMPLE IMPLEMENTATION (PostgreSQL):
|
|
285
|
+
* ```sql
|
|
286
|
+
* -- Create tenant schema
|
|
287
|
+
* CREATE SCHEMA tenant_123;
|
|
288
|
+
*
|
|
289
|
+
* -- Grant access
|
|
290
|
+
* GRANT USAGE ON SCHEMA tenant_123 TO app_user;
|
|
291
|
+
*
|
|
292
|
+
* -- Switch to tenant schema
|
|
293
|
+
* SET search_path TO tenant_123, public;
|
|
294
|
+
* ```
|
|
295
|
+
*/
|
|
296
|
+
export declare const SchemaLevelIsolationStrategySchema: z.ZodObject<{
|
|
297
|
+
strategy: z.ZodLiteral<"isolated_schema">;
|
|
298
|
+
/**
|
|
299
|
+
* Schema configuration
|
|
300
|
+
*/
|
|
301
|
+
schema: z.ZodOptional<z.ZodObject<{
|
|
302
|
+
/**
|
|
303
|
+
* Schema naming pattern
|
|
304
|
+
* Use {tenant_id} as placeholder (must contain only alphanumeric and underscores)
|
|
305
|
+
* The tenant_id will be sanitized before substitution to prevent SQL injection
|
|
306
|
+
*/
|
|
307
|
+
namingPattern: z.ZodDefault<z.ZodString>;
|
|
308
|
+
/**
|
|
309
|
+
* Whether to include public schema in search_path
|
|
310
|
+
*/
|
|
311
|
+
includePublicSchema: z.ZodDefault<z.ZodBoolean>;
|
|
312
|
+
/**
|
|
313
|
+
* Default schema for shared resources
|
|
314
|
+
*/
|
|
315
|
+
sharedSchema: z.ZodDefault<z.ZodString>;
|
|
316
|
+
/**
|
|
317
|
+
* Whether to automatically create schema on tenant creation
|
|
318
|
+
*/
|
|
319
|
+
autoCreateSchema: z.ZodDefault<z.ZodBoolean>;
|
|
320
|
+
}, "strip", z.ZodTypeAny, {
|
|
321
|
+
namingPattern: string;
|
|
322
|
+
includePublicSchema: boolean;
|
|
323
|
+
sharedSchema: string;
|
|
324
|
+
autoCreateSchema: boolean;
|
|
325
|
+
}, {
|
|
326
|
+
namingPattern?: string | undefined;
|
|
327
|
+
includePublicSchema?: boolean | undefined;
|
|
328
|
+
sharedSchema?: string | undefined;
|
|
329
|
+
autoCreateSchema?: boolean | undefined;
|
|
330
|
+
}>>;
|
|
331
|
+
/**
|
|
332
|
+
* Migration configuration
|
|
333
|
+
*/
|
|
334
|
+
migrations: z.ZodOptional<z.ZodObject<{
|
|
335
|
+
/**
|
|
336
|
+
* Migration strategy
|
|
337
|
+
*/
|
|
338
|
+
strategy: z.ZodDefault<z.ZodEnum<["parallel", "sequential", "on_demand"]>>;
|
|
339
|
+
/**
|
|
340
|
+
* Maximum concurrent migrations
|
|
341
|
+
*/
|
|
342
|
+
maxConcurrent: z.ZodDefault<z.ZodNumber>;
|
|
343
|
+
/**
|
|
344
|
+
* Whether to rollback on first failure
|
|
345
|
+
*/
|
|
346
|
+
rollbackOnError: z.ZodDefault<z.ZodBoolean>;
|
|
347
|
+
}, "strip", z.ZodTypeAny, {
|
|
348
|
+
strategy: "parallel" | "sequential" | "on_demand";
|
|
349
|
+
maxConcurrent: number;
|
|
350
|
+
rollbackOnError: boolean;
|
|
351
|
+
}, {
|
|
352
|
+
strategy?: "parallel" | "sequential" | "on_demand" | undefined;
|
|
353
|
+
maxConcurrent?: number | undefined;
|
|
354
|
+
rollbackOnError?: boolean | undefined;
|
|
355
|
+
}>>;
|
|
356
|
+
/**
|
|
357
|
+
* Performance optimization settings
|
|
358
|
+
*/
|
|
359
|
+
performance: z.ZodOptional<z.ZodObject<{
|
|
360
|
+
/**
|
|
361
|
+
* Whether to use connection pooling per schema
|
|
362
|
+
*/
|
|
363
|
+
poolPerSchema: z.ZodDefault<z.ZodBoolean>;
|
|
364
|
+
/**
|
|
365
|
+
* Schema cache TTL in seconds
|
|
366
|
+
*/
|
|
367
|
+
schemaCacheTTL: z.ZodDefault<z.ZodNumber>;
|
|
368
|
+
}, "strip", z.ZodTypeAny, {
|
|
369
|
+
poolPerSchema: boolean;
|
|
370
|
+
schemaCacheTTL: number;
|
|
371
|
+
}, {
|
|
372
|
+
poolPerSchema?: boolean | undefined;
|
|
373
|
+
schemaCacheTTL?: number | undefined;
|
|
374
|
+
}>>;
|
|
375
|
+
}, "strip", z.ZodTypeAny, {
|
|
376
|
+
strategy: "isolated_schema";
|
|
377
|
+
schema?: {
|
|
378
|
+
namingPattern: string;
|
|
379
|
+
includePublicSchema: boolean;
|
|
380
|
+
sharedSchema: string;
|
|
381
|
+
autoCreateSchema: boolean;
|
|
382
|
+
} | undefined;
|
|
383
|
+
performance?: {
|
|
384
|
+
poolPerSchema: boolean;
|
|
385
|
+
schemaCacheTTL: number;
|
|
386
|
+
} | undefined;
|
|
387
|
+
migrations?: {
|
|
388
|
+
strategy: "parallel" | "sequential" | "on_demand";
|
|
389
|
+
maxConcurrent: number;
|
|
390
|
+
rollbackOnError: boolean;
|
|
391
|
+
} | undefined;
|
|
392
|
+
}, {
|
|
393
|
+
strategy: "isolated_schema";
|
|
394
|
+
schema?: {
|
|
395
|
+
namingPattern?: string | undefined;
|
|
396
|
+
includePublicSchema?: boolean | undefined;
|
|
397
|
+
sharedSchema?: string | undefined;
|
|
398
|
+
autoCreateSchema?: boolean | undefined;
|
|
399
|
+
} | undefined;
|
|
400
|
+
performance?: {
|
|
401
|
+
poolPerSchema?: boolean | undefined;
|
|
402
|
+
schemaCacheTTL?: number | undefined;
|
|
403
|
+
} | undefined;
|
|
404
|
+
migrations?: {
|
|
405
|
+
strategy?: "parallel" | "sequential" | "on_demand" | undefined;
|
|
406
|
+
maxConcurrent?: number | undefined;
|
|
407
|
+
rollbackOnError?: boolean | undefined;
|
|
408
|
+
} | undefined;
|
|
409
|
+
}>;
|
|
410
|
+
export type SchemaLevelIsolationStrategy = z.infer<typeof SchemaLevelIsolationStrategySchema>;
|
|
411
|
+
/**
|
|
412
|
+
* Database-Level Isolation Strategy (isolated_db)
|
|
413
|
+
*
|
|
414
|
+
* Recommended for: Regulated industries (healthcare, finance), strict compliance requirements
|
|
415
|
+
*
|
|
416
|
+
* IMPLEMENTATION:
|
|
417
|
+
* - Each tenant has a completely separate database
|
|
418
|
+
* - Database name typically: tenant_<tenant_id>
|
|
419
|
+
* - Requires separate connection pool per tenant
|
|
420
|
+
* - Complete physical and logical isolation
|
|
421
|
+
*
|
|
422
|
+
* ADVANTAGES:
|
|
423
|
+
* ✅ Perfect data isolation (strongest security)
|
|
424
|
+
* ✅ Meets strict regulatory requirements (HIPAA, SOX, PCI-DSS)
|
|
425
|
+
* ✅ Complete performance isolation (no noisy neighbors)
|
|
426
|
+
* ✅ Can place databases on different hardware
|
|
427
|
+
* ✅ Easy to backup/restore individual tenant
|
|
428
|
+
* ✅ Simplified compliance auditing per tenant
|
|
429
|
+
* ✅ Can apply different encryption keys per database
|
|
430
|
+
*
|
|
431
|
+
* DISADVANTAGES:
|
|
432
|
+
* ❌ Most expensive option (resource overhead)
|
|
433
|
+
* ❌ Complex database server management (many databases)
|
|
434
|
+
* ❌ Connection pool limits (max connections per server)
|
|
435
|
+
* ❌ Difficult cross-tenant analytics
|
|
436
|
+
* ❌ Higher operational complexity
|
|
437
|
+
* ❌ Schema migrations take longer (many databases)
|
|
438
|
+
*
|
|
439
|
+
* SECURITY CONSIDERATIONS:
|
|
440
|
+
* - Each database can have separate credentials
|
|
441
|
+
* - Enables per-tenant encryption at rest
|
|
442
|
+
* - Simplifies compliance and audit trails
|
|
443
|
+
* - Prevents any cross-tenant data access
|
|
444
|
+
* - Supports tenant-specific backup schedules
|
|
445
|
+
*
|
|
446
|
+
* EXAMPLE IMPLEMENTATION (PostgreSQL):
|
|
447
|
+
* ```sql
|
|
448
|
+
* -- Create tenant database
|
|
449
|
+
* CREATE DATABASE tenant_123
|
|
450
|
+
* WITH OWNER = tenant_123_user
|
|
451
|
+
* ENCODING = 'UTF8'
|
|
452
|
+
* LC_COLLATE = 'en_US.UTF-8'
|
|
453
|
+
* LC_CTYPE = 'en_US.UTF-8';
|
|
454
|
+
*
|
|
455
|
+
* -- Connect to tenant database
|
|
456
|
+
* \c tenant_123
|
|
457
|
+
* ```
|
|
458
|
+
*/
|
|
459
|
+
export declare const DatabaseLevelIsolationStrategySchema: z.ZodObject<{
|
|
460
|
+
strategy: z.ZodLiteral<"isolated_db">;
|
|
461
|
+
/**
|
|
462
|
+
* Database configuration
|
|
463
|
+
*/
|
|
464
|
+
database: z.ZodOptional<z.ZodObject<{
|
|
465
|
+
/**
|
|
466
|
+
* Database naming pattern
|
|
467
|
+
* Use {tenant_id} as placeholder (must contain only alphanumeric and underscores)
|
|
468
|
+
* The tenant_id will be sanitized before substitution to prevent SQL injection
|
|
469
|
+
*/
|
|
470
|
+
namingPattern: z.ZodDefault<z.ZodString>;
|
|
471
|
+
/**
|
|
472
|
+
* Database server/cluster assignment strategy
|
|
473
|
+
*/
|
|
474
|
+
serverStrategy: z.ZodDefault<z.ZodEnum<["shared", "sharded", "dedicated"]>>;
|
|
475
|
+
/**
|
|
476
|
+
* Whether to use separate credentials per tenant
|
|
477
|
+
*/
|
|
478
|
+
separateCredentials: z.ZodDefault<z.ZodBoolean>;
|
|
479
|
+
/**
|
|
480
|
+
* Whether to automatically create database on tenant creation
|
|
481
|
+
*/
|
|
482
|
+
autoCreateDatabase: z.ZodDefault<z.ZodBoolean>;
|
|
483
|
+
}, "strip", z.ZodTypeAny, {
|
|
484
|
+
namingPattern: string;
|
|
485
|
+
serverStrategy: "shared" | "sharded" | "dedicated";
|
|
486
|
+
separateCredentials: boolean;
|
|
487
|
+
autoCreateDatabase: boolean;
|
|
488
|
+
}, {
|
|
489
|
+
namingPattern?: string | undefined;
|
|
490
|
+
serverStrategy?: "shared" | "sharded" | "dedicated" | undefined;
|
|
491
|
+
separateCredentials?: boolean | undefined;
|
|
492
|
+
autoCreateDatabase?: boolean | undefined;
|
|
493
|
+
}>>;
|
|
494
|
+
/**
|
|
495
|
+
* Connection pooling configuration
|
|
496
|
+
*/
|
|
497
|
+
connectionPool: z.ZodOptional<z.ZodObject<{
|
|
498
|
+
/**
|
|
499
|
+
* Pool size per tenant database
|
|
500
|
+
*/
|
|
501
|
+
poolSize: z.ZodDefault<z.ZodNumber>;
|
|
502
|
+
/**
|
|
503
|
+
* Maximum number of tenant pools to keep active
|
|
504
|
+
*/
|
|
505
|
+
maxActivePools: z.ZodDefault<z.ZodNumber>;
|
|
506
|
+
/**
|
|
507
|
+
* Idle pool timeout in seconds
|
|
508
|
+
*/
|
|
509
|
+
idleTimeout: z.ZodDefault<z.ZodNumber>;
|
|
510
|
+
/**
|
|
511
|
+
* Whether to use connection pooler (PgBouncer, etc.)
|
|
512
|
+
*/
|
|
513
|
+
usePooler: z.ZodDefault<z.ZodBoolean>;
|
|
514
|
+
}, "strip", z.ZodTypeAny, {
|
|
515
|
+
idleTimeout: number;
|
|
516
|
+
poolSize: number;
|
|
517
|
+
maxActivePools: number;
|
|
518
|
+
usePooler: boolean;
|
|
519
|
+
}, {
|
|
520
|
+
idleTimeout?: number | undefined;
|
|
521
|
+
poolSize?: number | undefined;
|
|
522
|
+
maxActivePools?: number | undefined;
|
|
523
|
+
usePooler?: boolean | undefined;
|
|
524
|
+
}>>;
|
|
525
|
+
/**
|
|
526
|
+
* Backup and restore configuration
|
|
527
|
+
*/
|
|
528
|
+
backup: z.ZodOptional<z.ZodObject<{
|
|
529
|
+
/**
|
|
530
|
+
* Backup strategy per tenant
|
|
531
|
+
*/
|
|
532
|
+
strategy: z.ZodDefault<z.ZodEnum<["individual", "consolidated", "on_demand"]>>;
|
|
533
|
+
/**
|
|
534
|
+
* Backup frequency in hours
|
|
535
|
+
*/
|
|
536
|
+
frequencyHours: z.ZodDefault<z.ZodNumber>;
|
|
537
|
+
/**
|
|
538
|
+
* Retention period in days
|
|
539
|
+
*/
|
|
540
|
+
retentionDays: z.ZodDefault<z.ZodNumber>;
|
|
541
|
+
}, "strip", z.ZodTypeAny, {
|
|
542
|
+
strategy: "on_demand" | "individual" | "consolidated";
|
|
543
|
+
frequencyHours: number;
|
|
544
|
+
retentionDays: number;
|
|
545
|
+
}, {
|
|
546
|
+
strategy?: "on_demand" | "individual" | "consolidated" | undefined;
|
|
547
|
+
frequencyHours?: number | undefined;
|
|
548
|
+
retentionDays?: number | undefined;
|
|
549
|
+
}>>;
|
|
550
|
+
/**
|
|
551
|
+
* Encryption configuration
|
|
552
|
+
*/
|
|
553
|
+
encryption: z.ZodOptional<z.ZodObject<{
|
|
554
|
+
/**
|
|
555
|
+
* Whether to use per-tenant encryption keys
|
|
556
|
+
*/
|
|
557
|
+
perTenantKeys: z.ZodDefault<z.ZodBoolean>;
|
|
558
|
+
/**
|
|
559
|
+
* Encryption algorithm
|
|
560
|
+
*/
|
|
561
|
+
algorithm: z.ZodDefault<z.ZodString>;
|
|
562
|
+
/**
|
|
563
|
+
* Key management service
|
|
564
|
+
*/
|
|
565
|
+
keyManagement: z.ZodOptional<z.ZodEnum<["aws_kms", "azure_key_vault", "gcp_kms", "hashicorp_vault", "custom"]>>;
|
|
566
|
+
}, "strip", z.ZodTypeAny, {
|
|
567
|
+
perTenantKeys: boolean;
|
|
568
|
+
algorithm: string;
|
|
569
|
+
keyManagement?: "custom" | "aws_kms" | "azure_key_vault" | "gcp_kms" | "hashicorp_vault" | undefined;
|
|
570
|
+
}, {
|
|
571
|
+
perTenantKeys?: boolean | undefined;
|
|
572
|
+
algorithm?: string | undefined;
|
|
573
|
+
keyManagement?: "custom" | "aws_kms" | "azure_key_vault" | "gcp_kms" | "hashicorp_vault" | undefined;
|
|
574
|
+
}>>;
|
|
575
|
+
}, "strip", z.ZodTypeAny, {
|
|
576
|
+
strategy: "isolated_db";
|
|
577
|
+
encryption?: {
|
|
578
|
+
perTenantKeys: boolean;
|
|
579
|
+
algorithm: string;
|
|
580
|
+
keyManagement?: "custom" | "aws_kms" | "azure_key_vault" | "gcp_kms" | "hashicorp_vault" | undefined;
|
|
581
|
+
} | undefined;
|
|
582
|
+
database?: {
|
|
583
|
+
namingPattern: string;
|
|
584
|
+
serverStrategy: "shared" | "sharded" | "dedicated";
|
|
585
|
+
separateCredentials: boolean;
|
|
586
|
+
autoCreateDatabase: boolean;
|
|
587
|
+
} | undefined;
|
|
588
|
+
connectionPool?: {
|
|
589
|
+
idleTimeout: number;
|
|
590
|
+
poolSize: number;
|
|
591
|
+
maxActivePools: number;
|
|
592
|
+
usePooler: boolean;
|
|
593
|
+
} | undefined;
|
|
594
|
+
backup?: {
|
|
595
|
+
strategy: "on_demand" | "individual" | "consolidated";
|
|
596
|
+
frequencyHours: number;
|
|
597
|
+
retentionDays: number;
|
|
598
|
+
} | undefined;
|
|
599
|
+
}, {
|
|
600
|
+
strategy: "isolated_db";
|
|
601
|
+
encryption?: {
|
|
602
|
+
perTenantKeys?: boolean | undefined;
|
|
603
|
+
algorithm?: string | undefined;
|
|
604
|
+
keyManagement?: "custom" | "aws_kms" | "azure_key_vault" | "gcp_kms" | "hashicorp_vault" | undefined;
|
|
605
|
+
} | undefined;
|
|
606
|
+
database?: {
|
|
607
|
+
namingPattern?: string | undefined;
|
|
608
|
+
serverStrategy?: "shared" | "sharded" | "dedicated" | undefined;
|
|
609
|
+
separateCredentials?: boolean | undefined;
|
|
610
|
+
autoCreateDatabase?: boolean | undefined;
|
|
611
|
+
} | undefined;
|
|
612
|
+
connectionPool?: {
|
|
613
|
+
idleTimeout?: number | undefined;
|
|
614
|
+
poolSize?: number | undefined;
|
|
615
|
+
maxActivePools?: number | undefined;
|
|
616
|
+
usePooler?: boolean | undefined;
|
|
617
|
+
} | undefined;
|
|
618
|
+
backup?: {
|
|
619
|
+
strategy?: "on_demand" | "individual" | "consolidated" | undefined;
|
|
620
|
+
frequencyHours?: number | undefined;
|
|
621
|
+
retentionDays?: number | undefined;
|
|
622
|
+
} | undefined;
|
|
623
|
+
}>;
|
|
624
|
+
export type DatabaseLevelIsolationStrategy = z.infer<typeof DatabaseLevelIsolationStrategySchema>;
|
|
625
|
+
/**
|
|
626
|
+
* Tenant Isolation Configuration Schema
|
|
627
|
+
*
|
|
628
|
+
* Complete configuration for tenant isolation strategy.
|
|
629
|
+
* Supports all three isolation levels with detailed configuration options.
|
|
630
|
+
*/
|
|
631
|
+
export declare const TenantIsolationConfigSchema: z.ZodDiscriminatedUnion<"strategy", [z.ZodObject<{
|
|
632
|
+
strategy: z.ZodLiteral<"shared_schema">;
|
|
633
|
+
/**
|
|
634
|
+
* Database configuration for row-level isolation
|
|
635
|
+
*/
|
|
636
|
+
database: z.ZodOptional<z.ZodObject<{
|
|
637
|
+
/**
|
|
638
|
+
* Whether to enable Row-Level Security (RLS)
|
|
639
|
+
*/
|
|
640
|
+
enableRLS: z.ZodDefault<z.ZodBoolean>;
|
|
641
|
+
/**
|
|
642
|
+
* Tenant context setting method
|
|
643
|
+
*/
|
|
644
|
+
contextMethod: z.ZodDefault<z.ZodEnum<["session_variable", "search_path", "application_name"]>>;
|
|
645
|
+
/**
|
|
646
|
+
* Session variable name for tenant context
|
|
647
|
+
*/
|
|
648
|
+
contextVariable: z.ZodDefault<z.ZodString>;
|
|
649
|
+
/**
|
|
650
|
+
* Whether to validate tenant_id at application level
|
|
651
|
+
*/
|
|
652
|
+
applicationValidation: z.ZodDefault<z.ZodBoolean>;
|
|
653
|
+
}, "strip", z.ZodTypeAny, {
|
|
654
|
+
enableRLS: boolean;
|
|
655
|
+
contextMethod: "session_variable" | "search_path" | "application_name";
|
|
656
|
+
contextVariable: string;
|
|
657
|
+
applicationValidation: boolean;
|
|
658
|
+
}, {
|
|
659
|
+
enableRLS?: boolean | undefined;
|
|
660
|
+
contextMethod?: "session_variable" | "search_path" | "application_name" | undefined;
|
|
661
|
+
contextVariable?: string | undefined;
|
|
662
|
+
applicationValidation?: boolean | undefined;
|
|
663
|
+
}>>;
|
|
664
|
+
/**
|
|
665
|
+
* Performance optimization settings
|
|
666
|
+
*/
|
|
667
|
+
performance: z.ZodOptional<z.ZodObject<{
|
|
668
|
+
/**
|
|
669
|
+
* Whether to use partial indexes for tenant_id
|
|
670
|
+
*/
|
|
671
|
+
usePartialIndexes: z.ZodDefault<z.ZodBoolean>;
|
|
672
|
+
/**
|
|
673
|
+
* Whether to use table partitioning
|
|
674
|
+
*/
|
|
675
|
+
usePartitioning: z.ZodDefault<z.ZodBoolean>;
|
|
676
|
+
/**
|
|
677
|
+
* Connection pool size per tenant
|
|
678
|
+
*/
|
|
679
|
+
poolSizePerTenant: z.ZodOptional<z.ZodNumber>;
|
|
680
|
+
}, "strip", z.ZodTypeAny, {
|
|
681
|
+
usePartialIndexes: boolean;
|
|
682
|
+
usePartitioning: boolean;
|
|
683
|
+
poolSizePerTenant?: number | undefined;
|
|
684
|
+
}, {
|
|
685
|
+
usePartialIndexes?: boolean | undefined;
|
|
686
|
+
usePartitioning?: boolean | undefined;
|
|
687
|
+
poolSizePerTenant?: number | undefined;
|
|
688
|
+
}>>;
|
|
689
|
+
}, "strip", z.ZodTypeAny, {
|
|
690
|
+
strategy: "shared_schema";
|
|
691
|
+
database?: {
|
|
692
|
+
enableRLS: boolean;
|
|
693
|
+
contextMethod: "session_variable" | "search_path" | "application_name";
|
|
694
|
+
contextVariable: string;
|
|
695
|
+
applicationValidation: boolean;
|
|
696
|
+
} | undefined;
|
|
697
|
+
performance?: {
|
|
698
|
+
usePartialIndexes: boolean;
|
|
699
|
+
usePartitioning: boolean;
|
|
700
|
+
poolSizePerTenant?: number | undefined;
|
|
701
|
+
} | undefined;
|
|
702
|
+
}, {
|
|
703
|
+
strategy: "shared_schema";
|
|
704
|
+
database?: {
|
|
705
|
+
enableRLS?: boolean | undefined;
|
|
706
|
+
contextMethod?: "session_variable" | "search_path" | "application_name" | undefined;
|
|
707
|
+
contextVariable?: string | undefined;
|
|
708
|
+
applicationValidation?: boolean | undefined;
|
|
709
|
+
} | undefined;
|
|
710
|
+
performance?: {
|
|
711
|
+
usePartialIndexes?: boolean | undefined;
|
|
712
|
+
usePartitioning?: boolean | undefined;
|
|
713
|
+
poolSizePerTenant?: number | undefined;
|
|
714
|
+
} | undefined;
|
|
715
|
+
}>, z.ZodObject<{
|
|
716
|
+
strategy: z.ZodLiteral<"isolated_schema">;
|
|
717
|
+
/**
|
|
718
|
+
* Schema configuration
|
|
719
|
+
*/
|
|
720
|
+
schema: z.ZodOptional<z.ZodObject<{
|
|
721
|
+
/**
|
|
722
|
+
* Schema naming pattern
|
|
723
|
+
* Use {tenant_id} as placeholder (must contain only alphanumeric and underscores)
|
|
724
|
+
* The tenant_id will be sanitized before substitution to prevent SQL injection
|
|
725
|
+
*/
|
|
726
|
+
namingPattern: z.ZodDefault<z.ZodString>;
|
|
727
|
+
/**
|
|
728
|
+
* Whether to include public schema in search_path
|
|
729
|
+
*/
|
|
730
|
+
includePublicSchema: z.ZodDefault<z.ZodBoolean>;
|
|
731
|
+
/**
|
|
732
|
+
* Default schema for shared resources
|
|
733
|
+
*/
|
|
734
|
+
sharedSchema: z.ZodDefault<z.ZodString>;
|
|
735
|
+
/**
|
|
736
|
+
* Whether to automatically create schema on tenant creation
|
|
737
|
+
*/
|
|
738
|
+
autoCreateSchema: z.ZodDefault<z.ZodBoolean>;
|
|
739
|
+
}, "strip", z.ZodTypeAny, {
|
|
740
|
+
namingPattern: string;
|
|
741
|
+
includePublicSchema: boolean;
|
|
742
|
+
sharedSchema: string;
|
|
743
|
+
autoCreateSchema: boolean;
|
|
744
|
+
}, {
|
|
745
|
+
namingPattern?: string | undefined;
|
|
746
|
+
includePublicSchema?: boolean | undefined;
|
|
747
|
+
sharedSchema?: string | undefined;
|
|
748
|
+
autoCreateSchema?: boolean | undefined;
|
|
749
|
+
}>>;
|
|
750
|
+
/**
|
|
751
|
+
* Migration configuration
|
|
752
|
+
*/
|
|
753
|
+
migrations: z.ZodOptional<z.ZodObject<{
|
|
754
|
+
/**
|
|
755
|
+
* Migration strategy
|
|
756
|
+
*/
|
|
757
|
+
strategy: z.ZodDefault<z.ZodEnum<["parallel", "sequential", "on_demand"]>>;
|
|
758
|
+
/**
|
|
759
|
+
* Maximum concurrent migrations
|
|
760
|
+
*/
|
|
761
|
+
maxConcurrent: z.ZodDefault<z.ZodNumber>;
|
|
762
|
+
/**
|
|
763
|
+
* Whether to rollback on first failure
|
|
764
|
+
*/
|
|
765
|
+
rollbackOnError: z.ZodDefault<z.ZodBoolean>;
|
|
766
|
+
}, "strip", z.ZodTypeAny, {
|
|
767
|
+
strategy: "parallel" | "sequential" | "on_demand";
|
|
768
|
+
maxConcurrent: number;
|
|
769
|
+
rollbackOnError: boolean;
|
|
770
|
+
}, {
|
|
771
|
+
strategy?: "parallel" | "sequential" | "on_demand" | undefined;
|
|
772
|
+
maxConcurrent?: number | undefined;
|
|
773
|
+
rollbackOnError?: boolean | undefined;
|
|
774
|
+
}>>;
|
|
775
|
+
/**
|
|
776
|
+
* Performance optimization settings
|
|
777
|
+
*/
|
|
778
|
+
performance: z.ZodOptional<z.ZodObject<{
|
|
779
|
+
/**
|
|
780
|
+
* Whether to use connection pooling per schema
|
|
781
|
+
*/
|
|
782
|
+
poolPerSchema: z.ZodDefault<z.ZodBoolean>;
|
|
783
|
+
/**
|
|
784
|
+
* Schema cache TTL in seconds
|
|
785
|
+
*/
|
|
786
|
+
schemaCacheTTL: z.ZodDefault<z.ZodNumber>;
|
|
787
|
+
}, "strip", z.ZodTypeAny, {
|
|
788
|
+
poolPerSchema: boolean;
|
|
789
|
+
schemaCacheTTL: number;
|
|
790
|
+
}, {
|
|
791
|
+
poolPerSchema?: boolean | undefined;
|
|
792
|
+
schemaCacheTTL?: number | undefined;
|
|
793
|
+
}>>;
|
|
794
|
+
}, "strip", z.ZodTypeAny, {
|
|
795
|
+
strategy: "isolated_schema";
|
|
796
|
+
schema?: {
|
|
797
|
+
namingPattern: string;
|
|
798
|
+
includePublicSchema: boolean;
|
|
799
|
+
sharedSchema: string;
|
|
800
|
+
autoCreateSchema: boolean;
|
|
801
|
+
} | undefined;
|
|
802
|
+
performance?: {
|
|
803
|
+
poolPerSchema: boolean;
|
|
804
|
+
schemaCacheTTL: number;
|
|
805
|
+
} | undefined;
|
|
806
|
+
migrations?: {
|
|
807
|
+
strategy: "parallel" | "sequential" | "on_demand";
|
|
808
|
+
maxConcurrent: number;
|
|
809
|
+
rollbackOnError: boolean;
|
|
810
|
+
} | undefined;
|
|
811
|
+
}, {
|
|
812
|
+
strategy: "isolated_schema";
|
|
813
|
+
schema?: {
|
|
814
|
+
namingPattern?: string | undefined;
|
|
815
|
+
includePublicSchema?: boolean | undefined;
|
|
816
|
+
sharedSchema?: string | undefined;
|
|
817
|
+
autoCreateSchema?: boolean | undefined;
|
|
818
|
+
} | undefined;
|
|
819
|
+
performance?: {
|
|
820
|
+
poolPerSchema?: boolean | undefined;
|
|
821
|
+
schemaCacheTTL?: number | undefined;
|
|
822
|
+
} | undefined;
|
|
823
|
+
migrations?: {
|
|
824
|
+
strategy?: "parallel" | "sequential" | "on_demand" | undefined;
|
|
825
|
+
maxConcurrent?: number | undefined;
|
|
826
|
+
rollbackOnError?: boolean | undefined;
|
|
827
|
+
} | undefined;
|
|
828
|
+
}>, z.ZodObject<{
|
|
829
|
+
strategy: z.ZodLiteral<"isolated_db">;
|
|
830
|
+
/**
|
|
831
|
+
* Database configuration
|
|
832
|
+
*/
|
|
833
|
+
database: z.ZodOptional<z.ZodObject<{
|
|
834
|
+
/**
|
|
835
|
+
* Database naming pattern
|
|
836
|
+
* Use {tenant_id} as placeholder (must contain only alphanumeric and underscores)
|
|
837
|
+
* The tenant_id will be sanitized before substitution to prevent SQL injection
|
|
838
|
+
*/
|
|
839
|
+
namingPattern: z.ZodDefault<z.ZodString>;
|
|
840
|
+
/**
|
|
841
|
+
* Database server/cluster assignment strategy
|
|
842
|
+
*/
|
|
843
|
+
serverStrategy: z.ZodDefault<z.ZodEnum<["shared", "sharded", "dedicated"]>>;
|
|
844
|
+
/**
|
|
845
|
+
* Whether to use separate credentials per tenant
|
|
846
|
+
*/
|
|
847
|
+
separateCredentials: z.ZodDefault<z.ZodBoolean>;
|
|
848
|
+
/**
|
|
849
|
+
* Whether to automatically create database on tenant creation
|
|
850
|
+
*/
|
|
851
|
+
autoCreateDatabase: z.ZodDefault<z.ZodBoolean>;
|
|
852
|
+
}, "strip", z.ZodTypeAny, {
|
|
853
|
+
namingPattern: string;
|
|
854
|
+
serverStrategy: "shared" | "sharded" | "dedicated";
|
|
855
|
+
separateCredentials: boolean;
|
|
856
|
+
autoCreateDatabase: boolean;
|
|
857
|
+
}, {
|
|
858
|
+
namingPattern?: string | undefined;
|
|
859
|
+
serverStrategy?: "shared" | "sharded" | "dedicated" | undefined;
|
|
860
|
+
separateCredentials?: boolean | undefined;
|
|
861
|
+
autoCreateDatabase?: boolean | undefined;
|
|
862
|
+
}>>;
|
|
863
|
+
/**
|
|
864
|
+
* Connection pooling configuration
|
|
865
|
+
*/
|
|
866
|
+
connectionPool: z.ZodOptional<z.ZodObject<{
|
|
867
|
+
/**
|
|
868
|
+
* Pool size per tenant database
|
|
869
|
+
*/
|
|
870
|
+
poolSize: z.ZodDefault<z.ZodNumber>;
|
|
871
|
+
/**
|
|
872
|
+
* Maximum number of tenant pools to keep active
|
|
873
|
+
*/
|
|
874
|
+
maxActivePools: z.ZodDefault<z.ZodNumber>;
|
|
875
|
+
/**
|
|
876
|
+
* Idle pool timeout in seconds
|
|
877
|
+
*/
|
|
878
|
+
idleTimeout: z.ZodDefault<z.ZodNumber>;
|
|
879
|
+
/**
|
|
880
|
+
* Whether to use connection pooler (PgBouncer, etc.)
|
|
881
|
+
*/
|
|
882
|
+
usePooler: z.ZodDefault<z.ZodBoolean>;
|
|
883
|
+
}, "strip", z.ZodTypeAny, {
|
|
884
|
+
idleTimeout: number;
|
|
885
|
+
poolSize: number;
|
|
886
|
+
maxActivePools: number;
|
|
887
|
+
usePooler: boolean;
|
|
888
|
+
}, {
|
|
889
|
+
idleTimeout?: number | undefined;
|
|
890
|
+
poolSize?: number | undefined;
|
|
891
|
+
maxActivePools?: number | undefined;
|
|
892
|
+
usePooler?: boolean | undefined;
|
|
893
|
+
}>>;
|
|
894
|
+
/**
|
|
895
|
+
* Backup and restore configuration
|
|
896
|
+
*/
|
|
897
|
+
backup: z.ZodOptional<z.ZodObject<{
|
|
898
|
+
/**
|
|
899
|
+
* Backup strategy per tenant
|
|
900
|
+
*/
|
|
901
|
+
strategy: z.ZodDefault<z.ZodEnum<["individual", "consolidated", "on_demand"]>>;
|
|
902
|
+
/**
|
|
903
|
+
* Backup frequency in hours
|
|
904
|
+
*/
|
|
905
|
+
frequencyHours: z.ZodDefault<z.ZodNumber>;
|
|
906
|
+
/**
|
|
907
|
+
* Retention period in days
|
|
908
|
+
*/
|
|
909
|
+
retentionDays: z.ZodDefault<z.ZodNumber>;
|
|
910
|
+
}, "strip", z.ZodTypeAny, {
|
|
911
|
+
strategy: "on_demand" | "individual" | "consolidated";
|
|
912
|
+
frequencyHours: number;
|
|
913
|
+
retentionDays: number;
|
|
914
|
+
}, {
|
|
915
|
+
strategy?: "on_demand" | "individual" | "consolidated" | undefined;
|
|
916
|
+
frequencyHours?: number | undefined;
|
|
917
|
+
retentionDays?: number | undefined;
|
|
918
|
+
}>>;
|
|
919
|
+
/**
|
|
920
|
+
* Encryption configuration
|
|
921
|
+
*/
|
|
922
|
+
encryption: z.ZodOptional<z.ZodObject<{
|
|
923
|
+
/**
|
|
924
|
+
* Whether to use per-tenant encryption keys
|
|
925
|
+
*/
|
|
926
|
+
perTenantKeys: z.ZodDefault<z.ZodBoolean>;
|
|
927
|
+
/**
|
|
928
|
+
* Encryption algorithm
|
|
929
|
+
*/
|
|
930
|
+
algorithm: z.ZodDefault<z.ZodString>;
|
|
931
|
+
/**
|
|
932
|
+
* Key management service
|
|
933
|
+
*/
|
|
934
|
+
keyManagement: z.ZodOptional<z.ZodEnum<["aws_kms", "azure_key_vault", "gcp_kms", "hashicorp_vault", "custom"]>>;
|
|
935
|
+
}, "strip", z.ZodTypeAny, {
|
|
936
|
+
perTenantKeys: boolean;
|
|
937
|
+
algorithm: string;
|
|
938
|
+
keyManagement?: "custom" | "aws_kms" | "azure_key_vault" | "gcp_kms" | "hashicorp_vault" | undefined;
|
|
939
|
+
}, {
|
|
940
|
+
perTenantKeys?: boolean | undefined;
|
|
941
|
+
algorithm?: string | undefined;
|
|
942
|
+
keyManagement?: "custom" | "aws_kms" | "azure_key_vault" | "gcp_kms" | "hashicorp_vault" | undefined;
|
|
943
|
+
}>>;
|
|
944
|
+
}, "strip", z.ZodTypeAny, {
|
|
945
|
+
strategy: "isolated_db";
|
|
946
|
+
encryption?: {
|
|
947
|
+
perTenantKeys: boolean;
|
|
948
|
+
algorithm: string;
|
|
949
|
+
keyManagement?: "custom" | "aws_kms" | "azure_key_vault" | "gcp_kms" | "hashicorp_vault" | undefined;
|
|
950
|
+
} | undefined;
|
|
951
|
+
database?: {
|
|
952
|
+
namingPattern: string;
|
|
953
|
+
serverStrategy: "shared" | "sharded" | "dedicated";
|
|
954
|
+
separateCredentials: boolean;
|
|
955
|
+
autoCreateDatabase: boolean;
|
|
956
|
+
} | undefined;
|
|
957
|
+
connectionPool?: {
|
|
958
|
+
idleTimeout: number;
|
|
959
|
+
poolSize: number;
|
|
960
|
+
maxActivePools: number;
|
|
961
|
+
usePooler: boolean;
|
|
962
|
+
} | undefined;
|
|
963
|
+
backup?: {
|
|
964
|
+
strategy: "on_demand" | "individual" | "consolidated";
|
|
965
|
+
frequencyHours: number;
|
|
966
|
+
retentionDays: number;
|
|
967
|
+
} | undefined;
|
|
968
|
+
}, {
|
|
969
|
+
strategy: "isolated_db";
|
|
970
|
+
encryption?: {
|
|
971
|
+
perTenantKeys?: boolean | undefined;
|
|
972
|
+
algorithm?: string | undefined;
|
|
973
|
+
keyManagement?: "custom" | "aws_kms" | "azure_key_vault" | "gcp_kms" | "hashicorp_vault" | undefined;
|
|
974
|
+
} | undefined;
|
|
975
|
+
database?: {
|
|
976
|
+
namingPattern?: string | undefined;
|
|
977
|
+
serverStrategy?: "shared" | "sharded" | "dedicated" | undefined;
|
|
978
|
+
separateCredentials?: boolean | undefined;
|
|
979
|
+
autoCreateDatabase?: boolean | undefined;
|
|
980
|
+
} | undefined;
|
|
981
|
+
connectionPool?: {
|
|
982
|
+
idleTimeout?: number | undefined;
|
|
983
|
+
poolSize?: number | undefined;
|
|
984
|
+
maxActivePools?: number | undefined;
|
|
985
|
+
usePooler?: boolean | undefined;
|
|
986
|
+
} | undefined;
|
|
987
|
+
backup?: {
|
|
988
|
+
strategy?: "on_demand" | "individual" | "consolidated" | undefined;
|
|
989
|
+
frequencyHours?: number | undefined;
|
|
990
|
+
retentionDays?: number | undefined;
|
|
991
|
+
} | undefined;
|
|
992
|
+
}>]>;
|
|
993
|
+
export type TenantIsolationConfig = z.infer<typeof TenantIsolationConfigSchema>;
|
|
994
|
+
/**
|
|
995
|
+
* Tenant Security Policy Schema
|
|
996
|
+
* Defines security policies and compliance requirements for tenants
|
|
997
|
+
*/
|
|
998
|
+
export declare const TenantSecurityPolicySchema: z.ZodObject<{
|
|
999
|
+
/**
|
|
1000
|
+
* Encryption requirements
|
|
1001
|
+
*/
|
|
1002
|
+
encryption: z.ZodOptional<z.ZodObject<{
|
|
1003
|
+
/**
|
|
1004
|
+
* Require encryption at rest
|
|
1005
|
+
*/
|
|
1006
|
+
atRest: z.ZodDefault<z.ZodBoolean>;
|
|
1007
|
+
/**
|
|
1008
|
+
* Require encryption in transit
|
|
1009
|
+
*/
|
|
1010
|
+
inTransit: z.ZodDefault<z.ZodBoolean>;
|
|
1011
|
+
/**
|
|
1012
|
+
* Require field-level encryption for sensitive data
|
|
1013
|
+
*/
|
|
1014
|
+
fieldLevel: z.ZodDefault<z.ZodBoolean>;
|
|
1015
|
+
}, "strip", z.ZodTypeAny, {
|
|
1016
|
+
atRest: boolean;
|
|
1017
|
+
inTransit: boolean;
|
|
1018
|
+
fieldLevel: boolean;
|
|
1019
|
+
}, {
|
|
1020
|
+
atRest?: boolean | undefined;
|
|
1021
|
+
inTransit?: boolean | undefined;
|
|
1022
|
+
fieldLevel?: boolean | undefined;
|
|
1023
|
+
}>>;
|
|
1024
|
+
/**
|
|
1025
|
+
* Access control requirements
|
|
1026
|
+
*/
|
|
1027
|
+
accessControl: z.ZodOptional<z.ZodObject<{
|
|
1028
|
+
/**
|
|
1029
|
+
* Require multi-factor authentication
|
|
1030
|
+
*/
|
|
1031
|
+
requireMFA: z.ZodDefault<z.ZodBoolean>;
|
|
1032
|
+
/**
|
|
1033
|
+
* Require SSO/SAML authentication
|
|
1034
|
+
*/
|
|
1035
|
+
requireSSO: z.ZodDefault<z.ZodBoolean>;
|
|
1036
|
+
/**
|
|
1037
|
+
* IP whitelist
|
|
1038
|
+
*/
|
|
1039
|
+
ipWhitelist: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
|
|
1040
|
+
/**
|
|
1041
|
+
* Session timeout in seconds
|
|
1042
|
+
*/
|
|
1043
|
+
sessionTimeout: z.ZodDefault<z.ZodNumber>;
|
|
1044
|
+
}, "strip", z.ZodTypeAny, {
|
|
1045
|
+
requireMFA: boolean;
|
|
1046
|
+
requireSSO: boolean;
|
|
1047
|
+
sessionTimeout: number;
|
|
1048
|
+
ipWhitelist?: string[] | undefined;
|
|
1049
|
+
}, {
|
|
1050
|
+
requireMFA?: boolean | undefined;
|
|
1051
|
+
requireSSO?: boolean | undefined;
|
|
1052
|
+
ipWhitelist?: string[] | undefined;
|
|
1053
|
+
sessionTimeout?: number | undefined;
|
|
1054
|
+
}>>;
|
|
1055
|
+
/**
|
|
1056
|
+
* Audit and compliance requirements
|
|
1057
|
+
*/
|
|
1058
|
+
compliance: z.ZodOptional<z.ZodObject<{
|
|
1059
|
+
/**
|
|
1060
|
+
* Compliance standards to enforce
|
|
1061
|
+
*/
|
|
1062
|
+
standards: z.ZodOptional<z.ZodArray<z.ZodEnum<["sox", "hipaa", "gdpr", "pci_dss", "iso_27001", "fedramp"]>, "many">>;
|
|
1063
|
+
/**
|
|
1064
|
+
* Require audit logging for all operations
|
|
1065
|
+
*/
|
|
1066
|
+
requireAuditLog: z.ZodDefault<z.ZodBoolean>;
|
|
1067
|
+
/**
|
|
1068
|
+
* Audit log retention period in days
|
|
1069
|
+
*/
|
|
1070
|
+
auditRetentionDays: z.ZodDefault<z.ZodNumber>;
|
|
1071
|
+
/**
|
|
1072
|
+
* Data residency requirements
|
|
1073
|
+
*/
|
|
1074
|
+
dataResidency: z.ZodOptional<z.ZodObject<{
|
|
1075
|
+
/**
|
|
1076
|
+
* Required geographic region
|
|
1077
|
+
*/
|
|
1078
|
+
region: z.ZodOptional<z.ZodString>;
|
|
1079
|
+
/**
|
|
1080
|
+
* Prohibited regions
|
|
1081
|
+
*/
|
|
1082
|
+
excludeRegions: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
|
|
1083
|
+
}, "strip", z.ZodTypeAny, {
|
|
1084
|
+
region?: string | undefined;
|
|
1085
|
+
excludeRegions?: string[] | undefined;
|
|
1086
|
+
}, {
|
|
1087
|
+
region?: string | undefined;
|
|
1088
|
+
excludeRegions?: string[] | undefined;
|
|
1089
|
+
}>>;
|
|
1090
|
+
}, "strip", z.ZodTypeAny, {
|
|
1091
|
+
requireAuditLog: boolean;
|
|
1092
|
+
auditRetentionDays: number;
|
|
1093
|
+
standards?: ("sox" | "hipaa" | "gdpr" | "pci_dss" | "iso_27001" | "fedramp")[] | undefined;
|
|
1094
|
+
dataResidency?: {
|
|
1095
|
+
region?: string | undefined;
|
|
1096
|
+
excludeRegions?: string[] | undefined;
|
|
1097
|
+
} | undefined;
|
|
1098
|
+
}, {
|
|
1099
|
+
standards?: ("sox" | "hipaa" | "gdpr" | "pci_dss" | "iso_27001" | "fedramp")[] | undefined;
|
|
1100
|
+
requireAuditLog?: boolean | undefined;
|
|
1101
|
+
auditRetentionDays?: number | undefined;
|
|
1102
|
+
dataResidency?: {
|
|
1103
|
+
region?: string | undefined;
|
|
1104
|
+
excludeRegions?: string[] | undefined;
|
|
1105
|
+
} | undefined;
|
|
1106
|
+
}>>;
|
|
1107
|
+
}, "strip", z.ZodTypeAny, {
|
|
1108
|
+
encryption?: {
|
|
1109
|
+
atRest: boolean;
|
|
1110
|
+
inTransit: boolean;
|
|
1111
|
+
fieldLevel: boolean;
|
|
1112
|
+
} | undefined;
|
|
1113
|
+
accessControl?: {
|
|
1114
|
+
requireMFA: boolean;
|
|
1115
|
+
requireSSO: boolean;
|
|
1116
|
+
sessionTimeout: number;
|
|
1117
|
+
ipWhitelist?: string[] | undefined;
|
|
1118
|
+
} | undefined;
|
|
1119
|
+
compliance?: {
|
|
1120
|
+
requireAuditLog: boolean;
|
|
1121
|
+
auditRetentionDays: number;
|
|
1122
|
+
standards?: ("sox" | "hipaa" | "gdpr" | "pci_dss" | "iso_27001" | "fedramp")[] | undefined;
|
|
1123
|
+
dataResidency?: {
|
|
1124
|
+
region?: string | undefined;
|
|
1125
|
+
excludeRegions?: string[] | undefined;
|
|
1126
|
+
} | undefined;
|
|
1127
|
+
} | undefined;
|
|
1128
|
+
}, {
|
|
1129
|
+
encryption?: {
|
|
1130
|
+
atRest?: boolean | undefined;
|
|
1131
|
+
inTransit?: boolean | undefined;
|
|
1132
|
+
fieldLevel?: boolean | undefined;
|
|
1133
|
+
} | undefined;
|
|
1134
|
+
accessControl?: {
|
|
1135
|
+
requireMFA?: boolean | undefined;
|
|
1136
|
+
requireSSO?: boolean | undefined;
|
|
1137
|
+
ipWhitelist?: string[] | undefined;
|
|
1138
|
+
sessionTimeout?: number | undefined;
|
|
1139
|
+
} | undefined;
|
|
1140
|
+
compliance?: {
|
|
1141
|
+
standards?: ("sox" | "hipaa" | "gdpr" | "pci_dss" | "iso_27001" | "fedramp")[] | undefined;
|
|
1142
|
+
requireAuditLog?: boolean | undefined;
|
|
1143
|
+
auditRetentionDays?: number | undefined;
|
|
1144
|
+
dataResidency?: {
|
|
1145
|
+
region?: string | undefined;
|
|
1146
|
+
excludeRegions?: string[] | undefined;
|
|
1147
|
+
} | undefined;
|
|
1148
|
+
} | undefined;
|
|
1149
|
+
}>;
|
|
1150
|
+
export type TenantSecurityPolicy = z.infer<typeof TenantSecurityPolicySchema>;
|
|
1151
|
+
//# sourceMappingURL=tenant.zod.d.ts.map
|