@coldsmirk/inkstone-sql 0.13.0 → 0.15.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/README.md +1 -1
- package/dist/{assist-gLTZKSD3.d.ts → assist-B5eZ0e5W.d.ts} +6 -3
- package/dist/index.d.ts +1 -2
- package/dist/index.js +71 -57
- package/dist/monaco.d.ts +1 -2
- package/dist/react.d.ts +2 -24
- package/package.json +7 -7
package/README.md
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
Schema-aware SQL editing intelligence for Monaco: lexical statement reading under per-dialect noise profiles, catalog-driven completion / hover / signature help, unified-placeholder awareness, `sql-formatter` integration, and a drop-in React `<SqlEditor>`.
|
|
4
4
|
|
|
5
|
-
Part of [inkstone](https://github.com/coldsmirk/inkstone). Extracted from dragoman's SQL console; built for the [**polyglot**](https://github.com/coldsmirk/polyglot) unified-placeholder surface — the SQL its scanner rebinds (`?` positional / `:name` named, `??` and `::` escapes) across `postgres` / `mysql` / `oracle` / `sqlserver` / `dm`
|
|
5
|
+
Part of [inkstone](https://github.com/coldsmirk/inkstone). Extracted from dragoman's SQL console; built for the [**polyglot**](https://github.com/coldsmirk/polyglot) unified-placeholder surface — the SQL its scanner rebinds (`?` positional / `:name` named, `??` and `::` escapes) across `postgres` / `mysql` / `oracle` / `sqlserver` / `dm` / `kingbase` (OceanBase's MySQL mode rides `mysql`).
|
|
6
6
|
|
|
7
7
|
## Entries
|
|
8
8
|
|
|
@@ -6,10 +6,13 @@
|
|
|
6
6
|
*/
|
|
7
7
|
/**
|
|
8
8
|
* One supported database dialect. A kind is added when a kind-specific *behavior* exists, not per
|
|
9
|
-
* brand name:
|
|
10
|
-
* `
|
|
9
|
+
* brand name: an OceanBase MySQL deployment connects and completes as `mysql`, a
|
|
10
|
+
* PostgreSQL-protocol database with no surface of its own as `postgres`, and 达梦 (`dm`) carries
|
|
11
|
+
* Oracle's idiom wherever it documents Oracle compatibility. KingbaseES (`kingbase`) earned its
|
|
12
|
+
* own kind when the engine grew one — the vendor's own driver behind a PostgreSQL surface — and
|
|
13
|
+
* reads here as the Postgres idiom throughout, mirroring its engine profile flag for flag.
|
|
11
14
|
*/
|
|
12
|
-
type SqlKind = "postgres" | "mysql" | "oracle" | "sqlserver" | "dm";
|
|
15
|
+
type SqlKind = "postgres" | "mysql" | "oracle" | "sqlserver" | "dm" | "kingbase";
|
|
13
16
|
/**
|
|
14
17
|
* One table or view as the catalog reports it. Names carry the vendor's own casing — that casing
|
|
15
18
|
* is information, and everything downstream preserves it.
|
package/dist/index.d.ts
CHANGED
|
@@ -1,5 +1,4 @@
|
|
|
1
|
-
import { C as CatalogTable, S as CatalogFunction, _ as readCall, a as createSqlAssist, b as runnableStatement, c as SqlSource, d as CallRead, f as IdentifierRead, g as TableRef, h as StatementRead, i as SqlSignatureHelp, l as createSqlSchema, m as StatementContext, n as SqlCompletionCandidate, o as SqlCatalog, p as Runnable, r as SqlHoverCard, s as SqlSchema, t as SqlAssist, u as qualifiedName, v as readIdentifier, w as SqlKind, x as CatalogColumn, y as readStatement } from "./assist-
|
|
2
|
-
|
|
1
|
+
import { C as CatalogTable, S as CatalogFunction, _ as readCall, a as createSqlAssist, b as runnableStatement, c as SqlSource, d as CallRead, f as IdentifierRead, g as TableRef, h as StatementRead, i as SqlSignatureHelp, l as createSqlSchema, m as StatementContext, n as SqlCompletionCandidate, o as SqlCatalog, p as Runnable, r as SqlHoverCard, s as SqlSchema, t as SqlAssist, u as qualifiedName, v as readIdentifier, w as SqlKind, x as CatalogColumn, y as readStatement } from "./assist-B5eZ0e5W.js";
|
|
3
2
|
//#region src/functions.d.ts
|
|
4
3
|
/**
|
|
5
4
|
* The function vocabulary this bench speaks: the curated floor this project wrote
|
package/dist/index.js
CHANGED
|
@@ -115,43 +115,45 @@ const ORACLE$1 = dialect([
|
|
|
115
115
|
LEAST,
|
|
116
116
|
fn("listagg", "listagg(expr, delimiter)", "Aggregate: joins with a delimiter; needs `within group (order by …)`.")
|
|
117
117
|
]);
|
|
118
|
+
const POSTGRES$1 = dialect([
|
|
119
|
+
"limit",
|
|
120
|
+
"offset",
|
|
121
|
+
"returning",
|
|
122
|
+
"ilike",
|
|
123
|
+
"lateral",
|
|
124
|
+
"conflict",
|
|
125
|
+
"do",
|
|
126
|
+
"nothing",
|
|
127
|
+
"recursive",
|
|
128
|
+
"fetch",
|
|
129
|
+
"first",
|
|
130
|
+
"next",
|
|
131
|
+
"rows",
|
|
132
|
+
"only",
|
|
133
|
+
"true",
|
|
134
|
+
"false",
|
|
135
|
+
"current_date",
|
|
136
|
+
"current_timestamp"
|
|
137
|
+
], [
|
|
138
|
+
fn("now", "now()", "Current date and time."),
|
|
139
|
+
TO_CHAR,
|
|
140
|
+
TO_DATE,
|
|
141
|
+
fn("to_timestamp", "to_timestamp(text, format)", "Parses text into a timestamp through a format string."),
|
|
142
|
+
EXTRACT,
|
|
143
|
+
fn("date_trunc", "date_trunc(field, source)", "Truncates a timestamp to a precision, as in `date_trunc('day', created_at)`."),
|
|
144
|
+
fn("concat", "concat(value, …)", "Joins the arguments as text, treating NULL as an empty string."),
|
|
145
|
+
SUBSTRING,
|
|
146
|
+
fn("length", "length(text)", "Characters in the string."),
|
|
147
|
+
GREATEST,
|
|
148
|
+
LEAST,
|
|
149
|
+
fn("string_agg", "string_agg(expr, delimiter)", "Aggregate: joins each row's value with a delimiter."),
|
|
150
|
+
fn("array_agg", "array_agg(expr)", "Aggregate: collects each row's value into an array."),
|
|
151
|
+
fn("jsonb_agg", "jsonb_agg(expr)", "Aggregate: collects each row's value into a JSON array."),
|
|
152
|
+
fn("jsonb_build_object", "jsonb_build_object(key, value, …)", "Builds a JSON object from alternating key and value arguments.")
|
|
153
|
+
]);
|
|
118
154
|
const SQL_DIALECTS = {
|
|
119
|
-
postgres:
|
|
120
|
-
|
|
121
|
-
"offset",
|
|
122
|
-
"returning",
|
|
123
|
-
"ilike",
|
|
124
|
-
"lateral",
|
|
125
|
-
"conflict",
|
|
126
|
-
"do",
|
|
127
|
-
"nothing",
|
|
128
|
-
"recursive",
|
|
129
|
-
"fetch",
|
|
130
|
-
"first",
|
|
131
|
-
"next",
|
|
132
|
-
"rows",
|
|
133
|
-
"only",
|
|
134
|
-
"true",
|
|
135
|
-
"false",
|
|
136
|
-
"current_date",
|
|
137
|
-
"current_timestamp"
|
|
138
|
-
], [
|
|
139
|
-
fn("now", "now()", "Current date and time."),
|
|
140
|
-
TO_CHAR,
|
|
141
|
-
TO_DATE,
|
|
142
|
-
fn("to_timestamp", "to_timestamp(text, format)", "Parses text into a timestamp through a format string."),
|
|
143
|
-
EXTRACT,
|
|
144
|
-
fn("date_trunc", "date_trunc(field, source)", "Truncates a timestamp to a precision, as in `date_trunc('day', created_at)`."),
|
|
145
|
-
fn("concat", "concat(value, …)", "Joins the arguments as text, treating NULL as an empty string."),
|
|
146
|
-
SUBSTRING,
|
|
147
|
-
fn("length", "length(text)", "Characters in the string."),
|
|
148
|
-
GREATEST,
|
|
149
|
-
LEAST,
|
|
150
|
-
fn("string_agg", "string_agg(expr, delimiter)", "Aggregate: joins each row's value with a delimiter."),
|
|
151
|
-
fn("array_agg", "array_agg(expr)", "Aggregate: collects each row's value into an array."),
|
|
152
|
-
fn("jsonb_agg", "jsonb_agg(expr)", "Aggregate: collects each row's value into a JSON array."),
|
|
153
|
-
fn("jsonb_build_object", "jsonb_build_object(key, value, …)", "Builds a JSON object from alternating key and value arguments.")
|
|
154
|
-
]),
|
|
155
|
+
postgres: POSTGRES$1,
|
|
156
|
+
kingbase: POSTGRES$1,
|
|
155
157
|
mysql: dialect([
|
|
156
158
|
"limit",
|
|
157
159
|
"offset",
|
|
@@ -325,13 +327,15 @@ const ORACLE = {
|
|
|
325
327
|
regular: /^[A-Z][A-Z0-9_$#]*$/,
|
|
326
328
|
reserved: ORACLE_RESERVED
|
|
327
329
|
};
|
|
330
|
+
const POSTGRES = {
|
|
331
|
+
open: "\"",
|
|
332
|
+
close: "\"",
|
|
333
|
+
regular: /^[a-z_][a-z0-9_$]*$/,
|
|
334
|
+
reserved: POSTGRES_RESERVED
|
|
335
|
+
};
|
|
328
336
|
const SPELLINGS = {
|
|
329
|
-
postgres:
|
|
330
|
-
|
|
331
|
-
close: "\"",
|
|
332
|
-
regular: /^[a-z_][a-z0-9_$]*$/,
|
|
333
|
-
reserved: POSTGRES_RESERVED
|
|
334
|
-
},
|
|
337
|
+
postgres: POSTGRES,
|
|
338
|
+
kingbase: POSTGRES,
|
|
335
339
|
mysql: {
|
|
336
340
|
open: "`",
|
|
337
341
|
close: "`",
|
|
@@ -445,7 +449,13 @@ const NOISE_PROFILES = {
|
|
|
445
449
|
...BASE,
|
|
446
450
|
bracketIdentifiers: true
|
|
447
451
|
},
|
|
448
|
-
dm: BASE
|
|
452
|
+
dm: BASE,
|
|
453
|
+
kingbase: {
|
|
454
|
+
...BASE,
|
|
455
|
+
escapeStrings: true,
|
|
456
|
+
nestedBlockComments: true,
|
|
457
|
+
dollarQuoting: true
|
|
458
|
+
}
|
|
449
459
|
};
|
|
450
460
|
const WORD_START = /[a-z_\u{0080}-\u{FFFF}]/iu;
|
|
451
461
|
const WORD_BYTE = /[\w$\u{0080}-\u{FFFF}]/u;
|
|
@@ -459,12 +469,13 @@ const ALTERNATIVE_QUOTE_CLOSE = {
|
|
|
459
469
|
function closeDelimited(text, from, delimiter, backslash) {
|
|
460
470
|
let at = from;
|
|
461
471
|
while (at < text.length) if (backslash && text[at] === "\\" && at + 1 < text.length) at += 2;
|
|
462
|
-
else if (text[at] === delimiter)
|
|
463
|
-
|
|
464
|
-
|
|
465
|
-
|
|
466
|
-
|
|
467
|
-
|
|
472
|
+
else if (text[at] === delimiter) {
|
|
473
|
+
if (text[at + 1] === delimiter) at += 2;
|
|
474
|
+
else return {
|
|
475
|
+
end: at + 1,
|
|
476
|
+
sealed: true
|
|
477
|
+
};
|
|
478
|
+
} else at += 1;
|
|
468
479
|
return {
|
|
469
480
|
end: text.length,
|
|
470
481
|
sealed: false
|
|
@@ -472,12 +483,13 @@ function closeDelimited(text, from, delimiter, backslash) {
|
|
|
472
483
|
}
|
|
473
484
|
function closeBracket(text, from) {
|
|
474
485
|
let at = from;
|
|
475
|
-
while (at < text.length) if (text[at] === "]")
|
|
476
|
-
|
|
477
|
-
|
|
478
|
-
|
|
479
|
-
|
|
480
|
-
|
|
486
|
+
while (at < text.length) if (text[at] === "]") {
|
|
487
|
+
if (text[at + 1] === "]") at += 2;
|
|
488
|
+
else return {
|
|
489
|
+
end: at + 1,
|
|
490
|
+
sealed: true
|
|
491
|
+
};
|
|
492
|
+
} else at += 1;
|
|
481
493
|
return {
|
|
482
494
|
end: text.length,
|
|
483
495
|
sealed: false
|
|
@@ -1126,7 +1138,8 @@ const DIALECTS = {
|
|
|
1126
1138
|
mysql: "mysql",
|
|
1127
1139
|
oracle: "plsql",
|
|
1128
1140
|
dm: "plsql",
|
|
1129
|
-
sqlserver: "transactsql"
|
|
1141
|
+
sqlserver: "transactsql",
|
|
1142
|
+
kingbase: "postgresql"
|
|
1130
1143
|
};
|
|
1131
1144
|
const PLACEHOLDERS = String.raw`\?|:[A-Za-z_]\w*`;
|
|
1132
1145
|
function sentinelFor(text) {
|
|
@@ -1398,7 +1411,8 @@ const NATIVE_GROUP = {
|
|
|
1398
1411
|
mysql: null,
|
|
1399
1412
|
oracle: "colonDigits",
|
|
1400
1413
|
sqlserver: "atDigits",
|
|
1401
|
-
dm: null
|
|
1414
|
+
dm: null,
|
|
1415
|
+
kingbase: "dollarDigits"
|
|
1402
1416
|
};
|
|
1403
1417
|
function statementMarkers(statement, kind) {
|
|
1404
1418
|
const names = [];
|
package/dist/monaco.d.ts
CHANGED
|
@@ -1,7 +1,6 @@
|
|
|
1
|
-
import { t as SqlAssist } from "./assist-
|
|
1
|
+
import { t as SqlAssist } from "./assist-B5eZ0e5W.js";
|
|
2
2
|
import * as monacoEditor from "monaco-editor";
|
|
3
3
|
import { IDisposable } from "monaco-editor";
|
|
4
|
-
|
|
5
4
|
//#region src/monaco.d.ts
|
|
6
5
|
/**
|
|
7
6
|
* The monaco module itself, as `onMount` hands it over — typed structurally so this entry needs
|
package/dist/react.d.ts
CHANGED
|
@@ -1,8 +1,7 @@
|
|
|
1
|
-
import { t as SqlAssist } from "./assist-
|
|
1
|
+
import { t as SqlAssist } from "./assist-B5eZ0e5W.js";
|
|
2
2
|
import { MonacoModule } from "./monaco.js";
|
|
3
3
|
import { ReactNode } from "react";
|
|
4
4
|
import { editor } from "monaco-editor";
|
|
5
|
-
|
|
6
5
|
//#region src/react.d.ts
|
|
7
6
|
/**
|
|
8
7
|
* What a host needs to reach into the editor for: inserting at the caret (a schema tree is an
|
|
@@ -132,27 +131,6 @@ interface SqlEditorProps {
|
|
|
132
131
|
* The editor draws no chrome of its own: it is a band of its host's surface, and the separation
|
|
133
132
|
* is the host's hairline rules — a border here would dress a pane up as a form input.
|
|
134
133
|
*/
|
|
135
|
-
declare function SqlEditor({
|
|
136
|
-
value,
|
|
137
|
-
onChange,
|
|
138
|
-
dark,
|
|
139
|
-
height,
|
|
140
|
-
fontSize,
|
|
141
|
-
locale,
|
|
142
|
-
placeholder,
|
|
143
|
-
ariaLabel,
|
|
144
|
-
languageId,
|
|
145
|
-
loading,
|
|
146
|
-
failure,
|
|
147
|
-
onRun,
|
|
148
|
-
runActionLabel,
|
|
149
|
-
onCaret,
|
|
150
|
-
highlight,
|
|
151
|
-
highlightClassName,
|
|
152
|
-
onFormatRefused,
|
|
153
|
-
onReady,
|
|
154
|
-
onMount,
|
|
155
|
-
assist
|
|
156
|
-
}: SqlEditorProps): import("react").JSX.Element;
|
|
134
|
+
declare function SqlEditor({ value, onChange, dark, height, fontSize, locale, placeholder, ariaLabel, languageId, loading, failure, onRun, runActionLabel, onCaret, highlight, highlightClassName, onFormatRefused, onReady, onMount, assist }: SqlEditorProps): import("react").JSX.Element;
|
|
157
135
|
//#endregion
|
|
158
136
|
export { SqlCaret, SqlEditor, SqlEditorHandle, SqlEditorProps };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@coldsmirk/inkstone-sql",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.15.0",
|
|
4
4
|
"description": "Schema-aware SQL editing intelligence for Monaco: lexical statement reading under per-dialect noise profiles, catalog-driven completion/hover/signature help, unified-placeholder awareness, formatting, and a drop-in React SQL editor.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"sql",
|
|
@@ -46,15 +46,15 @@
|
|
|
46
46
|
"sql-formatter": "^15.8.2"
|
|
47
47
|
},
|
|
48
48
|
"devDependencies": {
|
|
49
|
-
"monaco-editor": "^0.
|
|
50
|
-
"react": "^19.2.
|
|
51
|
-
"react-dom": "^19.2.
|
|
52
|
-
"@coldsmirk/inkstone-react": "^0.
|
|
49
|
+
"monaco-editor": "^0.56.0",
|
|
50
|
+
"react": "^19.2.8",
|
|
51
|
+
"react-dom": "^19.2.8",
|
|
52
|
+
"@coldsmirk/inkstone-react": "^0.15.0"
|
|
53
53
|
},
|
|
54
54
|
"peerDependencies": {
|
|
55
|
-
"monaco-editor": "^0.
|
|
55
|
+
"monaco-editor": "^0.56.0",
|
|
56
56
|
"react": ">=19",
|
|
57
|
-
"@coldsmirk/inkstone-react": "^0.
|
|
57
|
+
"@coldsmirk/inkstone-react": "^0.15.0"
|
|
58
58
|
},
|
|
59
59
|
"peerDependenciesMeta": {
|
|
60
60
|
"@coldsmirk/inkstone-react": {
|