@arcgis/coding-components 5.1.0-next.55 → 5.1.0-next.56
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/cdn/{PKG2K3V2.js → 23B5EVBR.js} +1 -1
- package/dist/cdn/2RXM4OOZ.js +2 -0
- package/dist/cdn/2XTHR2WZ.js +2 -0
- package/dist/cdn/5PWITOEV.js +2 -0
- package/dist/cdn/A53COIII.js +6 -0
- package/dist/cdn/AESP7B22.js +2 -0
- package/dist/cdn/AHN2NEBT.js +2 -0
- package/dist/cdn/{54ZOADNQ.js → BXUVVQLE.js} +1 -1
- package/dist/cdn/BYHBHJML.js +2 -0
- package/dist/cdn/CLBLJN2Z.js +7 -0
- package/dist/cdn/CZ2DJPO4.js +2 -0
- package/dist/cdn/DGFH2WPL.js +2 -0
- package/dist/cdn/{RJRCBNNO.js → DJYSIOXC.js} +1 -1
- package/dist/cdn/FLNLMLTL.js +2 -0
- package/dist/cdn/ITDFOKJG.js +2 -0
- package/dist/cdn/MH4UADDE.js +2 -0
- package/dist/cdn/{UZJHWA6T.js → ODKUCLFB.js} +1 -1
- package/dist/cdn/{PVL67WGX.js → PD5NEK47.js} +1 -1
- package/dist/cdn/PRB6IWVU.js +2 -0
- package/dist/cdn/{4A2CLADY.js → QCARFVF7.js} +1 -1
- package/dist/cdn/{6YD47X7H.js → QF6ON7LK.js} +1 -1
- package/dist/cdn/QRDRCFJZ.js +2 -0
- package/dist/cdn/SV4IPD4A.js +2 -0
- package/dist/cdn/UH44LJA7.js +4 -0
- package/dist/cdn/VF7TALAI.js +12 -0
- package/dist/cdn/VPP77CFW.js +2 -0
- package/dist/cdn/YPMKBMXS.js +2 -0
- package/dist/cdn/ZHZFKZA7.js +2 -0
- package/dist/cdn/assets/arcade-editor/t9n/messages.en.json +1 -1
- package/dist/cdn/assets/code-editor/sql-expr.worker.js +119 -116
- package/dist/cdn/assets/code-editor/sql-layer.worker.js +10087 -0
- package/dist/cdn/assets/editor-variables/t9n/messages.en.json +1 -1
- package/dist/cdn/assets/sql-expression-editor/t9n/messages.en.json +1 -1
- package/dist/cdn/assets/sql-layer-editor/t9n/messages.en.json +1 -0
- package/dist/cdn/index.js +1 -1
- package/dist/cdn/main.css +1 -1
- package/dist/chunks/arcade-defaults.js +98 -96
- package/dist/chunks/arcade-service-accessors.js +40 -28
- package/dist/chunks/bigquery.js +186 -0
- package/dist/chunks/colorize.js +1 -1
- package/dist/chunks/fields.js +2 -2
- package/dist/chunks/language-defaults-base.js +733 -464
- package/dist/chunks/postgres.js +209 -0
- package/dist/chunks/setup-monaco-theme.js +28 -20
- package/dist/chunks/sql-expr-defaults.js +11 -10
- package/dist/chunks/sql-layer-defaults.js +231 -0
- package/dist/chunks/sql-layer-mode.js +301 -0
- package/dist/chunks/sqlServer.js +288 -0
- package/dist/chunks/utils.js +184 -0
- package/dist/components/arcgis-arcade-coding-assistant/customElement.js +134 -123
- package/dist/components/arcgis-arcade-editor/customElement.d.ts +17 -0
- package/dist/components/arcgis-arcade-editor/customElement.js +22 -22
- package/dist/components/arcgis-code-editor/customElement.d.ts +2 -1
- package/dist/components/arcgis-code-editor/customElement.js +91 -71
- package/dist/components/arcgis-editor-variables/customElement.js +50 -47
- package/dist/components/arcgis-sql-expression-editor/customElement.d.ts +12 -0
- package/dist/components/arcgis-sql-expression-editor/customElement.js +17 -17
- package/dist/components/arcgis-sql-layer-editor/customElement.d.ts +50 -0
- package/dist/components/arcgis-sql-layer-editor/customElement.js +92 -0
- package/dist/components/arcgis-sql-layer-editor/index.d.ts +1 -0
- package/dist/components/arcgis-sql-layer-editor/index.js +7 -0
- package/dist/components/types.d.ts +79 -2
- package/dist/docs/api.json +1 -1
- package/dist/docs/docs.json +1 -1
- package/dist/docs/vscode.html-custom-data.json +1 -1
- package/dist/docs/web-types.json +1 -1
- package/dist/index.d.ts +10 -0
- package/dist/loader.js +6 -5
- package/dist/types/lumina.d.ts +9 -2
- package/dist/types/preact.d.ts +10 -2
- package/dist/types/react.d.ts +11 -2
- package/dist/types/stencil.d.ts +9 -2
- package/dist/utils/data-catalog-datastore.d.ts +170 -0
- package/package.json +5 -5
- package/dist/cdn/5CO7XWOT.js +0 -2
- package/dist/cdn/5FXY5U3T.js +0 -2
- package/dist/cdn/CYC4AWZE.js +0 -2
- package/dist/cdn/GVO3LEFV.js +0 -2
- package/dist/cdn/J5X2KSYD.js +0 -2
- package/dist/cdn/QHJAF7L3.js +0 -6
- package/dist/cdn/T7GEIGWF.js +0 -2
- package/dist/cdn/TAXRVBJC.js +0 -2
- package/dist/cdn/VR5CATAW.js +0 -2
- package/dist/cdn/WTNM2NCZ.js +0 -2
- package/dist/cdn/XEUG3X2W.js +0 -2
- package/dist/cdn/ZJCI6LP6.js +0 -12
- package/dist/cdn/ZSVJAJND.js +0 -4
|
@@ -0,0 +1,209 @@
|
|
|
1
|
+
/* COPYRIGHT Esri - https://js.arcgis.com/5.1/LICENSE.txt */
|
|
2
|
+
const E = {
|
|
3
|
+
id: "postgres",
|
|
4
|
+
keywords: [
|
|
5
|
+
"ALL",
|
|
6
|
+
"ANALYSE",
|
|
7
|
+
"ANALYZE",
|
|
8
|
+
"AND",
|
|
9
|
+
"ANY",
|
|
10
|
+
"ARRAY",
|
|
11
|
+
"AS",
|
|
12
|
+
"ASC",
|
|
13
|
+
"ASYMMETRIC",
|
|
14
|
+
"AUTHORIZATION",
|
|
15
|
+
"BETWEEN",
|
|
16
|
+
"BINARY",
|
|
17
|
+
"BOTH",
|
|
18
|
+
"CASE",
|
|
19
|
+
"CAST",
|
|
20
|
+
"CHECK",
|
|
21
|
+
"COLLATE",
|
|
22
|
+
"COLLATION",
|
|
23
|
+
"COLUMN",
|
|
24
|
+
"CONCURRENTLY",
|
|
25
|
+
"CONSTRAINT",
|
|
26
|
+
"CREATE",
|
|
27
|
+
"CROSS",
|
|
28
|
+
"CURRENT_CATALOG",
|
|
29
|
+
"CURRENT_DATE",
|
|
30
|
+
"CURRENT_ROLE",
|
|
31
|
+
"CURRENT_SCHEMA",
|
|
32
|
+
"CURRENT_TIME",
|
|
33
|
+
"CURRENT_TIMESTAMP",
|
|
34
|
+
"CURRENT_USER",
|
|
35
|
+
"DEFAULT",
|
|
36
|
+
"DEFERRABLE",
|
|
37
|
+
"DESC",
|
|
38
|
+
"DISTINCT",
|
|
39
|
+
"DO",
|
|
40
|
+
"ELSE",
|
|
41
|
+
"END",
|
|
42
|
+
"EXCEPT",
|
|
43
|
+
"FALSE",
|
|
44
|
+
"FETCH",
|
|
45
|
+
"FOR",
|
|
46
|
+
"FOREIGN",
|
|
47
|
+
"FREEZE",
|
|
48
|
+
"FROM",
|
|
49
|
+
"FULL",
|
|
50
|
+
"GRANT",
|
|
51
|
+
"GROUP",
|
|
52
|
+
"HAVING",
|
|
53
|
+
"ILIKE",
|
|
54
|
+
"IN",
|
|
55
|
+
"INITIALLY",
|
|
56
|
+
"INNER",
|
|
57
|
+
"INTERSECT",
|
|
58
|
+
"INTO",
|
|
59
|
+
"IS",
|
|
60
|
+
"ISNULL",
|
|
61
|
+
"JOIN",
|
|
62
|
+
"LATERAL",
|
|
63
|
+
"LEADING",
|
|
64
|
+
"LEFT",
|
|
65
|
+
"LIKE",
|
|
66
|
+
"LIMIT",
|
|
67
|
+
"LOCALTIME",
|
|
68
|
+
"LOCALTIMESTAMP",
|
|
69
|
+
"NATURAL",
|
|
70
|
+
"NEW",
|
|
71
|
+
"NOT",
|
|
72
|
+
"NOTNULL",
|
|
73
|
+
"NULL",
|
|
74
|
+
"OFF",
|
|
75
|
+
"OFFSET",
|
|
76
|
+
"OLD",
|
|
77
|
+
"ON",
|
|
78
|
+
"ONLY",
|
|
79
|
+
"OR",
|
|
80
|
+
"ORDER",
|
|
81
|
+
"OUTER",
|
|
82
|
+
"OVER",
|
|
83
|
+
"OVERLAPS",
|
|
84
|
+
"PLACING",
|
|
85
|
+
"PRIMARY",
|
|
86
|
+
"REFERENCES",
|
|
87
|
+
"RETURNING",
|
|
88
|
+
"RIGHT",
|
|
89
|
+
"SELECT",
|
|
90
|
+
"SESSION_USER",
|
|
91
|
+
"SIMILAR",
|
|
92
|
+
"SOME",
|
|
93
|
+
"SYMMETRIC",
|
|
94
|
+
"TABLE",
|
|
95
|
+
"THEN",
|
|
96
|
+
"TO",
|
|
97
|
+
"TRAILING",
|
|
98
|
+
"TRUE",
|
|
99
|
+
"UNION",
|
|
100
|
+
"UNIQUE",
|
|
101
|
+
"USER",
|
|
102
|
+
"USING",
|
|
103
|
+
"VARIADIC",
|
|
104
|
+
"VERBOSE",
|
|
105
|
+
"WHEN",
|
|
106
|
+
"WHERE",
|
|
107
|
+
"WINDOW",
|
|
108
|
+
"WITH",
|
|
109
|
+
"CMAX",
|
|
110
|
+
"CMIN",
|
|
111
|
+
"CTID",
|
|
112
|
+
"TABLEOID",
|
|
113
|
+
"XMAX",
|
|
114
|
+
"XMIN"
|
|
115
|
+
],
|
|
116
|
+
functions: [
|
|
117
|
+
"UPPER",
|
|
118
|
+
"LOWER",
|
|
119
|
+
"CONCAT",
|
|
120
|
+
"ASCII",
|
|
121
|
+
"CHAR_LENGTH",
|
|
122
|
+
"OCTET_LENGTH",
|
|
123
|
+
"CHR",
|
|
124
|
+
"LTRIM",
|
|
125
|
+
"RTRIM",
|
|
126
|
+
"SUBSTRING",
|
|
127
|
+
"SOUNDEX",
|
|
128
|
+
"REPLACE",
|
|
129
|
+
"TRIM",
|
|
130
|
+
"CEILING",
|
|
131
|
+
"FLOOR",
|
|
132
|
+
"ROUND",
|
|
133
|
+
"LN",
|
|
134
|
+
"LOG",
|
|
135
|
+
"MOD",
|
|
136
|
+
"POWER",
|
|
137
|
+
"SIGN",
|
|
138
|
+
"TRUNC",
|
|
139
|
+
"ASIN",
|
|
140
|
+
"ACOS",
|
|
141
|
+
"ATAN",
|
|
142
|
+
"TO_HEX",
|
|
143
|
+
"SIN",
|
|
144
|
+
"COS",
|
|
145
|
+
"TAN",
|
|
146
|
+
"EXTRACT",
|
|
147
|
+
"BIT_LENGTH",
|
|
148
|
+
"POSITION",
|
|
149
|
+
"ABS",
|
|
150
|
+
"VARIANCE",
|
|
151
|
+
"STDDEV",
|
|
152
|
+
"AVG",
|
|
153
|
+
"COUNT",
|
|
154
|
+
"MAX",
|
|
155
|
+
"MIN",
|
|
156
|
+
"SUM",
|
|
157
|
+
"COALESCE",
|
|
158
|
+
"CONVERT",
|
|
159
|
+
"CAST",
|
|
160
|
+
"CURRENT_USER",
|
|
161
|
+
"CURRENT_TIME",
|
|
162
|
+
"CURRENT_DATE",
|
|
163
|
+
"CURRENT_TIMESTAMP",
|
|
164
|
+
"STDDEV_POP",
|
|
165
|
+
"STDDEV_SAMP",
|
|
166
|
+
"VAR_POP",
|
|
167
|
+
"VAR_SAMP",
|
|
168
|
+
"NULLIF",
|
|
169
|
+
"PERCENTILE_CONT",
|
|
170
|
+
"PERCENTILE_DISC",
|
|
171
|
+
"CUME_DIST",
|
|
172
|
+
"FIRST_VALUE",
|
|
173
|
+
"LAST_VALUE",
|
|
174
|
+
"LEAD",
|
|
175
|
+
"LAG",
|
|
176
|
+
"PERCENT_RANK",
|
|
177
|
+
"RANK",
|
|
178
|
+
"NTILE",
|
|
179
|
+
"DENSE_RANK",
|
|
180
|
+
"ROW_NUMBER",
|
|
181
|
+
"STRING_AGG",
|
|
182
|
+
"GROUPING SETS",
|
|
183
|
+
"CUBE",
|
|
184
|
+
"ROLLUP",
|
|
185
|
+
"REGR_INTERCEPT",
|
|
186
|
+
"REGR_R2",
|
|
187
|
+
"REGR_SLOPE"
|
|
188
|
+
],
|
|
189
|
+
operators: ["||"],
|
|
190
|
+
specialChars: {
|
|
191
|
+
likeWildcardAny: "%",
|
|
192
|
+
likeWildcardOne: "_",
|
|
193
|
+
identifierQuote: {
|
|
194
|
+
start: '"',
|
|
195
|
+
end: '"'
|
|
196
|
+
},
|
|
197
|
+
escapeKey: {
|
|
198
|
+
start: "'",
|
|
199
|
+
end: null
|
|
200
|
+
},
|
|
201
|
+
escapeClause: {
|
|
202
|
+
keyword: "ESCAPE",
|
|
203
|
+
suffix: ""
|
|
204
|
+
}
|
|
205
|
+
}
|
|
206
|
+
};
|
|
207
|
+
export {
|
|
208
|
+
E as postgresDialect
|
|
209
|
+
};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/* COPYRIGHT Esri - https://js.arcgis.com/5.1/LICENSE.txt */
|
|
2
|
-
import { Uri as p, languages as
|
|
2
|
+
import { Uri as p, languages as s } from "monaco-editor";
|
|
3
3
|
import "monaco-editor/esm/vs/editor/standalone/browser/standaloneServices.js";
|
|
4
4
|
import "monaco-editor/esm/vs/editor/standalone/common/standaloneTheme.js";
|
|
5
5
|
import "monaco-editor/esm/vs/platform/hover/browser/hover.js";
|
|
@@ -8,12 +8,18 @@ import "monaco-editor/esm/vs/base/browser/dom.js";
|
|
|
8
8
|
import "monaco-editor/esm/vs/editor/browser/editorDom.js";
|
|
9
9
|
import "monaco-editor/esm/vs/editor/browser/controller/mouseTarget.js";
|
|
10
10
|
import { b as t } from "./arcade-defaults.js";
|
|
11
|
-
import { a as
|
|
11
|
+
import { a as l } from "./arcade-service-accessors.js";
|
|
12
12
|
import { i as d } from "./monaco-importer.js";
|
|
13
|
-
import { a
|
|
14
|
-
import { g as
|
|
13
|
+
import { a } from "./sql-expr-defaults.js";
|
|
14
|
+
import { g as f } from "./sql-expr-service-accessors.js";
|
|
15
15
|
import { t as h } from "./monaco-theme.js";
|
|
16
|
-
const k = [
|
|
16
|
+
const k = [
|
|
17
|
+
"arcade",
|
|
18
|
+
"arcgis-sql-expression",
|
|
19
|
+
"sql-layer-sql-server",
|
|
20
|
+
"sql-layer-postgres",
|
|
21
|
+
"sql-layer-bigquery"
|
|
22
|
+
], i = /* @__PURE__ */ new Set(), g = /* @__PURE__ */ new Map();
|
|
17
23
|
function c(e) {
|
|
18
24
|
let r = g.get(e);
|
|
19
25
|
return r || (r = Promise.withResolvers(), g.set(e, r)), r;
|
|
@@ -34,45 +40,45 @@ async function $(e) {
|
|
|
34
40
|
return;
|
|
35
41
|
(await d()).createModel("", e, p.parse("")).dispose();
|
|
36
42
|
}
|
|
37
|
-
|
|
43
|
+
s.register({
|
|
38
44
|
id: t.languageId,
|
|
39
45
|
aliases: ["Arcade", "arcade"],
|
|
40
46
|
extensions: [".arc"],
|
|
41
47
|
mimetypes: ["application/arcade"]
|
|
42
48
|
});
|
|
43
|
-
|
|
49
|
+
s.onLanguage(
|
|
44
50
|
t.languageId,
|
|
45
51
|
m(t.languageId, () => {
|
|
46
|
-
|
|
52
|
+
l().then((e) => {
|
|
47
53
|
e.setupMode(t), u(t.languageId);
|
|
48
54
|
}).catch((e) => {
|
|
49
55
|
throw e;
|
|
50
56
|
});
|
|
51
57
|
})
|
|
52
58
|
);
|
|
53
|
-
|
|
54
|
-
id:
|
|
59
|
+
s.register({
|
|
60
|
+
id: a.languageId,
|
|
55
61
|
aliases: ["EsiSqlExpression", "sql-expression"],
|
|
56
62
|
extensions: [".sql-expression"],
|
|
57
63
|
mimetypes: ["application/sql-expression"]
|
|
58
64
|
});
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
m(
|
|
62
|
-
|
|
63
|
-
e.setupMode(
|
|
65
|
+
s.onLanguage(
|
|
66
|
+
a.languageId,
|
|
67
|
+
m(a.languageId, () => {
|
|
68
|
+
f().then((e) => {
|
|
69
|
+
e.setupMode(a), u(a.languageId);
|
|
64
70
|
}).catch((e) => {
|
|
65
71
|
throw e;
|
|
66
72
|
});
|
|
67
73
|
})
|
|
68
74
|
);
|
|
69
|
-
|
|
70
|
-
function
|
|
75
|
+
y();
|
|
76
|
+
function y() {
|
|
71
77
|
d().then((e) => {
|
|
72
78
|
["light", "dark"].forEach((r) => {
|
|
73
|
-
const
|
|
74
|
-
e.defineTheme(
|
|
75
|
-
base:
|
|
79
|
+
const n = r === "light" ? "vs" : "vs-dark", o = h[`${r}-theme`];
|
|
80
|
+
e.defineTheme(n, {
|
|
81
|
+
base: n,
|
|
76
82
|
inherit: !0,
|
|
77
83
|
rules: [
|
|
78
84
|
{ token: "comment.arcgis", foreground: o.comment },
|
|
@@ -91,6 +97,8 @@ function w() {
|
|
|
91
97
|
});
|
|
92
98
|
}
|
|
93
99
|
export {
|
|
100
|
+
m as a,
|
|
101
|
+
u as m,
|
|
94
102
|
$ as s,
|
|
95
103
|
_ as w
|
|
96
104
|
};
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
/* COPYRIGHT Esri - https://js.arcgis.com/5.1/LICENSE.txt */
|
|
2
|
-
import { i as c, b as u
|
|
3
|
-
import { CompletionItemKind as
|
|
2
|
+
import { i as c, b as u } from "./utils.js";
|
|
3
|
+
import { CompletionItemKind as y, InsertTextFormat as m, InsertTextMode as g } from "vscode-languageserver-types";
|
|
4
|
+
import { f as h, L as P, E as F } from "./language-defaults-base.js";
|
|
4
5
|
import { fetchT9nStringsBundle as M } from "@arcgis/toolkit/intl";
|
|
5
6
|
import { g as b } from "./runtime.js";
|
|
6
7
|
const x = (r) => {
|
|
@@ -17,9 +18,9 @@ function A(r) {
|
|
|
17
18
|
label: t,
|
|
18
19
|
detail: t,
|
|
19
20
|
insertText: t,
|
|
20
|
-
insertTextMode:
|
|
21
|
-
insertTextFormat:
|
|
22
|
-
kind:
|
|
21
|
+
insertTextMode: g.asIs,
|
|
22
|
+
insertTextFormat: m.PlainText,
|
|
23
|
+
kind: y.Field
|
|
23
24
|
}, s = {
|
|
24
25
|
name: t,
|
|
25
26
|
description: i,
|
|
@@ -29,7 +30,7 @@ function A(r) {
|
|
|
29
30
|
};
|
|
30
31
|
if (!e || !("fields" in e))
|
|
31
32
|
return s;
|
|
32
|
-
const [a, l] =
|
|
33
|
+
const [a, l] = h(e.fields, i);
|
|
33
34
|
return s.properties = a, o.documentation = { kind: "markdown", value: l }, s;
|
|
34
35
|
}
|
|
35
36
|
const T = {
|
|
@@ -70,7 +71,7 @@ function E(r) {
|
|
|
70
71
|
}), i;
|
|
71
72
|
}
|
|
72
73
|
const d = "arcgis-sql-expression";
|
|
73
|
-
class w extends
|
|
74
|
+
class w extends P {
|
|
74
75
|
constructor() {
|
|
75
76
|
super(d, {
|
|
76
77
|
apiPath: "./assets/sql-language/api",
|
|
@@ -96,7 +97,7 @@ class w extends m {
|
|
|
96
97
|
if (!o)
|
|
97
98
|
throw new Error(`Failed to load the language bundle for ${e.locale}`);
|
|
98
99
|
this.disposeForModel(t);
|
|
99
|
-
const s = this._getApiKey(t), a = new
|
|
100
|
+
const s = this._getApiKey(t), a = new F(i, o);
|
|
100
101
|
this._modelToProfileMap.set(s, a);
|
|
101
102
|
const l = x(a);
|
|
102
103
|
this.updateApiContextForModel(t, {
|
|
@@ -107,11 +108,11 @@ class w extends m {
|
|
|
107
108
|
p && this.updateFeatureLayerForModel(t, p.definition);
|
|
108
109
|
}
|
|
109
110
|
}
|
|
110
|
-
const n = new w(),
|
|
111
|
+
const n = new w(), I = {
|
|
111
112
|
setProfileForModel: n.setProfileForModel.bind(n),
|
|
112
113
|
getApiLibraryForModel: n.getApiLibraryForModel.bind(n)
|
|
113
114
|
};
|
|
114
115
|
export {
|
|
115
116
|
n as a,
|
|
116
|
-
|
|
117
|
+
I as s
|
|
117
118
|
};
|
|
@@ -0,0 +1,231 @@
|
|
|
1
|
+
/* COPYRIGHT Esri - https://js.arcgis.com/5.1/LICENSE.txt */
|
|
2
|
+
import { fetchT9nStringsBundle as v } from "@arcgis/toolkit/intl";
|
|
3
|
+
import { g as L } from "./runtime.js";
|
|
4
|
+
import { a as q, D as P, b as C, q as T, n as w, c as M, e as F, L as V, h as $, E as k, i as _ } from "./language-defaults-base.js";
|
|
5
|
+
import x from "@arcgis/core/portal/Portal.js";
|
|
6
|
+
import { l as A } from "./utils.js";
|
|
7
|
+
function y(t) {
|
|
8
|
+
for (const e of t) {
|
|
9
|
+
if (e instanceof C)
|
|
10
|
+
return e;
|
|
11
|
+
if (e.isCollection && "variables" in e) {
|
|
12
|
+
const o = y(
|
|
13
|
+
e.variables.filter(
|
|
14
|
+
(a) => a.type !== "group"
|
|
15
|
+
)
|
|
16
|
+
);
|
|
17
|
+
if (o)
|
|
18
|
+
return o;
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
|
+
function S(t, e) {
|
|
23
|
+
return `${t}:${e}`;
|
|
24
|
+
}
|
|
25
|
+
function B(t) {
|
|
26
|
+
if (t) {
|
|
27
|
+
for (const e of t)
|
|
28
|
+
if (e.type === "dataCatalogDatastore")
|
|
29
|
+
return e.definition;
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
async function N(t) {
|
|
33
|
+
const e = new x({ url: t.portal.url });
|
|
34
|
+
return await e.load(), new P({
|
|
35
|
+
itemId: t.id,
|
|
36
|
+
serviceUrl: t.serviceUrl,
|
|
37
|
+
portal: e
|
|
38
|
+
});
|
|
39
|
+
}
|
|
40
|
+
async function E(t) {
|
|
41
|
+
return A(t) ? await N(t) : t;
|
|
42
|
+
}
|
|
43
|
+
function I(t, e, o) {
|
|
44
|
+
let a = `**${t}**`;
|
|
45
|
+
return e.type && (a += `
|
|
46
|
+
${e.type}`), o && (a += `
|
|
47
|
+
Datastore: ${o}`), { value: a };
|
|
48
|
+
}
|
|
49
|
+
function W(t, e) {
|
|
50
|
+
let o = `**${t.name}**`;
|
|
51
|
+
return t.serverType && (o += `
|
|
52
|
+
${t.serverType}`), o += `
|
|
53
|
+
Nullable: ${t.nullable ? "yes" : "no"}`, o += `
|
|
54
|
+
Table: ${e}`, { value: o };
|
|
55
|
+
}
|
|
56
|
+
function U(t, e, o) {
|
|
57
|
+
return t.map((a) => {
|
|
58
|
+
const r = T(a.name, o);
|
|
59
|
+
return {
|
|
60
|
+
name: a.name,
|
|
61
|
+
normalizedName: w(a.name),
|
|
62
|
+
quotedName: r === a.name ? void 0 : r,
|
|
63
|
+
dataType: a.serverType,
|
|
64
|
+
nullable: a.nullable,
|
|
65
|
+
completionLabel: a.name,
|
|
66
|
+
insertText: r,
|
|
67
|
+
detail: [a.serverType, a.nullable ? "nullable" : "not null"].filter(Boolean).join(" | "),
|
|
68
|
+
documentation: W(a, e)
|
|
69
|
+
};
|
|
70
|
+
});
|
|
71
|
+
}
|
|
72
|
+
function z(t, e, o, a) {
|
|
73
|
+
const r = M(t.name, a), s = t.name.split("."), n = F(t.name);
|
|
74
|
+
return {
|
|
75
|
+
id: S(e, t.name),
|
|
76
|
+
name: t.name,
|
|
77
|
+
normalizedName: w(t.name),
|
|
78
|
+
quotedName: r === t.name ? void 0 : r,
|
|
79
|
+
description: t.type,
|
|
80
|
+
schema: s.length >= 2 ? s.at(-2) : void 0,
|
|
81
|
+
catalog: s.length >= 3 ? s.at(-3) : void 0,
|
|
82
|
+
completionLabel: t.name,
|
|
83
|
+
insertText: r,
|
|
84
|
+
detail: [t.type, o].filter(Boolean).join(" | "),
|
|
85
|
+
documentation: I(n, t, o),
|
|
86
|
+
columns: []
|
|
87
|
+
};
|
|
88
|
+
}
|
|
89
|
+
async function K(t, e) {
|
|
90
|
+
const o = y(t.dictionaryVariables);
|
|
91
|
+
if (!o)
|
|
92
|
+
return { tables: [] };
|
|
93
|
+
await o.loadSource();
|
|
94
|
+
const a = o.datastoreInfo, r = a?.datastoreId;
|
|
95
|
+
if (!r)
|
|
96
|
+
return { tables: [] };
|
|
97
|
+
const s = o.tableVariables.map(
|
|
98
|
+
(n) => z(n.datasetInfo, r, a?.name, e)
|
|
99
|
+
);
|
|
100
|
+
return {
|
|
101
|
+
datastore: {
|
|
102
|
+
id: r,
|
|
103
|
+
displayName: a?.name,
|
|
104
|
+
databasePlatform: a?.databasePlatform
|
|
105
|
+
},
|
|
106
|
+
tables: s
|
|
107
|
+
};
|
|
108
|
+
}
|
|
109
|
+
async function R(t) {
|
|
110
|
+
const e = B(t?.variables);
|
|
111
|
+
if (!e)
|
|
112
|
+
return q(void 0);
|
|
113
|
+
const a = await (await E(e)).fetchInfo();
|
|
114
|
+
return q(a.databasePlatform);
|
|
115
|
+
}
|
|
116
|
+
class j extends V {
|
|
117
|
+
/**
|
|
118
|
+
* Per-model update chaining to serialize profile updates. see arcade-defaults for rationale.
|
|
119
|
+
*/
|
|
120
|
+
#e = /* @__PURE__ */ new Map();
|
|
121
|
+
/**
|
|
122
|
+
* Per-model, per-table column load caching to avoid redundant loads when multiple requests for the same table(s) are made before the first load completes.
|
|
123
|
+
*/
|
|
124
|
+
#t = /* @__PURE__ */ new Map();
|
|
125
|
+
#a;
|
|
126
|
+
constructor(e) {
|
|
127
|
+
super(e, {
|
|
128
|
+
apiPath: "./assets/sql-layer/api",
|
|
129
|
+
apiPrefix: "sql-layer-api.t9n."
|
|
130
|
+
});
|
|
131
|
+
const o = _(e);
|
|
132
|
+
this.dialectId = o;
|
|
133
|
+
}
|
|
134
|
+
getWorkerHostExtension() {
|
|
135
|
+
return {
|
|
136
|
+
getSqlLayerDialectSpec: async () => await this.getDialectSpec(),
|
|
137
|
+
getSqlLayerColumnsForModel: async (e, o) => await this._loadSqlLayerColumnsForModel(e, o)
|
|
138
|
+
};
|
|
139
|
+
}
|
|
140
|
+
async getDialectSpec() {
|
|
141
|
+
return this.#a ??= $(this.languageId), await this.#a;
|
|
142
|
+
}
|
|
143
|
+
disposeForModel(e) {
|
|
144
|
+
this.#t.delete(this._getApiKey(e)), super.disposeForModel(e);
|
|
145
|
+
}
|
|
146
|
+
async setProfileForModel(e, o, a) {
|
|
147
|
+
const r = this._getApiKey(e), n = (this.#e.get(r) || Promise.resolve()).then(async () => {
|
|
148
|
+
const f = await v(
|
|
149
|
+
a.locale,
|
|
150
|
+
L("./assets/editor-profile/t9n"),
|
|
151
|
+
"messages."
|
|
152
|
+
);
|
|
153
|
+
if (!f)
|
|
154
|
+
throw new Error(`Failed to load the language bundle for ${a.locale}`);
|
|
155
|
+
this.disposeForModel(e);
|
|
156
|
+
const u = new k(o, f, a.locale);
|
|
157
|
+
this._modelToProfileMap.set(r, u);
|
|
158
|
+
const g = await K(u, await this.getDialectSpec());
|
|
159
|
+
this.updateApiContextForModel(e, {
|
|
160
|
+
locale: a.locale,
|
|
161
|
+
snippets: a.snippets,
|
|
162
|
+
sqlProfile: g
|
|
163
|
+
});
|
|
164
|
+
}), l = n.finally(() => {
|
|
165
|
+
this.#e.get(r) === l && this.#e.delete(r);
|
|
166
|
+
});
|
|
167
|
+
return this.#e.set(r, l), await n;
|
|
168
|
+
}
|
|
169
|
+
async _loadSqlLayerColumnsForModel(e, o) {
|
|
170
|
+
if (!o.length)
|
|
171
|
+
return [];
|
|
172
|
+
const a = this._getApiKey(e), r = this.getApiContextForModel(e), s = r.sqlProfile, n = this._modelToProfileMap.get(a), l = n ? y(n.dictionaryVariables) : void 0;
|
|
173
|
+
if (!s || !l)
|
|
174
|
+
return [];
|
|
175
|
+
await l.loadSource();
|
|
176
|
+
const u = l.datastoreInfo?.datastoreId;
|
|
177
|
+
if (!u)
|
|
178
|
+
return [];
|
|
179
|
+
const g = new Map(
|
|
180
|
+
l.tableVariables.map((i) => [
|
|
181
|
+
S(u, i.datasetInfo.name),
|
|
182
|
+
i
|
|
183
|
+
])
|
|
184
|
+
);
|
|
185
|
+
let d = this.#t.get(a);
|
|
186
|
+
d || (d = /* @__PURE__ */ new Map(), this.#t.set(a, d));
|
|
187
|
+
const h = await Promise.all(
|
|
188
|
+
o.map(async (i) => {
|
|
189
|
+
const b = s.tables.find((c) => c.id === i);
|
|
190
|
+
if (b?.columns.length)
|
|
191
|
+
return { tableId: i, columns: b.columns };
|
|
192
|
+
let m = d.get(i);
|
|
193
|
+
return m || (m = (async () => {
|
|
194
|
+
const c = g.get(i);
|
|
195
|
+
return c ? (await c.loadSource(), U(
|
|
196
|
+
c.fieldInfos,
|
|
197
|
+
c.datasetInfo.name,
|
|
198
|
+
await this.getDialectSpec()
|
|
199
|
+
)) : [];
|
|
200
|
+
})(), d.set(i, m)), { tableId: i, columns: await m };
|
|
201
|
+
})
|
|
202
|
+
), D = this._mergeLoadedColumns(s, h);
|
|
203
|
+
return D !== s && this.updateApiContextForModel(e, { ...r, sqlProfile: D }), h;
|
|
204
|
+
}
|
|
205
|
+
_mergeLoadedColumns(e, o) {
|
|
206
|
+
const a = new Map(o.map((n) => [n.tableId, n.columns]));
|
|
207
|
+
let r = !1;
|
|
208
|
+
const s = e.tables.map((n) => n.columns.length || !a.has(n.id) ? n : (r = !0, {
|
|
209
|
+
...n,
|
|
210
|
+
columns: a.get(n.id) ?? n.columns
|
|
211
|
+
}));
|
|
212
|
+
return r ? { ...e, tables: s } : e;
|
|
213
|
+
}
|
|
214
|
+
}
|
|
215
|
+
const p = /* @__PURE__ */ new Map();
|
|
216
|
+
function X(t) {
|
|
217
|
+
let e = p.get(t);
|
|
218
|
+
return e || (e = new j(t), p.set(t, e)), e;
|
|
219
|
+
}
|
|
220
|
+
function Y(t) {
|
|
221
|
+
return p.get(t);
|
|
222
|
+
}
|
|
223
|
+
function Z() {
|
|
224
|
+
return [...p.values()];
|
|
225
|
+
}
|
|
226
|
+
export {
|
|
227
|
+
R as a,
|
|
228
|
+
Y as b,
|
|
229
|
+
X as c,
|
|
230
|
+
Z as g
|
|
231
|
+
};
|