@coldsmirk/inkstone-sql 0.13.0 → 0.14.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 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` (KingbaseES rides `postgres`, OceanBase's MySQL mode rides `mysql`).
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: KingbaseES connects and completes as `postgres`, an OceanBase MySQL deployment as
10
- * `mysql`, and 达梦 (`dm`) carries Oracle's idiom wherever it documents Oracle compatibility.
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,4 +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-gLTZKSD3.js";
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";
2
2
 
3
3
  //#region src/functions.d.ts
4
4
  /**
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: dialect([
120
- "limit",
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
- open: "\"",
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;
@@ -1126,7 +1136,8 @@ const DIALECTS = {
1126
1136
  mysql: "mysql",
1127
1137
  oracle: "plsql",
1128
1138
  dm: "plsql",
1129
- sqlserver: "transactsql"
1139
+ sqlserver: "transactsql",
1140
+ kingbase: "postgresql"
1130
1141
  };
1131
1142
  const PLACEHOLDERS = String.raw`\?|:[A-Za-z_]\w*`;
1132
1143
  function sentinelFor(text) {
@@ -1398,7 +1409,8 @@ const NATIVE_GROUP = {
1398
1409
  mysql: null,
1399
1410
  oracle: "colonDigits",
1400
1411
  sqlserver: "atDigits",
1401
- dm: null
1412
+ dm: null,
1413
+ kingbase: "dollarDigits"
1402
1414
  };
1403
1415
  function statementMarkers(statement, kind) {
1404
1416
  const names = [];
package/dist/monaco.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- import { t as SqlAssist } from "./assist-gLTZKSD3.js";
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
4
 
package/dist/react.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- import { t as SqlAssist } from "./assist-gLTZKSD3.js";
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";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@coldsmirk/inkstone-sql",
3
- "version": "0.13.0",
3
+ "version": "0.14.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",
@@ -49,12 +49,12 @@
49
49
  "monaco-editor": "^0.55.1",
50
50
  "react": "^19.2.7",
51
51
  "react-dom": "^19.2.7",
52
- "@coldsmirk/inkstone-react": "^0.13.0"
52
+ "@coldsmirk/inkstone-react": "^0.14.0"
53
53
  },
54
54
  "peerDependencies": {
55
55
  "monaco-editor": "^0.55.1",
56
56
  "react": ">=19",
57
- "@coldsmirk/inkstone-react": "^0.13.0"
57
+ "@coldsmirk/inkstone-react": "^0.14.0"
58
58
  },
59
59
  "peerDependenciesMeta": {
60
60
  "@coldsmirk/inkstone-react": {