@sqlrooms/sql-editor-config 0.19.0

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/LICENSE.md ADDED
@@ -0,0 +1,9 @@
1
+ MIT License
2
+
3
+ Copyright 2025 Ilya Boyandin
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the “Software”), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
6
+
7
+ The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
8
+
9
+ THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
package/README.md ADDED
@@ -0,0 +1,47 @@
1
+ A central configuration and type definitions package that maintains base SQL editor configuration schemas and Zod schema definitions for SQLRooms. It provides TypeScript types and interfaces along with essential constants and utilities used for managing SQL editor state.
2
+
3
+ ## Features
4
+
5
+ - 📝 **SQL Editor Configuration**: Define and manage room SQL editor configuration schemas.
6
+ - 🔍 **Type Safety**: Strong TypeScript typing for SQL editor configuration objects.
7
+ - ✅ **Validation**: Zod schemas for runtime validation of SQL editor configurations.
8
+
9
+ ## Installation
10
+
11
+ ```bash
12
+ npm install @sqlrooms/sql-editor-config
13
+ # or
14
+ yarn add @sqlrooms/sql-editor-config
15
+ ```
16
+
17
+ ## Basic Usage
18
+
19
+ ### Working with SQL Editor Configuration
20
+
21
+ ```tsx
22
+ import {
23
+ SqlEditorSliceConfig,
24
+ createDefaultSqlEditorConfig,
25
+ } from '@sqlrooms/sql-editor-config';
26
+
27
+ // Create a new SQL editor configuration
28
+ const sqlEditorConfig: SqlEditorSliceConfig = createDefaultSqlEditorConfig();
29
+
30
+ // This can be part of a bigger room configuration
31
+ interface RoomConfig {
32
+ // ... other properties
33
+ sqlEditor: SqlEditorSliceConfig['sqlEditor'];
34
+ }
35
+ ```
36
+
37
+ ## Advanced Features
38
+
39
+ - **Schema Extensions**: Extend base schemas for custom room types
40
+ - **Configuration Validation**: Validate configurations at runtime
41
+ - **Serialization**: Convert configurations to/from JSON for storage
42
+
43
+ For more information, visit the SQLRooms documentation.
44
+
45
+ ```
46
+
47
+ ```
@@ -0,0 +1,59 @@
1
+ import { z } from 'zod';
2
+ export declare const SqlEditorSliceConfig: z.ZodObject<{
3
+ sqlEditor: z.ZodObject<{
4
+ queries: z.ZodArray<z.ZodObject<{
5
+ id: z.ZodString;
6
+ name: z.ZodString;
7
+ query: z.ZodString;
8
+ }, "strip", z.ZodTypeAny, {
9
+ id: string;
10
+ name: string;
11
+ query: string;
12
+ }, {
13
+ id: string;
14
+ name: string;
15
+ query: string;
16
+ }>, "many">;
17
+ selectedQueryId: z.ZodDefault<z.ZodString>;
18
+ lastExecutedQuery: z.ZodOptional<z.ZodString>;
19
+ }, "strip", z.ZodTypeAny, {
20
+ queries: {
21
+ id: string;
22
+ name: string;
23
+ query: string;
24
+ }[];
25
+ selectedQueryId: string;
26
+ lastExecutedQuery?: string | undefined;
27
+ }, {
28
+ queries: {
29
+ id: string;
30
+ name: string;
31
+ query: string;
32
+ }[];
33
+ selectedQueryId?: string | undefined;
34
+ lastExecutedQuery?: string | undefined;
35
+ }>;
36
+ }, "strip", z.ZodTypeAny, {
37
+ sqlEditor: {
38
+ queries: {
39
+ id: string;
40
+ name: string;
41
+ query: string;
42
+ }[];
43
+ selectedQueryId: string;
44
+ lastExecutedQuery?: string | undefined;
45
+ };
46
+ }, {
47
+ sqlEditor: {
48
+ queries: {
49
+ id: string;
50
+ name: string;
51
+ query: string;
52
+ }[];
53
+ selectedQueryId?: string | undefined;
54
+ lastExecutedQuery?: string | undefined;
55
+ };
56
+ }>;
57
+ export type SqlEditorSliceConfig = z.infer<typeof SqlEditorSliceConfig>;
58
+ export declare function createDefaultSqlEditorConfig(): SqlEditorSliceConfig;
59
+ //# sourceMappingURL=SqlEditorSliceConfig.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"SqlEditorSliceConfig.d.ts","sourceRoot":"","sources":["../src/SqlEditorSliceConfig.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,CAAC,EAAC,MAAM,KAAK,CAAC;AAGtB,eAAO,MAAM,oBAAoB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAe/B,CAAC;AACH,MAAM,MAAM,oBAAoB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,oBAAoB,CAAC,CAAC;AAExE,wBAAgB,4BAA4B,IAAI,oBAAoB,CAOnE"}
@@ -0,0 +1,25 @@
1
+ import { z } from 'zod';
2
+ // Saved state (persisted)
3
+ export const SqlEditorSliceConfig = z.object({
4
+ sqlEditor: z.object({
5
+ queries: z.array(z.object({
6
+ id: z.string().describe('Query identifier.'),
7
+ name: z.string().describe('Query name.'),
8
+ query: z.string().describe('SQL query to execute.'),
9
+ })),
10
+ selectedQueryId: z
11
+ .string()
12
+ .default('default')
13
+ .describe('The id of the currently selected query.'),
14
+ lastExecutedQuery: z.string().optional().describe('Last executed query'),
15
+ }),
16
+ });
17
+ export function createDefaultSqlEditorConfig() {
18
+ return {
19
+ sqlEditor: {
20
+ queries: [{ id: 'default', name: 'Untitled', query: '' }],
21
+ selectedQueryId: 'default',
22
+ },
23
+ };
24
+ }
25
+ //# sourceMappingURL=SqlEditorSliceConfig.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"SqlEditorSliceConfig.js","sourceRoot":"","sources":["../src/SqlEditorSliceConfig.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,CAAC,EAAC,MAAM,KAAK,CAAC;AAEtB,0BAA0B;AAC1B,MAAM,CAAC,MAAM,oBAAoB,GAAG,CAAC,CAAC,MAAM,CAAC;IAC3C,SAAS,EAAE,CAAC,CAAC,MAAM,CAAC;QAClB,OAAO,EAAE,CAAC,CAAC,KAAK,CACd,CAAC,CAAC,MAAM,CAAC;YACP,EAAE,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,CAAC,mBAAmB,CAAC;YAC5C,IAAI,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,CAAC,aAAa,CAAC;YACxC,KAAK,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,CAAC,uBAAuB,CAAC;SACpD,CAAC,CACH;QACD,eAAe,EAAE,CAAC;aACf,MAAM,EAAE;aACR,OAAO,CAAC,SAAS,CAAC;aAClB,QAAQ,CAAC,yCAAyC,CAAC;QACtD,iBAAiB,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE,CAAC,QAAQ,CAAC,qBAAqB,CAAC;KACzE,CAAC;CACH,CAAC,CAAC;AAGH,MAAM,UAAU,4BAA4B;IAC1C,OAAO;QACL,SAAS,EAAE;YACT,OAAO,EAAE,CAAC,EAAC,EAAE,EAAE,SAAS,EAAE,IAAI,EAAE,UAAU,EAAE,KAAK,EAAE,EAAE,EAAC,CAAC;YACvD,eAAe,EAAE,SAAS;SAC3B;KACF,CAAC;AACJ,CAAC","sourcesContent":["import {z} from 'zod';\n\n// Saved state (persisted)\nexport const SqlEditorSliceConfig = z.object({\n sqlEditor: z.object({\n queries: z.array(\n z.object({\n id: z.string().describe('Query identifier.'),\n name: z.string().describe('Query name.'),\n query: z.string().describe('SQL query to execute.'),\n }),\n ),\n selectedQueryId: z\n .string()\n .default('default')\n .describe('The id of the currently selected query.'),\n lastExecutedQuery: z.string().optional().describe('Last executed query'),\n }),\n});\nexport type SqlEditorSliceConfig = z.infer<typeof SqlEditorSliceConfig>;\n\nexport function createDefaultSqlEditorConfig(): SqlEditorSliceConfig {\n return {\n sqlEditor: {\n queries: [{id: 'default', name: 'Untitled', query: ''}],\n selectedQueryId: 'default',\n },\n };\n}\n"]}
@@ -0,0 +1,6 @@
1
+ /**
2
+ * {@include ../README.md}
3
+ * @packageDocumentation
4
+ */
5
+ export * from './SqlEditorSliceConfig';
6
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,cAAc,wBAAwB,CAAC"}
package/dist/index.js ADDED
@@ -0,0 +1,6 @@
1
+ /**
2
+ * {@include ../README.md}
3
+ * @packageDocumentation
4
+ */
5
+ export * from './SqlEditorSliceConfig';
6
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,cAAc,wBAAwB,CAAC","sourcesContent":["/**\n * {@include ../README.md}\n * @packageDocumentation\n */\n\nexport * from './SqlEditorSliceConfig';\n"]}
package/package.json ADDED
@@ -0,0 +1,31 @@
1
+ {
2
+ "name": "@sqlrooms/sql-editor-config",
3
+ "version": "0.19.0",
4
+ "main": "dist/index.js",
5
+ "types": "dist/index.d.ts",
6
+ "module": "dist/index.js",
7
+ "type": "module",
8
+ "author": "Ilya Boyandin <ilya@boyandin.me>",
9
+ "license": "MIT",
10
+ "repository": {
11
+ "type": "git",
12
+ "url": "https://github.com/sqlrooms/sqlrooms.git"
13
+ },
14
+ "files": [
15
+ "dist"
16
+ ],
17
+ "publishConfig": {
18
+ "access": "public"
19
+ },
20
+ "dependencies": {
21
+ "zod": "^3.25.57"
22
+ },
23
+ "scripts": {
24
+ "dev": "tsc -w",
25
+ "build": "tsc",
26
+ "lint": "eslint .",
27
+ "typecheck": "tsc --noEmit",
28
+ "typedoc": "typedoc"
29
+ },
30
+ "gitHead": "ba6000f1e06d3ab01e309d805b5d187b32c9ff06"
31
+ }