@arcgis/coding-components 4.31.0-next.33 → 4.31.0-next.34
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/arcgis-coding-components/arcgis-coding-components.esm.js +2 -2
- package/dist/arcgis-coding-components/assets/code-editor/sql-expr.worker.js +38 -39
- package/dist/arcgis-coding-components/index.esm.js +2 -2
- package/dist/arcgis-coding-components/{p-75433d50.js → p-102debc5.js} +2 -2
- package/dist/arcgis-coding-components/{p-993bc0d7.js → p-1bce90df.js} +1 -1
- package/dist/arcgis-coding-components/{p-b320932c.js → p-226d94e2.js} +2 -2
- package/dist/arcgis-coding-components/{p-1e8ecfad.js → p-2680fa02.js} +2 -2
- package/dist/arcgis-coding-components/{p-e9a06305.js → p-27169bfc.js} +2 -2
- package/dist/arcgis-coding-components/{p-41da41b7.js → p-2a576903.js} +2 -2
- package/dist/arcgis-coding-components/{p-ffffcb8d.entry.js → p-3c3209ac.entry.js} +2 -2
- package/dist/arcgis-coding-components/p-6de7e7ae.js +6 -0
- package/dist/arcgis-coding-components/{p-31373916.js → p-77245004.js} +2 -2
- package/dist/arcgis-coding-components/p-82fb561d.js +6 -0
- package/dist/arcgis-coding-components/{p-08b429c3.js → p-8423b230.js} +2 -2
- package/dist/arcgis-coding-components/{p-5712f14a.js → p-85a8c1ea.js} +2 -2
- package/dist/arcgis-coding-components/{p-8a69d580.js → p-8b57879b.js} +2 -2
- package/dist/arcgis-coding-components/{p-9f2c7bf5.js → p-94d2e235.js} +1 -1
- package/dist/arcgis-coding-components/{p-81abf375.js → p-abdf566d.js} +9 -9
- package/dist/arcgis-coding-components/{p-355201f9.js → p-ad4575ad.js} +1 -1
- package/dist/arcgis-coding-components/{p-0f7c3b46.entry.js → p-b6c88155.entry.js} +2 -2
- package/dist/arcgis-coding-components/{p-26bd361b.entry.js → p-c11b620f.entry.js} +2 -2
- package/dist/cjs/{app-globals-4fe8cc70.js → app-globals-7c96ec13.js} +1 -1
- package/dist/cjs/{arcade-defaults-a591369b.js → arcade-defaults-41afd487.js} +4 -4
- package/dist/cjs/{arcade-mode-8e6464d3.js → arcade-mode-c7fb5c66.js} +266 -6
- package/dist/cjs/arcgis-arcade-editor_6.cjs.entry.js +5 -5
- package/dist/cjs/arcgis-coding-components.cjs.js +3 -3
- package/dist/cjs/arcgis-sql-expression-editor.cjs.entry.js +4 -4
- package/dist/cjs/arcgis-sql-expression-fields.cjs.entry.js +4 -4
- package/dist/cjs/{css-67e59b62.js → css-894931ae.js} +1 -1
- package/dist/cjs/{cssMode-ac51091d.js → cssMode-6a5028d4.js} +2 -2
- package/dist/cjs/{html-3127941b.js → html-dda4542d.js} +2 -2
- package/dist/cjs/{htmlMode-c686ddee.js → htmlMode-983bb1b6.js} +2 -2
- package/dist/cjs/{index-8e823a40.js → index-7dad49d8.js} +1 -1
- package/dist/cjs/index.cjs.js +4 -4
- package/dist/cjs/{javascript-37aa76f5.js → javascript-6ba81d8b.js} +3 -3
- package/dist/cjs/{jsonMode-9d875fc8.js → jsonMode-caca2bdb.js} +2 -2
- package/dist/cjs/{language-defaults-base-82944173.js → language-defaults-base-a5648a80.js} +9 -29
- package/dist/cjs/loader.cjs.js +3 -3
- package/dist/cjs/{sql-expr-defaults-d74ef4f2.js → sql-expr-defaults-8860e52d.js} +4 -17
- package/dist/cjs/sql-expr-mode-09647860.js +467 -0
- package/dist/cjs/{tsMode-916f8dc0.js → tsMode-ec3475be.js} +2 -2
- package/dist/cjs/{typescript-05142a58.js → typescript-b7cc5417.js} +2 -2
- package/dist/components/arcade-defaults.js +1 -1
- package/dist/components/arcade-mode.js +265 -4
- package/dist/components/arcade-results.js +1 -1
- package/dist/components/arcade-suggestions.js +1 -1
- package/dist/components/arcade-variables.js +1 -1
- package/dist/components/arcgis-arcade-editor.js +1 -1
- package/dist/components/arcgis-arcade-results.js +1 -1
- package/dist/components/arcgis-arcade-suggestions.js +1 -1
- package/dist/components/arcgis-arcade-variables.js +1 -1
- package/dist/components/arcgis-assets.d.ts +1 -1
- package/dist/components/arcgis-assets.js +1 -1
- package/dist/components/arcgis-code-editor.js +1 -1
- package/dist/components/arcgis-language-api-panel.js +1 -1
- package/dist/components/arcgis-sql-expression-editor.js +1 -1
- package/dist/components/arcgis-sql-expression-fields.js +1 -1
- package/dist/components/chunk-EOMOY2EF.js +1 -1
- package/dist/components/code-editor.js +1 -1
- package/dist/components/fields.js +2 -20
- package/dist/components/index.js +1 -1
- package/dist/components/index2.js +1 -1
- package/dist/components/language-api-panel.js +1 -1
- package/dist/components/language-defaults-base.js +1 -1
- package/dist/components/markdown.js +1 -1
- package/dist/components/sql-expr-defaults.js +2 -14
- package/dist/components/sql-expr-mode.js +161 -868
- package/dist/components/sql-expression-fields.js +1 -1
- package/dist/components/useT9n.js +1 -1
- package/dist/components/utilities.js +1 -1
- package/dist/esm/{app-globals-5a151155.js → app-globals-424a420a.js} +1 -1
- package/dist/esm/{arcade-defaults-5c8f894d.js → arcade-defaults-412fa0f2.js} +4 -4
- package/dist/esm/{arcade-mode-c4a6c6e6.js → arcade-mode-f9a5bed5.js} +263 -3
- package/dist/esm/arcgis-arcade-editor_6.entry.js +5 -5
- package/dist/esm/arcgis-coding-components.js +4 -4
- package/dist/esm/arcgis-sql-expression-editor.entry.js +4 -4
- package/dist/esm/arcgis-sql-expression-fields.entry.js +4 -4
- package/dist/esm/{css-6709b3e0.js → css-71097c66.js} +1 -1
- package/dist/esm/{cssMode-76e8796d.js → cssMode-72309bd9.js} +2 -2
- package/dist/esm/{html-53d10c85.js → html-8592a408.js} +2 -2
- package/dist/esm/{htmlMode-e9f070f1.js → htmlMode-0943cb15.js} +2 -2
- package/dist/esm/{index-b16f119e.js → index-f65aa2e7.js} +1 -1
- package/dist/esm/index.js +4 -4
- package/dist/esm/{javascript-785bbfd8.js → javascript-a33a7f7a.js} +3 -3
- package/dist/esm/{jsonMode-cd6fe200.js → jsonMode-1435c17d.js} +2 -2
- package/dist/esm/{language-defaults-base-e68e4d35.js → language-defaults-base-42358eac.js} +10 -28
- package/dist/esm/loader.js +4 -4
- package/dist/esm/{sql-expr-defaults-bdfdf7b4.js → sql-expr-defaults-b496e04d.js} +5 -17
- package/dist/esm/sql-expr-mode-626418cf.js +463 -0
- package/dist/esm/{tsMode-31b5e806.js → tsMode-50c3b01e.js} +2 -2
- package/dist/esm/{typescript-b2aa1d45.js → typescript-20e50254.js} +2 -2
- package/dist/loader/cdn.js +1 -1
- package/dist/loader/index.cjs.js +1 -1
- package/dist/loader/index.es2017.js +1 -1
- package/dist/loader/index.js +1 -1
- package/dist/types/data/arcgis-web-compoments/actions-runner-1/_work/arcgis-web-components/arcgis-web-components/packages/coding-packages/coding-components/.stencil/stencil.config.d.ts +3 -0
- package/dist/types/utils/sql-expr-monaco/sql-expr-completion.d.ts +56 -6
- package/dist/types/utils/sql-expr-monaco/sql-expr-constants.d.ts +22 -6
- package/dist/types/utils/sql-expr-monaco/sql-expr-language-features.d.ts +3 -18
- package/dist/types/utils/sql-expr-monaco/sql-expr-parser-utils.d.ts +30 -0
- package/dist/types/utils/sql-expr-monaco/sql-expr-validation-utils.d.ts +0 -2
- package/dist/types/utils/sql-expr-monaco/sql-expr.worker.d.ts +4 -4
- package/dist/types/utils/sql-expr-monaco/types.d.ts +25 -17
- package/package.json +11 -11
- package/dist/arcgis-coding-components/p-11d77b20.js +0 -6
- package/dist/arcgis-coding-components/p-86eb1d4c.js +0 -6
- package/dist/arcgis-coding-components/p-f544962a.js +0 -6
- package/dist/cjs/arcade-language-features-58ffb6a0.js +0 -274
- package/dist/cjs/sql-expr-mode-98437b6d.js +0 -1171
- package/dist/components/arcade-language-features.js +0 -271
- package/dist/esm/arcade-language-features-664e727d.js +0 -269
- package/dist/esm/sql-expr-mode-e58e1f11.js +0 -1167
- package/dist/types/data/actions-runner-1/_work/arcgis-web-components/arcgis-web-components/packages/coding-packages/coding-components/.stencil/stencil.config.d.ts +0 -3
- /package/dist/types/data/{actions-runner-1 → arcgis-web-compoments/actions-runner-1}/_work/arcgis-web-components/arcgis-web-components/packages/coding-packages/coding-components/.stencil/stories/internal/arcade-editor/arcade-editor.stories.d.ts +0 -0
- /package/dist/types/data/{actions-runner-1 → arcgis-web-compoments/actions-runner-1}/_work/arcgis-web-components/arcgis-web-components/packages/coding-packages/coding-components/.stencil/stories/internal/arcade-editor/editorContext.d.ts +0 -0
- /package/dist/types/data/{actions-runner-1 → arcgis-web-compoments/actions-runner-1}/_work/arcgis-web-components/arcgis-web-components/packages/coding-packages/coding-components/.stencil/stories/internal/code-editor/code-editor.stories.d.ts +0 -0
- /package/dist/types/data/{actions-runner-1 → arcgis-web-compoments/actions-runner-1}/_work/arcgis-web-components/arcgis-web-components/packages/coding-packages/coding-components/.stencil/stories/internal/sql-expression-editor/sql-expression-editor.stories.d.ts +0 -0
- /package/dist/types/data/{actions-runner-1 → arcgis-web-compoments/actions-runner-1}/_work/arcgis-web-components/arcgis-web-components/packages/coding-packages/coding-components/.stencil/stories/reference/stories/arcade-editor.stories.d.ts +0 -0
- /package/dist/types/data/{actions-runner-1 → arcgis-web-compoments/actions-runner-1}/_work/arcgis-web-components/arcgis-web-components/packages/coding-packages/coding-components/.stencil/support/sass-inline-url-importer.d.ts +0 -0
- /package/dist/types/data/{actions-runner-1 → arcgis-web-compoments/actions-runner-1}/_work/arcgis-web-components/arcgis-web-components/packages/coding-packages/coding-components/.stencil/support/sass-json-importer.d.ts +0 -0
- /package/dist/types/data/{actions-runner-1 → arcgis-web-compoments/actions-runner-1}/_work/arcgis-web-components/arcgis-web-components/packages/coding-packages/coding-components/.stencil/support/stencil-monaco-plugins.d.ts +0 -0
package/dist/esm/loader.js
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
/*!
|
|
2
2
|
* All material copyright Esri, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
* See https://js.arcgis.com/4.31/esri/copyright.txt for details.
|
|
4
|
-
* v4.31.0-next.
|
|
4
|
+
* v4.31.0-next.34
|
|
5
5
|
*/
|
|
6
|
-
import { b as bootstrapLazy } from './index-
|
|
7
|
-
export { s as setNonce } from './index-
|
|
8
|
-
import { g as globalScripts } from './app-globals-
|
|
6
|
+
import { b as bootstrapLazy } from './index-f65aa2e7.js';
|
|
7
|
+
export { s as setNonce } from './index-f65aa2e7.js';
|
|
8
|
+
import { g as globalScripts } from './app-globals-424a420a.js';
|
|
9
9
|
|
|
10
10
|
const defineCustomElements = async (win, options) => {
|
|
11
11
|
if (typeof window === 'undefined') return undefined;
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
/*!
|
|
2
2
|
* All material copyright Esri, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
* See https://js.arcgis.com/4.31/esri/copyright.txt for details.
|
|
4
|
-
* v4.31.0-next.
|
|
4
|
+
* v4.31.0-next.34
|
|
5
5
|
*/
|
|
6
|
-
import { F as isNotUndefined, D as Deferred, G as safeAsyncCall, H as devToolsAwareTimeout, J as safeCall, f as fieldsToProfileValues, i as isPredefinedProfile, b as isFeatureSetDefinition, m as main, L as LanguageDefaultsBase, d as fetchT9nStringsBundle, E as EditorProfile, U as Uri } from './language-defaults-base-
|
|
7
|
-
import { g as getAssetPath } from './index-
|
|
6
|
+
import { F as isNotUndefined, D as Deferred, G as safeAsyncCall, H as devToolsAwareTimeout, J as safeCall, f as fieldsToProfileValues, i as isPredefinedProfile, b as isFeatureSetDefinition, m as main, L as LanguageDefaultsBase, d as fetchT9nStringsBundle, E as EditorProfile, U as Uri } from './language-defaults-base-42358eac.js';
|
|
7
|
+
import { g as getAssetPath } from './index-f65aa2e7.js';
|
|
8
8
|
|
|
9
9
|
// src/framework.ts
|
|
10
10
|
function retrieveComponentMembers(component, isLit) {
|
|
@@ -1251,18 +1251,6 @@ async function convertToEditorProfileDefinition(predefinedProfile, locale = "en"
|
|
|
1251
1251
|
return editorProfile;
|
|
1252
1252
|
}
|
|
1253
1253
|
// #endregion
|
|
1254
|
-
// #region profile utils
|
|
1255
|
-
/**
|
|
1256
|
-
* util to retrieve fields from the $layer variable in the api context.
|
|
1257
|
-
*/
|
|
1258
|
-
const getFieldsFromLayerVariable = (profile) => {
|
|
1259
|
-
if (profile.variables) {
|
|
1260
|
-
const layerVar = profile.variables.find((variable) => variable.name === "$layer" && variable.type === "dictionary");
|
|
1261
|
-
return layerVar.properties ?? [];
|
|
1262
|
-
}
|
|
1263
|
-
return [];
|
|
1264
|
-
};
|
|
1265
|
-
// #endregion
|
|
1266
1254
|
|
|
1267
1255
|
/**
|
|
1268
1256
|
* Returns the sql-expression worker for the model.
|
|
@@ -1281,7 +1269,7 @@ async function getSqlExprWorker(uri) {
|
|
|
1281
1269
|
* @returns sql-expression mode module
|
|
1282
1270
|
*/
|
|
1283
1271
|
async function getMode() {
|
|
1284
|
-
return await import('./sql-expr-mode-
|
|
1272
|
+
return await import('./sql-expr-mode-626418cf.js');
|
|
1285
1273
|
}
|
|
1286
1274
|
|
|
1287
1275
|
const languageId = "arcgis-sql-expression";
|
|
@@ -1336,4 +1324,4 @@ class SqlExprDefaults extends LanguageDefaultsBase {
|
|
|
1336
1324
|
}
|
|
1337
1325
|
const sqlExprDefaults = new SqlExprDefaults();
|
|
1338
1326
|
|
|
1339
|
-
export { getMode as a,
|
|
1327
|
+
export { getMode as a, getSet as g, makeController as m, sqlExprDefaults as s, useControllerManager as u, watch as w };
|
|
@@ -0,0 +1,463 @@
|
|
|
1
|
+
/*!
|
|
2
|
+
* All material copyright Esri, All Rights Reserved, unless otherwise specified.
|
|
3
|
+
* See https://js.arcgis.com/4.31/esri/copyright.txt for details.
|
|
4
|
+
* v4.31.0-next.34
|
|
5
|
+
*/
|
|
6
|
+
import { g as editor, P as debounce, z as languages, Q as Emitter } from './language-defaults-base-42358eac.js';
|
|
7
|
+
import { s as sqlExprDefaults } from './sql-expr-defaults-b496e04d.js';
|
|
8
|
+
import './index-f65aa2e7.js';
|
|
9
|
+
|
|
10
|
+
/**
|
|
11
|
+
* Manager to create our sql-expression worker and client proxy
|
|
12
|
+
*/
|
|
13
|
+
class SqlExprWorkerManager {
|
|
14
|
+
constructor(_defaults) {
|
|
15
|
+
this._defaults = _defaults;
|
|
16
|
+
this._worker = null;
|
|
17
|
+
this._client = null;
|
|
18
|
+
// Observes the sql-expression defaults. If modified then stop the worker.
|
|
19
|
+
this._configChangeListener = this._defaults.onDidChange(() => this.stopWorker());
|
|
20
|
+
}
|
|
21
|
+
dispose() {
|
|
22
|
+
this._configChangeListener.dispose();
|
|
23
|
+
this.stopWorker();
|
|
24
|
+
}
|
|
25
|
+
stopWorker() {
|
|
26
|
+
if (this._worker) {
|
|
27
|
+
this._worker.dispose();
|
|
28
|
+
this._worker = null;
|
|
29
|
+
}
|
|
30
|
+
this._client = null;
|
|
31
|
+
}
|
|
32
|
+
async _getClientProxy() {
|
|
33
|
+
// We used createWebWorker to create or run the web worker if it isn’t already created.
|
|
34
|
+
// Otherwise, we get and return the proxy client.
|
|
35
|
+
if (!this._client) {
|
|
36
|
+
const { languageId, languageOptions } = this._defaults;
|
|
37
|
+
this._worker = editor.createWebWorker({
|
|
38
|
+
moduleId: "SqlExprWorker",
|
|
39
|
+
label: languageId,
|
|
40
|
+
createData: {
|
|
41
|
+
languageId,
|
|
42
|
+
languageOptions,
|
|
43
|
+
},
|
|
44
|
+
});
|
|
45
|
+
this._client = this._worker.getProxy();
|
|
46
|
+
}
|
|
47
|
+
return await this._client;
|
|
48
|
+
}
|
|
49
|
+
async getLanguageServiceWorker(...resources) {
|
|
50
|
+
const _client = await this._getClientProxy();
|
|
51
|
+
await this._worker?.withSyncedResources(resources);
|
|
52
|
+
return _client;
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
// list of properties that sit on a SQLNode and can have children
|
|
57
|
+
var ChildBearingProperties;
|
|
58
|
+
(function (ChildBearingProperties) {
|
|
59
|
+
ChildBearingProperties["ARGS"] = "args";
|
|
60
|
+
ChildBearingProperties["CLAUSES"] = "clauses";
|
|
61
|
+
ChildBearingProperties["ELSE"] = "else";
|
|
62
|
+
ChildBearingProperties["END"] = "end";
|
|
63
|
+
ChildBearingProperties["EXPR"] = "expr";
|
|
64
|
+
ChildBearingProperties["LEFT"] = "left";
|
|
65
|
+
ChildBearingProperties["OPERAND"] = "operand";
|
|
66
|
+
ChildBearingProperties["QUALIFIER"] = "qualifier";
|
|
67
|
+
ChildBearingProperties["RIGHT"] = "right";
|
|
68
|
+
ChildBearingProperties["START"] = "start";
|
|
69
|
+
ChildBearingProperties["VALUE"] = "value";
|
|
70
|
+
})(ChildBearingProperties || (ChildBearingProperties = {}));
|
|
71
|
+
// list of node types that can have children
|
|
72
|
+
var ChildBearingNodeTypes;
|
|
73
|
+
(function (ChildBearingNodeTypes) {
|
|
74
|
+
ChildBearingNodeTypes["CASE_EXPRESSION"] = "case-expression";
|
|
75
|
+
ChildBearingNodeTypes["EXPRESSION_LIST"] = "expression-list";
|
|
76
|
+
ChildBearingNodeTypes["FUNCTION"] = "function";
|
|
77
|
+
ChildBearingNodeTypes["INTERVAL"] = "interval";
|
|
78
|
+
ChildBearingNodeTypes["INTERVAL_QUALIFIER"] = "interval-qualifier";
|
|
79
|
+
ChildBearingNodeTypes["WHEN_CLAUSE"] = "when-clause";
|
|
80
|
+
ChildBearingNodeTypes["UNARY_EXPRESSION"] = "unary-expression";
|
|
81
|
+
ChildBearingNodeTypes["BINARY_EXPRESSION"] = "binary-expression";
|
|
82
|
+
})(ChildBearingNodeTypes || (ChildBearingNodeTypes = {}));
|
|
83
|
+
// use object to ensure the list matches the types from the JS api
|
|
84
|
+
const castDataTypesDict = {
|
|
85
|
+
date: "DATE",
|
|
86
|
+
float: "FLOAT",
|
|
87
|
+
integer: "INTEGER",
|
|
88
|
+
real: "REAL",
|
|
89
|
+
smallint: "SMALLINT",
|
|
90
|
+
time: "TIME",
|
|
91
|
+
timestamp: "TIMESTAMP",
|
|
92
|
+
varchar: "VARCHAR",
|
|
93
|
+
};
|
|
94
|
+
// convert the object to a list of strings for easier use, but keep type information
|
|
95
|
+
Object.values(castDataTypesDict);
|
|
96
|
+
const sqlExprKeywords = [
|
|
97
|
+
"AND",
|
|
98
|
+
"AS",
|
|
99
|
+
"BETWEEN",
|
|
100
|
+
"BOTH",
|
|
101
|
+
"CASE",
|
|
102
|
+
"CAST",
|
|
103
|
+
"CURRENT_DATE",
|
|
104
|
+
"CURRENT_TIME",
|
|
105
|
+
"CURRENT_TIMESTAMP",
|
|
106
|
+
"DATE",
|
|
107
|
+
"DAY",
|
|
108
|
+
"ELSE",
|
|
109
|
+
"END",
|
|
110
|
+
"ESCAPE",
|
|
111
|
+
"FALSE",
|
|
112
|
+
"FLOAT",
|
|
113
|
+
"FOR",
|
|
114
|
+
"FROM",
|
|
115
|
+
"HOUR",
|
|
116
|
+
"IN",
|
|
117
|
+
"INTEGER",
|
|
118
|
+
"INTERVAL",
|
|
119
|
+
"IS",
|
|
120
|
+
"LEADING",
|
|
121
|
+
"LIKE",
|
|
122
|
+
"MINUTE",
|
|
123
|
+
"MONTH",
|
|
124
|
+
"NOT",
|
|
125
|
+
"NULL",
|
|
126
|
+
"OR",
|
|
127
|
+
"POSITION",
|
|
128
|
+
"REAL",
|
|
129
|
+
"SECOND",
|
|
130
|
+
"SMALLINT",
|
|
131
|
+
"SUBSTRING",
|
|
132
|
+
"THEN",
|
|
133
|
+
"TIME",
|
|
134
|
+
"TIMESTAMP",
|
|
135
|
+
"TIMEZONE_HOUR",
|
|
136
|
+
"TIMEZONE_MINUTE",
|
|
137
|
+
"TO",
|
|
138
|
+
"TRAILING",
|
|
139
|
+
"TRIM",
|
|
140
|
+
"TRUE",
|
|
141
|
+
"VARCHAR",
|
|
142
|
+
"WHEN",
|
|
143
|
+
"WITH",
|
|
144
|
+
"YEAR",
|
|
145
|
+
"ZONE",
|
|
146
|
+
];
|
|
147
|
+
const sqlExprOperators = [
|
|
148
|
+
// Logical
|
|
149
|
+
"AND",
|
|
150
|
+
"BETWEEN",
|
|
151
|
+
"IN",
|
|
152
|
+
"LIKE",
|
|
153
|
+
"NOT",
|
|
154
|
+
"OR",
|
|
155
|
+
// Predicates
|
|
156
|
+
"IS",
|
|
157
|
+
"NULL",
|
|
158
|
+
];
|
|
159
|
+
const sqlExprFunctions = [
|
|
160
|
+
// Conversion
|
|
161
|
+
"CAST",
|
|
162
|
+
// Datetime
|
|
163
|
+
"EXTRACT",
|
|
164
|
+
"CURRENT_DATE",
|
|
165
|
+
"CURRENT_TIME",
|
|
166
|
+
"CURRENT_TIMESTAMP",
|
|
167
|
+
// Mathematical
|
|
168
|
+
"ABS",
|
|
169
|
+
"ACOS",
|
|
170
|
+
"ASIN",
|
|
171
|
+
"ATAN",
|
|
172
|
+
"CEILING",
|
|
173
|
+
"COS",
|
|
174
|
+
"FLOOR",
|
|
175
|
+
"LOG",
|
|
176
|
+
"LOG10",
|
|
177
|
+
"POWER",
|
|
178
|
+
"ROUND",
|
|
179
|
+
"SIGN",
|
|
180
|
+
"SIN",
|
|
181
|
+
"TAN",
|
|
182
|
+
// String
|
|
183
|
+
"CHAR_LENGTH",
|
|
184
|
+
"COALESCE",
|
|
185
|
+
"CONCAT",
|
|
186
|
+
"LOWER",
|
|
187
|
+
"POSITION",
|
|
188
|
+
"TRIM",
|
|
189
|
+
"UPPER",
|
|
190
|
+
];
|
|
191
|
+
|
|
192
|
+
const sqlExprLanguageConfig = {
|
|
193
|
+
comments: {
|
|
194
|
+
lineComment: "--",
|
|
195
|
+
blockComment: ["/*", "*/"],
|
|
196
|
+
},
|
|
197
|
+
brackets: [
|
|
198
|
+
["{", "}"],
|
|
199
|
+
["[", "]"],
|
|
200
|
+
["(", ")"],
|
|
201
|
+
],
|
|
202
|
+
autoClosingPairs: [
|
|
203
|
+
{ open: "{", close: "}" },
|
|
204
|
+
{ open: "[", close: "]" },
|
|
205
|
+
{ open: "(", close: ")" },
|
|
206
|
+
{ open: '"', close: '"' },
|
|
207
|
+
{ open: "'", close: "'" },
|
|
208
|
+
],
|
|
209
|
+
surroundingPairs: [
|
|
210
|
+
{ open: "{", close: "}" },
|
|
211
|
+
{ open: "[", close: "]" },
|
|
212
|
+
{ open: "(", close: ")" },
|
|
213
|
+
{ open: '"', close: '"' },
|
|
214
|
+
{ open: "'", close: "'" },
|
|
215
|
+
],
|
|
216
|
+
};
|
|
217
|
+
// TODO: trim down
|
|
218
|
+
const sqlExprLanguageSyntax = {
|
|
219
|
+
defaultToken: "",
|
|
220
|
+
tokenPostfix: ".sql",
|
|
221
|
+
ignoreCase: true,
|
|
222
|
+
brackets: [
|
|
223
|
+
{ open: "[", close: "]", token: "delimiter.square" },
|
|
224
|
+
{ open: "(", close: ")", token: "delimiter.parenthesis" },
|
|
225
|
+
],
|
|
226
|
+
keywords: sqlExprKeywords,
|
|
227
|
+
operators: sqlExprOperators,
|
|
228
|
+
builtinFunctions: sqlExprFunctions,
|
|
229
|
+
builtinVariables: [],
|
|
230
|
+
tokenizer: {
|
|
231
|
+
root: [
|
|
232
|
+
{ include: "@comments" },
|
|
233
|
+
{ include: "@whitespace" },
|
|
234
|
+
{ include: "@numbers" },
|
|
235
|
+
{ include: "@strings" },
|
|
236
|
+
{ include: "@complexIdentifiers" },
|
|
237
|
+
{ include: "@scopes" },
|
|
238
|
+
[/[;,.]/, "delimiter"],
|
|
239
|
+
[/[()]/, "@brackets"],
|
|
240
|
+
[
|
|
241
|
+
/[\w@#$]+/,
|
|
242
|
+
{
|
|
243
|
+
cases: {
|
|
244
|
+
"@operators": "operator",
|
|
245
|
+
"@builtinVariables": "predefined",
|
|
246
|
+
"@builtinFunctions": "predefined",
|
|
247
|
+
"@keywords": "keyword",
|
|
248
|
+
"@default": "identifier",
|
|
249
|
+
},
|
|
250
|
+
},
|
|
251
|
+
],
|
|
252
|
+
[/[<>=!%&+\-*/|~^]/, "operator"],
|
|
253
|
+
],
|
|
254
|
+
whitespace: [[/\s+/, "white"]],
|
|
255
|
+
comments: [
|
|
256
|
+
[/--+.*/, "comment"],
|
|
257
|
+
[/\/\*/, { token: "comment.quote", next: "@comment" }],
|
|
258
|
+
],
|
|
259
|
+
comment: [
|
|
260
|
+
[/[^*/]+/, "comment"],
|
|
261
|
+
// Not supporting nested comments, as nested comments seem to not be standard?
|
|
262
|
+
// i.e. http://stackoverflow.com/questions/728172/are-there-multiline-comment-delimiters-in-sql-that-are-vendor-agnostic
|
|
263
|
+
// [/\/\*/, { token: 'comment.quote', next: '@push' }], // nested comment not allowed :-(
|
|
264
|
+
[/\*\//, { token: "comment.quote", next: "@pop" }],
|
|
265
|
+
[/./, "comment"],
|
|
266
|
+
],
|
|
267
|
+
numbers: [
|
|
268
|
+
[/0[xX][0-9a-fA-F]*/, "number"],
|
|
269
|
+
[/[$][+-]*\d*(\.\d*)?/, "number"],
|
|
270
|
+
[/((\d+(\.\d*)?)|(\.\d+))([eE][\-+]?\d+)?/, "number"],
|
|
271
|
+
],
|
|
272
|
+
strings: [
|
|
273
|
+
[/N'/, { token: "string", next: "@string" }],
|
|
274
|
+
[/'/, { token: "string", next: "@string" }],
|
|
275
|
+
],
|
|
276
|
+
string: [
|
|
277
|
+
[/[^']+/, "string"],
|
|
278
|
+
[/''/, "string"],
|
|
279
|
+
[/'/, { token: "string", next: "@pop" }],
|
|
280
|
+
],
|
|
281
|
+
complexIdentifiers: [[/"/, { token: "identifier.quote", next: "@quotedIdentifier" }]],
|
|
282
|
+
quotedIdentifier: [
|
|
283
|
+
[/[^"]+/, "identifier"],
|
|
284
|
+
[/""/, "identifier"],
|
|
285
|
+
[/"/, { token: "identifier.quote", next: "@pop" }],
|
|
286
|
+
],
|
|
287
|
+
scopes: [
|
|
288
|
+
[/(BEGIN|CASE)\b/i, { token: "keyword.block" }],
|
|
289
|
+
[/END\b/i, { token: "keyword.block" }],
|
|
290
|
+
[/WHEN\b/i, { token: "keyword.choice" }],
|
|
291
|
+
[/THEN\b/i, { token: "keyword.choice" }],
|
|
292
|
+
],
|
|
293
|
+
},
|
|
294
|
+
};
|
|
295
|
+
|
|
296
|
+
class SqlExprCompletionProvider {
|
|
297
|
+
constructor(_worker, _defaults) {
|
|
298
|
+
this._worker = _worker;
|
|
299
|
+
this._defaults = _defaults;
|
|
300
|
+
}
|
|
301
|
+
async provideCompletionItems(model, position) {
|
|
302
|
+
try {
|
|
303
|
+
const worker = await this._worker(model.uri);
|
|
304
|
+
const word = model.getWordUntilPosition(position);
|
|
305
|
+
const range = {
|
|
306
|
+
startLineNumber: position.lineNumber,
|
|
307
|
+
endLineNumber: position.lineNumber,
|
|
308
|
+
startColumn: word.startColumn,
|
|
309
|
+
endColumn: word.endColumn,
|
|
310
|
+
};
|
|
311
|
+
const apiContext = this._defaults.getApiContextForModel(model.uri);
|
|
312
|
+
return await worker.doComplete(model.uri.toString(), range, position, apiContext);
|
|
313
|
+
}
|
|
314
|
+
catch (err) {
|
|
315
|
+
console.error(err);
|
|
316
|
+
return { suggestions: [] };
|
|
317
|
+
}
|
|
318
|
+
}
|
|
319
|
+
}
|
|
320
|
+
// TODO: create DiagnosticsAdapter common class
|
|
321
|
+
class SqlExprDiagnosticsAdapter {
|
|
322
|
+
constructor(_languageId, _worker, { defaults, diagnosticService, }) {
|
|
323
|
+
this._languageId = _languageId;
|
|
324
|
+
this._worker = _worker;
|
|
325
|
+
this._disposables = [];
|
|
326
|
+
this._listener = new Map();
|
|
327
|
+
this._diagnosticsService = diagnosticService;
|
|
328
|
+
this._defaults = defaults;
|
|
329
|
+
const onModelAdd = (model) => {
|
|
330
|
+
const languageId = model.getLanguageId();
|
|
331
|
+
if (languageId !== this._languageId) {
|
|
332
|
+
return;
|
|
333
|
+
}
|
|
334
|
+
const debouncedValidate = debounce(() => {
|
|
335
|
+
this._doValidate(model, languageId).catch((err) => {
|
|
336
|
+
throw err;
|
|
337
|
+
});
|
|
338
|
+
});
|
|
339
|
+
this._listener.set(model.uri.toString(), model.onDidChangeContent(debouncedValidate));
|
|
340
|
+
this._doValidate(model, languageId).catch(console.error);
|
|
341
|
+
};
|
|
342
|
+
const onModelRemoved = (model) => {
|
|
343
|
+
const uri = model.uri.toString();
|
|
344
|
+
editor.setModelMarkers(model, this._languageId, []);
|
|
345
|
+
const listener = this._listener.get(uri);
|
|
346
|
+
if (listener) {
|
|
347
|
+
listener.dispose();
|
|
348
|
+
this._listener.delete(uri);
|
|
349
|
+
}
|
|
350
|
+
};
|
|
351
|
+
this._disposables.push(editor.onDidCreateModel(onModelAdd));
|
|
352
|
+
this._disposables.push(editor.onWillDisposeModel((model) => onModelRemoved(model)));
|
|
353
|
+
this._disposables.push(editor.onDidChangeModelLanguage((event) => {
|
|
354
|
+
onModelRemoved(event.model);
|
|
355
|
+
onModelAdd(event.model);
|
|
356
|
+
}));
|
|
357
|
+
this._disposables.push(defaults.onDidChange(() => {
|
|
358
|
+
editor.getModels().forEach((model) => {
|
|
359
|
+
if (model.getLanguageId() === this._languageId) {
|
|
360
|
+
onModelRemoved(model);
|
|
361
|
+
onModelAdd(model);
|
|
362
|
+
}
|
|
363
|
+
});
|
|
364
|
+
}));
|
|
365
|
+
this._disposables.push(defaults.onModelContextDidChange((key) => {
|
|
366
|
+
editor.getModels().forEach((model) => {
|
|
367
|
+
if (model.getLanguageId() === this._languageId && model.uri.toString() === key) {
|
|
368
|
+
this._doValidate(model, this._languageId).catch(console.error);
|
|
369
|
+
}
|
|
370
|
+
});
|
|
371
|
+
}));
|
|
372
|
+
this._disposables.push({
|
|
373
|
+
dispose: () => {
|
|
374
|
+
this._listener.forEach((value) => value.dispose());
|
|
375
|
+
this._listener.clear();
|
|
376
|
+
},
|
|
377
|
+
});
|
|
378
|
+
editor.getModels().forEach(onModelAdd);
|
|
379
|
+
}
|
|
380
|
+
async _doValidate(model, languageId) {
|
|
381
|
+
if (!model.isAttachedToEditor()) {
|
|
382
|
+
return;
|
|
383
|
+
}
|
|
384
|
+
try {
|
|
385
|
+
const workerProxy = await this._worker(model.uri);
|
|
386
|
+
const context = this._defaults.getApiContextForModel(model.uri);
|
|
387
|
+
const diagnostics = await workerProxy.doValidation(model.uri.toString(), context);
|
|
388
|
+
this._diagnosticsService.fireDiagnosticsChange(model.uri, diagnostics);
|
|
389
|
+
editor.setModelMarkers(model, languageId, diagnostics);
|
|
390
|
+
}
|
|
391
|
+
catch (err) {
|
|
392
|
+
console.error(err);
|
|
393
|
+
}
|
|
394
|
+
}
|
|
395
|
+
}
|
|
396
|
+
|
|
397
|
+
let sqlExprWorker;
|
|
398
|
+
/**
|
|
399
|
+
* Returns the sql-expression worker for the model uris.
|
|
400
|
+
* @param uris The model uris for which to get the worker.
|
|
401
|
+
* @returns The sql-expression worker.
|
|
402
|
+
*/
|
|
403
|
+
async function getSqlExprWorker(...uris) {
|
|
404
|
+
return await new Promise((resolve, reject) => {
|
|
405
|
+
if (!sqlExprWorker) {
|
|
406
|
+
reject(new Error("sql expression worker not registered!"));
|
|
407
|
+
return;
|
|
408
|
+
}
|
|
409
|
+
resolve(sqlExprWorker(...uris));
|
|
410
|
+
});
|
|
411
|
+
}
|
|
412
|
+
class SqlExprDiagnosticService {
|
|
413
|
+
constructor() {
|
|
414
|
+
this._onDiagnosticsChange = new Emitter();
|
|
415
|
+
}
|
|
416
|
+
/**
|
|
417
|
+
* An event to signal changes to the diagnostics.
|
|
418
|
+
* The event value is the uri string and the diagnostics.
|
|
419
|
+
*/
|
|
420
|
+
get onDiagnosticsChange() {
|
|
421
|
+
return this._onDiagnosticsChange.event;
|
|
422
|
+
}
|
|
423
|
+
/**
|
|
424
|
+
* Fires the diagnostics change event.
|
|
425
|
+
* @param uri The uri of the model for which the diagnostics changed.
|
|
426
|
+
* @param diagnostics The diagnostics for the model.
|
|
427
|
+
*/
|
|
428
|
+
fireDiagnosticsChange(uri, diagnostics) {
|
|
429
|
+
this._onDiagnosticsChange.fire({ uri, diagnostics });
|
|
430
|
+
}
|
|
431
|
+
}
|
|
432
|
+
const sqlExprDiagnosticService = new SqlExprDiagnosticService();
|
|
433
|
+
/**
|
|
434
|
+
*
|
|
435
|
+
* @returns The Sql Expression Diagnostic Service.
|
|
436
|
+
*/
|
|
437
|
+
function getSqlExprDiagnosticService() {
|
|
438
|
+
return sqlExprDiagnosticService;
|
|
439
|
+
}
|
|
440
|
+
function setupMode(defaults) {
|
|
441
|
+
const client = new SqlExprWorkerManager(defaults);
|
|
442
|
+
const workerAccessor = async (...uris) => await client.getLanguageServiceWorker(...uris);
|
|
443
|
+
sqlExprWorker = workerAccessor;
|
|
444
|
+
// Use the sql-expression Monarch Json to define the highlighting
|
|
445
|
+
languages.setMonarchTokensProvider(sqlExprDefaults.languageId, sqlExprLanguageSyntax);
|
|
446
|
+
languages.setLanguageConfiguration(sqlExprDefaults.languageId, sqlExprLanguageConfig);
|
|
447
|
+
const completionProvider = new SqlExprCompletionProvider(workerAccessor, sqlExprDefaults);
|
|
448
|
+
languages.registerCompletionItemProvider(sqlExprDefaults.languageId, completionProvider);
|
|
449
|
+
// Creates and registers a Completion Adapter
|
|
450
|
+
// Registers a completion item provider for our custom language
|
|
451
|
+
// TODO: Creates and registers a Formatter
|
|
452
|
+
// languages.registerDocumentFormattingEditProvider(
|
|
453
|
+
// SqlExprDefaults.languageId,
|
|
454
|
+
// new FormattingProvider(workerAccessor, SqlExprDefaults),
|
|
455
|
+
// );
|
|
456
|
+
// eslint-disable-next-line no-new
|
|
457
|
+
new SqlExprDiagnosticsAdapter(defaults.languageId, workerAccessor, {
|
|
458
|
+
defaults,
|
|
459
|
+
diagnosticService: sqlExprDiagnosticService,
|
|
460
|
+
});
|
|
461
|
+
}
|
|
462
|
+
|
|
463
|
+
export { getSqlExprDiagnosticService, getSqlExprWorker, setupMode };
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
/*!
|
|
2
2
|
* All material copyright Esri, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
* See https://js.arcgis.com/4.31/esri/copyright.txt for details.
|
|
4
|
-
* v4.31.0-next.
|
|
4
|
+
* v4.31.0-next.34
|
|
5
5
|
*/
|
|
6
|
-
import { N as typescriptDefaults, M as monaco_editor_core_star } from './language-defaults-base-
|
|
6
|
+
import { N as typescriptDefaults, M as monaco_editor_core_star } from './language-defaults-base-42358eac.js';
|
|
7
7
|
|
|
8
8
|
/*!-----------------------------------------------------------------------------
|
|
9
9
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
/*!
|
|
2
2
|
* All material copyright Esri, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
* See https://js.arcgis.com/4.31/esri/copyright.txt for details.
|
|
4
|
-
* v4.31.0-next.
|
|
4
|
+
* v4.31.0-next.34
|
|
5
5
|
*/
|
|
6
|
-
import { M as monaco_editor_core_star } from './language-defaults-base-
|
|
6
|
+
import { M as monaco_editor_core_star } from './language-defaults-base-42358eac.js';
|
|
7
7
|
|
|
8
8
|
/*!-----------------------------------------------------------------------------
|
|
9
9
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
package/dist/loader/cdn.js
CHANGED
package/dist/loader/index.cjs.js
CHANGED
package/dist/loader/index.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/*!
|
|
2
2
|
* All material copyright Esri, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
* See https://js.arcgis.com/4.31/esri/copyright.txt for details.
|
|
4
|
-
* v4.31.0-next.
|
|
4
|
+
* v4.31.0-next.34
|
|
5
5
|
*/
|
|
6
6
|
(function(){if("undefined"!==typeof window&&void 0!==window.Reflect&&void 0!==window.customElements){var a=HTMLElement;window.HTMLElement=function(){return Reflect.construct(a,[],this.constructor)};HTMLElement.prototype=a.prototype;HTMLElement.prototype.constructor=HTMLElement;Object.setPrototypeOf(HTMLElement,a)}})();
|
|
7
7
|
export * from '../esm/loader.js';
|
|
@@ -1,6 +1,56 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
1
|
+
/**
|
|
2
|
+
* @remarks This module is only intended to be loaded within the SQL expression worker.
|
|
3
|
+
*/
|
|
4
|
+
import type { IRange, Position, languages } from "monaco-editor";
|
|
5
|
+
import type { ApiDatabase, ApiVariable } from "@arcgis/languages-api-utils";
|
|
6
|
+
import type { ICompletionContext } from "./types";
|
|
7
|
+
/**
|
|
8
|
+
* Class used for sql expression completion
|
|
9
|
+
*/
|
|
10
|
+
export declare class SqlExpressionCompletion {
|
|
11
|
+
private _sdkFunctions;
|
|
12
|
+
private _fields;
|
|
13
|
+
constructor(sdkLibrary: ApiDatabase, fields: ApiVariable[]);
|
|
14
|
+
getCompletions(range: IRange, modelContent: string, position: Position): Promise<languages.CompletionItem[]>;
|
|
15
|
+
/**
|
|
16
|
+
* traverses the tree to find the node that contains the current position
|
|
17
|
+
* @param node The current node to traverse
|
|
18
|
+
* @param position The current position
|
|
19
|
+
*/
|
|
20
|
+
traverse(node: __esri.SQLNode, completionContext: ICompletionContext): void;
|
|
21
|
+
/**
|
|
22
|
+
* gets completions by finding the context of the current node and suggesting completions based on that context
|
|
23
|
+
*/
|
|
24
|
+
private _getCompletions;
|
|
25
|
+
/**
|
|
26
|
+
* utilizes peggy's error handling to provide suggestions for the user.
|
|
27
|
+
*/
|
|
28
|
+
private handleParserFailure;
|
|
29
|
+
/**
|
|
30
|
+
* gets completions based on the function node
|
|
31
|
+
* @param context the context root of the current node, see {@link identifyContextRoot}
|
|
32
|
+
* @param slotPosition the position of the current node in the context root, see {@link getSlotPosition}
|
|
33
|
+
* @param completionContext the completion context
|
|
34
|
+
*/
|
|
35
|
+
private _getCompletionsFromFunction;
|
|
36
|
+
/**
|
|
37
|
+
* checks if the position is within the current node
|
|
38
|
+
* @param node The current node to check
|
|
39
|
+
* @param position The current position
|
|
40
|
+
* @returns boolean
|
|
41
|
+
*/
|
|
42
|
+
private _isPositionWithinNode;
|
|
43
|
+
private _suggestFields;
|
|
44
|
+
private _suggestFunctions;
|
|
45
|
+
private _suggestDataTypes;
|
|
46
|
+
private _suggestDatePeriods;
|
|
47
|
+
private _suggestTrimParts;
|
|
48
|
+
private _suggestDateLiterals;
|
|
49
|
+
private _suggestExpressions;
|
|
50
|
+
private _suggestNull;
|
|
51
|
+
/**
|
|
52
|
+
* looks at the node and finds any children attached to it. If there are children, it will traverse them.
|
|
53
|
+
* @param node The current node to traverse
|
|
54
|
+
*/
|
|
55
|
+
private _traverseChildren;
|
|
56
|
+
}
|