spreads RecordKeySchema across zod validations

This commit is contained in:
sergeyteleshev
2025-08-21 17:08:30 +02:00
parent 9c9e843c98
commit 0e6719b32f
5 changed files with 13 additions and 13 deletions
@@ -1,18 +1,18 @@
/*
* CloudBeaver - Cloud Database Manager
* Copyright (C) 2020-2024 DBeaver Corp and others
* Copyright (C) 2020-2025 DBeaver Corp and others
*
* Licensed under the Apache License, Version 2.0.
* you may not use this file except in compliance with the License.
*/
import { schema } from '@cloudbeaver/core-utils';
import { RecordKeySchema, schema } from '@cloudbeaver/core-utils';
const TEAM_OPTIONS_STATE = schema.object({
teamId: schema.string(),
teamName: schema.string(),
teamPermissions: schema.array(schema.string()),
description: schema.string(),
metaParameters: schema.record(schema.string(), schema.any()),
metaParameters: schema.record(RecordKeySchema, schema.any()),
});
export type ITeamOptionsState = schema.infer<typeof TEAM_OPTIONS_STATE>;
@@ -6,7 +6,7 @@
* you may not use this file except in compliance with the License.
*/
import { NetworkHandlerAuthType } from '@cloudbeaver/core-sdk';
import { schema } from '@cloudbeaver/core-utils';
import { RecordKeySchema, schema } from '@cloudbeaver/core-utils';
export const CONNECTION_NETWORK_HANDLER_SCHEMA = schema.object({
id: schema.string(),
@@ -14,9 +14,9 @@ export const CONNECTION_NETWORK_HANDLER_SCHEMA = schema.object({
enabled: schema.boolean().optional(),
key: schema.string().optional(),
password: schema.string().optional(),
properties: schema.record(schema.string(), schema.any()).optional(),
properties: schema.record(RecordKeySchema, schema.any()).optional(),
savePassword: schema.boolean().optional(),
secureProperties: schema.record(schema.string(), schema.any()).optional(),
secureProperties: schema.record(RecordKeySchema, schema.any()).optional(),
userName: schema.string().optional(),
});
@@ -5,10 +5,10 @@
* Licensed under the Apache License, Version 2.0.
* you may not use this file except in compliance with the License.
*/
import { schema } from '@cloudbeaver/core-utils';
import { schema, RecordKeySchema } from '@cloudbeaver/core-utils';
const CONNECTION_FORM_ORIGIN_INFO_SCHEMA = schema.record(
schema.string(),
RecordKeySchema,
schema.object({
id: schema.string().optional(),
required: schema.boolean(),
@@ -5,7 +5,7 @@
* Licensed under the Apache License, Version 2.0.
* you may not use this file except in compliance with the License.
*/
import { schema } from '@cloudbeaver/core-utils';
import { RecordKeySchema, schema } from '@cloudbeaver/core-utils';
import { OUTPUT_LOG_TYPES } from './SqlResultTabs/OutputLogs/IOutputLogTypes.js';
@@ -49,7 +49,7 @@ export const EXECUTION_PLAN_TAB_SCHEMA = schema.object({
tabId: schema.string(),
order: schema.number(),
query: schema.string(),
options: schema.record(schema.string(), schema.any()).optional(),
options: schema.record(RecordKeySchema, schema.any()).optional(),
});
export type IExecutionPlanTab = schema.infer<typeof EXECUTION_PLAN_TAB_SCHEMA>;
@@ -74,7 +74,7 @@ export const SQL_EDITOR_TAB_STATE_SCHEMA = schema.object({
outputLogsTab: OUTPUT_LOGS_TAB_SCHEMA.optional(),
currentModeId: schema.string().optional(),
modeState: schema.array(schema.tuple([schema.string(), schema.any()])),
metadata: schema.record(schema.string(), schema.any()).optional(),
metadata: schema.record(RecordKeySchema, schema.any()).optional(),
});
export type ISqlEditorTabState = schema.infer<typeof SQL_EDITOR_TAB_STATE_SCHEMA>;
@@ -5,14 +5,14 @@
* Licensed under the Apache License, Version 2.0.
* you may not use this file except in compliance with the License.
*/
import { schema } from '@cloudbeaver/core-utils';
import { RecordKeySchema, schema } from '@cloudbeaver/core-utils';
export const USER_PROFILE_FORM_INFO_PART_STATE_SCHEMA = schema
.object({
userId: schema.string(),
displayName: schema.string().trim(),
authRole: schema.string().optional(),
metaParameters: schema.record(schema.string(), schema.union([schema.string().trim(), schema.any()])).optional(),
metaParameters: schema.record(RecordKeySchema, schema.union([schema.string().trim(), schema.any()])).optional(),
})
.required();