@arcgis/coding-components 4.31.0-next.32 → 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-c2440aac.js → p-102debc5.js} +2 -2
- package/dist/arcgis-coding-components/{p-2c79cdd2.js → p-1bce90df.js} +1 -1
- package/dist/arcgis-coding-components/{p-fd94b404.js → p-226d94e2.js} +2 -2
- package/dist/arcgis-coding-components/{p-5db7e141.js → p-2680fa02.js} +2 -2
- package/dist/arcgis-coding-components/{p-9e521d43.js → p-27169bfc.js} +2 -2
- package/dist/arcgis-coding-components/{p-9cfd27ab.js → p-2a576903.js} +2 -2
- package/dist/arcgis-coding-components/{p-49e97608.entry.js → p-3c3209ac.entry.js} +2 -2
- package/dist/arcgis-coding-components/p-6de7e7ae.js +6 -0
- package/dist/arcgis-coding-components/{p-4a04e849.js → p-77245004.js} +2 -2
- package/dist/arcgis-coding-components/p-82fb561d.js +6 -0
- package/dist/arcgis-coding-components/{p-4f46e6ac.js → p-8423b230.js} +2 -2
- package/dist/arcgis-coding-components/{p-4fcbd73e.js → p-85a8c1ea.js} +2 -2
- package/dist/arcgis-coding-components/{p-4588edac.js → p-8b57879b.js} +2 -2
- package/dist/arcgis-coding-components/{p-1a675634.js → p-94d2e235.js} +1 -1
- package/dist/arcgis-coding-components/{p-aa2689dc.js → p-abdf566d.js} +9 -9
- package/dist/arcgis-coding-components/{p-69c92c90.js → p-ad4575ad.js} +1 -1
- package/dist/arcgis-coding-components/{p-d5bd5390.entry.js → p-b6c88155.entry.js} +2 -2
- package/dist/arcgis-coding-components/{p-0a2fa466.entry.js → p-c11b620f.entry.js} +2 -2
- package/dist/cjs/{app-globals-bf839fe4.js → app-globals-7c96ec13.js} +1 -1
- package/dist/cjs/{arcade-defaults-ac2a291d.js → arcade-defaults-41afd487.js} +4 -4
- package/dist/cjs/{arcade-mode-83faa797.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-e4051cbf.js → css-894931ae.js} +1 -1
- package/dist/cjs/{cssMode-1fd0a3ad.js → cssMode-6a5028d4.js} +2 -2
- package/dist/cjs/{html-aaf65f03.js → html-dda4542d.js} +2 -2
- package/dist/cjs/{htmlMode-2824b015.js → htmlMode-983bb1b6.js} +2 -2
- package/dist/cjs/{index-014f39e0.js → index-7dad49d8.js} +1 -1
- package/dist/cjs/index.cjs.js +4 -4
- package/dist/cjs/{javascript-b5c9decb.js → javascript-6ba81d8b.js} +3 -3
- package/dist/cjs/{jsonMode-1fd3a8a3.js → jsonMode-caca2bdb.js} +2 -2
- package/dist/cjs/{language-defaults-base-8fcd2252.js → language-defaults-base-a5648a80.js} +9 -29
- package/dist/cjs/loader.cjs.js +3 -3
- package/dist/cjs/{sql-expr-defaults-96a65f60.js → sql-expr-defaults-8860e52d.js} +4 -17
- package/dist/cjs/sql-expr-mode-09647860.js +467 -0
- package/dist/cjs/{tsMode-2eccff9f.js → tsMode-ec3475be.js} +2 -2
- package/dist/cjs/{typescript-be142a49.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 +26 -26
- package/dist/components/arcgis-assets.js +2 -2
- 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.d.ts +3 -18
- 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-d07fd226.js → app-globals-424a420a.js} +1 -1
- package/dist/esm/{arcade-defaults-a1c83e3a.js → arcade-defaults-412fa0f2.js} +4 -4
- package/dist/esm/{arcade-mode-d7fa3ea8.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-dbad9053.js → css-71097c66.js} +1 -1
- package/dist/esm/{cssMode-5d2d30fd.js → cssMode-72309bd9.js} +2 -2
- package/dist/esm/{html-ab48e12a.js → html-8592a408.js} +2 -2
- package/dist/esm/{htmlMode-b1e0354c.js → htmlMode-0943cb15.js} +2 -2
- package/dist/esm/{index-5867d400.js → index-f65aa2e7.js} +1 -1
- package/dist/esm/index.js +4 -4
- package/dist/esm/{javascript-734d1821.js → javascript-a33a7f7a.js} +3 -3
- package/dist/esm/{jsonMode-177925fe.js → jsonMode-1435c17d.js} +2 -2
- package/dist/esm/{language-defaults-base-745ed48c.js → language-defaults-base-42358eac.js} +10 -28
- package/dist/esm/loader.js +4 -4
- package/dist/esm/{sql-expr-defaults-9f3e2604.js → sql-expr-defaults-b496e04d.js} +5 -17
- package/dist/esm/sql-expr-mode-626418cf.js +463 -0
- package/dist/esm/{tsMode-3836fed5.js → tsMode-50c3b01e.js} +2 -2
- package/dist/esm/{typescript-84db9ae0.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-06242845.js +0 -6
- package/dist/arcgis-coding-components/p-531bda1b.js +0 -6
- package/dist/arcgis-coding-components/p-92a0108e.js +0 -6
- package/dist/cjs/arcade-language-features-c3a319a5.js +0 -274
- package/dist/cjs/sql-expr-mode-9c838de2.js +0 -1171
- package/dist/components/arcade-language-features.js +0 -271
- package/dist/esm/arcade-language-features-f90d7754.js +0 -269
- package/dist/esm/sql-expr-mode-c7d89036.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/cjs/loader.cjs.js
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
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
|
'use strict';
|
|
7
7
|
|
|
8
8
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
9
9
|
|
|
10
|
-
const index = require('./index-
|
|
11
|
-
const appGlobals = require('./app-globals-
|
|
10
|
+
const index = require('./index-7dad49d8.js');
|
|
11
|
+
const appGlobals = require('./app-globals-7c96ec13.js');
|
|
12
12
|
|
|
13
13
|
const defineCustomElements = async (win, options) => {
|
|
14
14
|
if (typeof window === 'undefined') return undefined;
|
|
@@ -1,12 +1,12 @@
|
|
|
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
|
'use strict';
|
|
7
7
|
|
|
8
|
-
const languageDefaultsBase = require('./language-defaults-base-
|
|
9
|
-
const index = require('./index-
|
|
8
|
+
const languageDefaultsBase = require('./language-defaults-base-a5648a80.js');
|
|
9
|
+
const index = require('./index-7dad49d8.js');
|
|
10
10
|
|
|
11
11
|
// src/framework.ts
|
|
12
12
|
function retrieveComponentMembers(component, isLit) {
|
|
@@ -1253,18 +1253,6 @@ async function convertToEditorProfileDefinition(predefinedProfile, locale = "en"
|
|
|
1253
1253
|
return editorProfile;
|
|
1254
1254
|
}
|
|
1255
1255
|
// #endregion
|
|
1256
|
-
// #region profile utils
|
|
1257
|
-
/**
|
|
1258
|
-
* util to retrieve fields from the $layer variable in the api context.
|
|
1259
|
-
*/
|
|
1260
|
-
const getFieldsFromLayerVariable = (profile) => {
|
|
1261
|
-
if (profile.variables) {
|
|
1262
|
-
const layerVar = profile.variables.find((variable) => variable.name === "$layer" && variable.type === "dictionary");
|
|
1263
|
-
return layerVar.properties ?? [];
|
|
1264
|
-
}
|
|
1265
|
-
return [];
|
|
1266
|
-
};
|
|
1267
|
-
// #endregion
|
|
1268
1256
|
|
|
1269
1257
|
/**
|
|
1270
1258
|
* Returns the sql-expression worker for the model.
|
|
@@ -1283,7 +1271,7 @@ async function getSqlExprWorker(uri) {
|
|
|
1283
1271
|
* @returns sql-expression mode module
|
|
1284
1272
|
*/
|
|
1285
1273
|
async function getMode() {
|
|
1286
|
-
return await Promise.resolve().then(function () { return require('./sql-expr-mode-
|
|
1274
|
+
return await Promise.resolve().then(function () { return require('./sql-expr-mode-09647860.js'); });
|
|
1287
1275
|
}
|
|
1288
1276
|
|
|
1289
1277
|
const languageId = "arcgis-sql-expression";
|
|
@@ -1338,7 +1326,6 @@ class SqlExprDefaults extends languageDefaultsBase.LanguageDefaultsBase {
|
|
|
1338
1326
|
}
|
|
1339
1327
|
const sqlExprDefaults = new SqlExprDefaults();
|
|
1340
1328
|
|
|
1341
|
-
exports.getFieldsFromLayerVariable = getFieldsFromLayerVariable;
|
|
1342
1329
|
exports.getMode = getMode;
|
|
1343
1330
|
exports.getSet = getSet;
|
|
1344
1331
|
exports.makeController = makeController;
|
|
@@ -0,0 +1,467 @@
|
|
|
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
|
+
'use strict';
|
|
7
|
+
|
|
8
|
+
const languageDefaultsBase = require('./language-defaults-base-a5648a80.js');
|
|
9
|
+
const sqlExprDefaults = require('./sql-expr-defaults-8860e52d.js');
|
|
10
|
+
require('./index-7dad49d8.js');
|
|
11
|
+
|
|
12
|
+
/**
|
|
13
|
+
* Manager to create our sql-expression worker and client proxy
|
|
14
|
+
*/
|
|
15
|
+
class SqlExprWorkerManager {
|
|
16
|
+
constructor(_defaults) {
|
|
17
|
+
this._defaults = _defaults;
|
|
18
|
+
this._worker = null;
|
|
19
|
+
this._client = null;
|
|
20
|
+
// Observes the sql-expression defaults. If modified then stop the worker.
|
|
21
|
+
this._configChangeListener = this._defaults.onDidChange(() => this.stopWorker());
|
|
22
|
+
}
|
|
23
|
+
dispose() {
|
|
24
|
+
this._configChangeListener.dispose();
|
|
25
|
+
this.stopWorker();
|
|
26
|
+
}
|
|
27
|
+
stopWorker() {
|
|
28
|
+
if (this._worker) {
|
|
29
|
+
this._worker.dispose();
|
|
30
|
+
this._worker = null;
|
|
31
|
+
}
|
|
32
|
+
this._client = null;
|
|
33
|
+
}
|
|
34
|
+
async _getClientProxy() {
|
|
35
|
+
// We used createWebWorker to create or run the web worker if it isn’t already created.
|
|
36
|
+
// Otherwise, we get and return the proxy client.
|
|
37
|
+
if (!this._client) {
|
|
38
|
+
const { languageId, languageOptions } = this._defaults;
|
|
39
|
+
this._worker = languageDefaultsBase.editor.createWebWorker({
|
|
40
|
+
moduleId: "SqlExprWorker",
|
|
41
|
+
label: languageId,
|
|
42
|
+
createData: {
|
|
43
|
+
languageId,
|
|
44
|
+
languageOptions,
|
|
45
|
+
},
|
|
46
|
+
});
|
|
47
|
+
this._client = this._worker.getProxy();
|
|
48
|
+
}
|
|
49
|
+
return await this._client;
|
|
50
|
+
}
|
|
51
|
+
async getLanguageServiceWorker(...resources) {
|
|
52
|
+
const _client = await this._getClientProxy();
|
|
53
|
+
await this._worker?.withSyncedResources(resources);
|
|
54
|
+
return _client;
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
// list of properties that sit on a SQLNode and can have children
|
|
59
|
+
var ChildBearingProperties;
|
|
60
|
+
(function (ChildBearingProperties) {
|
|
61
|
+
ChildBearingProperties["ARGS"] = "args";
|
|
62
|
+
ChildBearingProperties["CLAUSES"] = "clauses";
|
|
63
|
+
ChildBearingProperties["ELSE"] = "else";
|
|
64
|
+
ChildBearingProperties["END"] = "end";
|
|
65
|
+
ChildBearingProperties["EXPR"] = "expr";
|
|
66
|
+
ChildBearingProperties["LEFT"] = "left";
|
|
67
|
+
ChildBearingProperties["OPERAND"] = "operand";
|
|
68
|
+
ChildBearingProperties["QUALIFIER"] = "qualifier";
|
|
69
|
+
ChildBearingProperties["RIGHT"] = "right";
|
|
70
|
+
ChildBearingProperties["START"] = "start";
|
|
71
|
+
ChildBearingProperties["VALUE"] = "value";
|
|
72
|
+
})(ChildBearingProperties || (ChildBearingProperties = {}));
|
|
73
|
+
// list of node types that can have children
|
|
74
|
+
var ChildBearingNodeTypes;
|
|
75
|
+
(function (ChildBearingNodeTypes) {
|
|
76
|
+
ChildBearingNodeTypes["CASE_EXPRESSION"] = "case-expression";
|
|
77
|
+
ChildBearingNodeTypes["EXPRESSION_LIST"] = "expression-list";
|
|
78
|
+
ChildBearingNodeTypes["FUNCTION"] = "function";
|
|
79
|
+
ChildBearingNodeTypes["INTERVAL"] = "interval";
|
|
80
|
+
ChildBearingNodeTypes["INTERVAL_QUALIFIER"] = "interval-qualifier";
|
|
81
|
+
ChildBearingNodeTypes["WHEN_CLAUSE"] = "when-clause";
|
|
82
|
+
ChildBearingNodeTypes["UNARY_EXPRESSION"] = "unary-expression";
|
|
83
|
+
ChildBearingNodeTypes["BINARY_EXPRESSION"] = "binary-expression";
|
|
84
|
+
})(ChildBearingNodeTypes || (ChildBearingNodeTypes = {}));
|
|
85
|
+
// use object to ensure the list matches the types from the JS api
|
|
86
|
+
const castDataTypesDict = {
|
|
87
|
+
date: "DATE",
|
|
88
|
+
float: "FLOAT",
|
|
89
|
+
integer: "INTEGER",
|
|
90
|
+
real: "REAL",
|
|
91
|
+
smallint: "SMALLINT",
|
|
92
|
+
time: "TIME",
|
|
93
|
+
timestamp: "TIMESTAMP",
|
|
94
|
+
varchar: "VARCHAR",
|
|
95
|
+
};
|
|
96
|
+
// convert the object to a list of strings for easier use, but keep type information
|
|
97
|
+
Object.values(castDataTypesDict);
|
|
98
|
+
const sqlExprKeywords = [
|
|
99
|
+
"AND",
|
|
100
|
+
"AS",
|
|
101
|
+
"BETWEEN",
|
|
102
|
+
"BOTH",
|
|
103
|
+
"CASE",
|
|
104
|
+
"CAST",
|
|
105
|
+
"CURRENT_DATE",
|
|
106
|
+
"CURRENT_TIME",
|
|
107
|
+
"CURRENT_TIMESTAMP",
|
|
108
|
+
"DATE",
|
|
109
|
+
"DAY",
|
|
110
|
+
"ELSE",
|
|
111
|
+
"END",
|
|
112
|
+
"ESCAPE",
|
|
113
|
+
"FALSE",
|
|
114
|
+
"FLOAT",
|
|
115
|
+
"FOR",
|
|
116
|
+
"FROM",
|
|
117
|
+
"HOUR",
|
|
118
|
+
"IN",
|
|
119
|
+
"INTEGER",
|
|
120
|
+
"INTERVAL",
|
|
121
|
+
"IS",
|
|
122
|
+
"LEADING",
|
|
123
|
+
"LIKE",
|
|
124
|
+
"MINUTE",
|
|
125
|
+
"MONTH",
|
|
126
|
+
"NOT",
|
|
127
|
+
"NULL",
|
|
128
|
+
"OR",
|
|
129
|
+
"POSITION",
|
|
130
|
+
"REAL",
|
|
131
|
+
"SECOND",
|
|
132
|
+
"SMALLINT",
|
|
133
|
+
"SUBSTRING",
|
|
134
|
+
"THEN",
|
|
135
|
+
"TIME",
|
|
136
|
+
"TIMESTAMP",
|
|
137
|
+
"TIMEZONE_HOUR",
|
|
138
|
+
"TIMEZONE_MINUTE",
|
|
139
|
+
"TO",
|
|
140
|
+
"TRAILING",
|
|
141
|
+
"TRIM",
|
|
142
|
+
"TRUE",
|
|
143
|
+
"VARCHAR",
|
|
144
|
+
"WHEN",
|
|
145
|
+
"WITH",
|
|
146
|
+
"YEAR",
|
|
147
|
+
"ZONE",
|
|
148
|
+
];
|
|
149
|
+
const sqlExprOperators = [
|
|
150
|
+
// Logical
|
|
151
|
+
"AND",
|
|
152
|
+
"BETWEEN",
|
|
153
|
+
"IN",
|
|
154
|
+
"LIKE",
|
|
155
|
+
"NOT",
|
|
156
|
+
"OR",
|
|
157
|
+
// Predicates
|
|
158
|
+
"IS",
|
|
159
|
+
"NULL",
|
|
160
|
+
];
|
|
161
|
+
const sqlExprFunctions = [
|
|
162
|
+
// Conversion
|
|
163
|
+
"CAST",
|
|
164
|
+
// Datetime
|
|
165
|
+
"EXTRACT",
|
|
166
|
+
"CURRENT_DATE",
|
|
167
|
+
"CURRENT_TIME",
|
|
168
|
+
"CURRENT_TIMESTAMP",
|
|
169
|
+
// Mathematical
|
|
170
|
+
"ABS",
|
|
171
|
+
"ACOS",
|
|
172
|
+
"ASIN",
|
|
173
|
+
"ATAN",
|
|
174
|
+
"CEILING",
|
|
175
|
+
"COS",
|
|
176
|
+
"FLOOR",
|
|
177
|
+
"LOG",
|
|
178
|
+
"LOG10",
|
|
179
|
+
"POWER",
|
|
180
|
+
"ROUND",
|
|
181
|
+
"SIGN",
|
|
182
|
+
"SIN",
|
|
183
|
+
"TAN",
|
|
184
|
+
// String
|
|
185
|
+
"CHAR_LENGTH",
|
|
186
|
+
"COALESCE",
|
|
187
|
+
"CONCAT",
|
|
188
|
+
"LOWER",
|
|
189
|
+
"POSITION",
|
|
190
|
+
"TRIM",
|
|
191
|
+
"UPPER",
|
|
192
|
+
];
|
|
193
|
+
|
|
194
|
+
const sqlExprLanguageConfig = {
|
|
195
|
+
comments: {
|
|
196
|
+
lineComment: "--",
|
|
197
|
+
blockComment: ["/*", "*/"],
|
|
198
|
+
},
|
|
199
|
+
brackets: [
|
|
200
|
+
["{", "}"],
|
|
201
|
+
["[", "]"],
|
|
202
|
+
["(", ")"],
|
|
203
|
+
],
|
|
204
|
+
autoClosingPairs: [
|
|
205
|
+
{ open: "{", close: "}" },
|
|
206
|
+
{ open: "[", close: "]" },
|
|
207
|
+
{ open: "(", close: ")" },
|
|
208
|
+
{ open: '"', close: '"' },
|
|
209
|
+
{ open: "'", close: "'" },
|
|
210
|
+
],
|
|
211
|
+
surroundingPairs: [
|
|
212
|
+
{ open: "{", close: "}" },
|
|
213
|
+
{ open: "[", close: "]" },
|
|
214
|
+
{ open: "(", close: ")" },
|
|
215
|
+
{ open: '"', close: '"' },
|
|
216
|
+
{ open: "'", close: "'" },
|
|
217
|
+
],
|
|
218
|
+
};
|
|
219
|
+
// TODO: trim down
|
|
220
|
+
const sqlExprLanguageSyntax = {
|
|
221
|
+
defaultToken: "",
|
|
222
|
+
tokenPostfix: ".sql",
|
|
223
|
+
ignoreCase: true,
|
|
224
|
+
brackets: [
|
|
225
|
+
{ open: "[", close: "]", token: "delimiter.square" },
|
|
226
|
+
{ open: "(", close: ")", token: "delimiter.parenthesis" },
|
|
227
|
+
],
|
|
228
|
+
keywords: sqlExprKeywords,
|
|
229
|
+
operators: sqlExprOperators,
|
|
230
|
+
builtinFunctions: sqlExprFunctions,
|
|
231
|
+
builtinVariables: [],
|
|
232
|
+
tokenizer: {
|
|
233
|
+
root: [
|
|
234
|
+
{ include: "@comments" },
|
|
235
|
+
{ include: "@whitespace" },
|
|
236
|
+
{ include: "@numbers" },
|
|
237
|
+
{ include: "@strings" },
|
|
238
|
+
{ include: "@complexIdentifiers" },
|
|
239
|
+
{ include: "@scopes" },
|
|
240
|
+
[/[;,.]/, "delimiter"],
|
|
241
|
+
[/[()]/, "@brackets"],
|
|
242
|
+
[
|
|
243
|
+
/[\w@#$]+/,
|
|
244
|
+
{
|
|
245
|
+
cases: {
|
|
246
|
+
"@operators": "operator",
|
|
247
|
+
"@builtinVariables": "predefined",
|
|
248
|
+
"@builtinFunctions": "predefined",
|
|
249
|
+
"@keywords": "keyword",
|
|
250
|
+
"@default": "identifier",
|
|
251
|
+
},
|
|
252
|
+
},
|
|
253
|
+
],
|
|
254
|
+
[/[<>=!%&+\-*/|~^]/, "operator"],
|
|
255
|
+
],
|
|
256
|
+
whitespace: [[/\s+/, "white"]],
|
|
257
|
+
comments: [
|
|
258
|
+
[/--+.*/, "comment"],
|
|
259
|
+
[/\/\*/, { token: "comment.quote", next: "@comment" }],
|
|
260
|
+
],
|
|
261
|
+
comment: [
|
|
262
|
+
[/[^*/]+/, "comment"],
|
|
263
|
+
// Not supporting nested comments, as nested comments seem to not be standard?
|
|
264
|
+
// i.e. http://stackoverflow.com/questions/728172/are-there-multiline-comment-delimiters-in-sql-that-are-vendor-agnostic
|
|
265
|
+
// [/\/\*/, { token: 'comment.quote', next: '@push' }], // nested comment not allowed :-(
|
|
266
|
+
[/\*\//, { token: "comment.quote", next: "@pop" }],
|
|
267
|
+
[/./, "comment"],
|
|
268
|
+
],
|
|
269
|
+
numbers: [
|
|
270
|
+
[/0[xX][0-9a-fA-F]*/, "number"],
|
|
271
|
+
[/[$][+-]*\d*(\.\d*)?/, "number"],
|
|
272
|
+
[/((\d+(\.\d*)?)|(\.\d+))([eE][\-+]?\d+)?/, "number"],
|
|
273
|
+
],
|
|
274
|
+
strings: [
|
|
275
|
+
[/N'/, { token: "string", next: "@string" }],
|
|
276
|
+
[/'/, { token: "string", next: "@string" }],
|
|
277
|
+
],
|
|
278
|
+
string: [
|
|
279
|
+
[/[^']+/, "string"],
|
|
280
|
+
[/''/, "string"],
|
|
281
|
+
[/'/, { token: "string", next: "@pop" }],
|
|
282
|
+
],
|
|
283
|
+
complexIdentifiers: [[/"/, { token: "identifier.quote", next: "@quotedIdentifier" }]],
|
|
284
|
+
quotedIdentifier: [
|
|
285
|
+
[/[^"]+/, "identifier"],
|
|
286
|
+
[/""/, "identifier"],
|
|
287
|
+
[/"/, { token: "identifier.quote", next: "@pop" }],
|
|
288
|
+
],
|
|
289
|
+
scopes: [
|
|
290
|
+
[/(BEGIN|CASE)\b/i, { token: "keyword.block" }],
|
|
291
|
+
[/END\b/i, { token: "keyword.block" }],
|
|
292
|
+
[/WHEN\b/i, { token: "keyword.choice" }],
|
|
293
|
+
[/THEN\b/i, { token: "keyword.choice" }],
|
|
294
|
+
],
|
|
295
|
+
},
|
|
296
|
+
};
|
|
297
|
+
|
|
298
|
+
class SqlExprCompletionProvider {
|
|
299
|
+
constructor(_worker, _defaults) {
|
|
300
|
+
this._worker = _worker;
|
|
301
|
+
this._defaults = _defaults;
|
|
302
|
+
}
|
|
303
|
+
async provideCompletionItems(model, position) {
|
|
304
|
+
try {
|
|
305
|
+
const worker = await this._worker(model.uri);
|
|
306
|
+
const word = model.getWordUntilPosition(position);
|
|
307
|
+
const range = {
|
|
308
|
+
startLineNumber: position.lineNumber,
|
|
309
|
+
endLineNumber: position.lineNumber,
|
|
310
|
+
startColumn: word.startColumn,
|
|
311
|
+
endColumn: word.endColumn,
|
|
312
|
+
};
|
|
313
|
+
const apiContext = this._defaults.getApiContextForModel(model.uri);
|
|
314
|
+
return await worker.doComplete(model.uri.toString(), range, position, apiContext);
|
|
315
|
+
}
|
|
316
|
+
catch (err) {
|
|
317
|
+
console.error(err);
|
|
318
|
+
return { suggestions: [] };
|
|
319
|
+
}
|
|
320
|
+
}
|
|
321
|
+
}
|
|
322
|
+
// TODO: create DiagnosticsAdapter common class
|
|
323
|
+
class SqlExprDiagnosticsAdapter {
|
|
324
|
+
constructor(_languageId, _worker, { defaults, diagnosticService, }) {
|
|
325
|
+
this._languageId = _languageId;
|
|
326
|
+
this._worker = _worker;
|
|
327
|
+
this._disposables = [];
|
|
328
|
+
this._listener = new Map();
|
|
329
|
+
this._diagnosticsService = diagnosticService;
|
|
330
|
+
this._defaults = defaults;
|
|
331
|
+
const onModelAdd = (model) => {
|
|
332
|
+
const languageId = model.getLanguageId();
|
|
333
|
+
if (languageId !== this._languageId) {
|
|
334
|
+
return;
|
|
335
|
+
}
|
|
336
|
+
const debouncedValidate = languageDefaultsBase.debounce(() => {
|
|
337
|
+
this._doValidate(model, languageId).catch((err) => {
|
|
338
|
+
throw err;
|
|
339
|
+
});
|
|
340
|
+
});
|
|
341
|
+
this._listener.set(model.uri.toString(), model.onDidChangeContent(debouncedValidate));
|
|
342
|
+
this._doValidate(model, languageId).catch(console.error);
|
|
343
|
+
};
|
|
344
|
+
const onModelRemoved = (model) => {
|
|
345
|
+
const uri = model.uri.toString();
|
|
346
|
+
languageDefaultsBase.editor.setModelMarkers(model, this._languageId, []);
|
|
347
|
+
const listener = this._listener.get(uri);
|
|
348
|
+
if (listener) {
|
|
349
|
+
listener.dispose();
|
|
350
|
+
this._listener.delete(uri);
|
|
351
|
+
}
|
|
352
|
+
};
|
|
353
|
+
this._disposables.push(languageDefaultsBase.editor.onDidCreateModel(onModelAdd));
|
|
354
|
+
this._disposables.push(languageDefaultsBase.editor.onWillDisposeModel((model) => onModelRemoved(model)));
|
|
355
|
+
this._disposables.push(languageDefaultsBase.editor.onDidChangeModelLanguage((event) => {
|
|
356
|
+
onModelRemoved(event.model);
|
|
357
|
+
onModelAdd(event.model);
|
|
358
|
+
}));
|
|
359
|
+
this._disposables.push(defaults.onDidChange(() => {
|
|
360
|
+
languageDefaultsBase.editor.getModels().forEach((model) => {
|
|
361
|
+
if (model.getLanguageId() === this._languageId) {
|
|
362
|
+
onModelRemoved(model);
|
|
363
|
+
onModelAdd(model);
|
|
364
|
+
}
|
|
365
|
+
});
|
|
366
|
+
}));
|
|
367
|
+
this._disposables.push(defaults.onModelContextDidChange((key) => {
|
|
368
|
+
languageDefaultsBase.editor.getModels().forEach((model) => {
|
|
369
|
+
if (model.getLanguageId() === this._languageId && model.uri.toString() === key) {
|
|
370
|
+
this._doValidate(model, this._languageId).catch(console.error);
|
|
371
|
+
}
|
|
372
|
+
});
|
|
373
|
+
}));
|
|
374
|
+
this._disposables.push({
|
|
375
|
+
dispose: () => {
|
|
376
|
+
this._listener.forEach((value) => value.dispose());
|
|
377
|
+
this._listener.clear();
|
|
378
|
+
},
|
|
379
|
+
});
|
|
380
|
+
languageDefaultsBase.editor.getModels().forEach(onModelAdd);
|
|
381
|
+
}
|
|
382
|
+
async _doValidate(model, languageId) {
|
|
383
|
+
if (!model.isAttachedToEditor()) {
|
|
384
|
+
return;
|
|
385
|
+
}
|
|
386
|
+
try {
|
|
387
|
+
const workerProxy = await this._worker(model.uri);
|
|
388
|
+
const context = this._defaults.getApiContextForModel(model.uri);
|
|
389
|
+
const diagnostics = await workerProxy.doValidation(model.uri.toString(), context);
|
|
390
|
+
this._diagnosticsService.fireDiagnosticsChange(model.uri, diagnostics);
|
|
391
|
+
languageDefaultsBase.editor.setModelMarkers(model, languageId, diagnostics);
|
|
392
|
+
}
|
|
393
|
+
catch (err) {
|
|
394
|
+
console.error(err);
|
|
395
|
+
}
|
|
396
|
+
}
|
|
397
|
+
}
|
|
398
|
+
|
|
399
|
+
let sqlExprWorker;
|
|
400
|
+
/**
|
|
401
|
+
* Returns the sql-expression worker for the model uris.
|
|
402
|
+
* @param uris The model uris for which to get the worker.
|
|
403
|
+
* @returns The sql-expression worker.
|
|
404
|
+
*/
|
|
405
|
+
async function getSqlExprWorker(...uris) {
|
|
406
|
+
return await new Promise((resolve, reject) => {
|
|
407
|
+
if (!sqlExprWorker) {
|
|
408
|
+
reject(new Error("sql expression worker not registered!"));
|
|
409
|
+
return;
|
|
410
|
+
}
|
|
411
|
+
resolve(sqlExprWorker(...uris));
|
|
412
|
+
});
|
|
413
|
+
}
|
|
414
|
+
class SqlExprDiagnosticService {
|
|
415
|
+
constructor() {
|
|
416
|
+
this._onDiagnosticsChange = new languageDefaultsBase.Emitter();
|
|
417
|
+
}
|
|
418
|
+
/**
|
|
419
|
+
* An event to signal changes to the diagnostics.
|
|
420
|
+
* The event value is the uri string and the diagnostics.
|
|
421
|
+
*/
|
|
422
|
+
get onDiagnosticsChange() {
|
|
423
|
+
return this._onDiagnosticsChange.event;
|
|
424
|
+
}
|
|
425
|
+
/**
|
|
426
|
+
* Fires the diagnostics change event.
|
|
427
|
+
* @param uri The uri of the model for which the diagnostics changed.
|
|
428
|
+
* @param diagnostics The diagnostics for the model.
|
|
429
|
+
*/
|
|
430
|
+
fireDiagnosticsChange(uri, diagnostics) {
|
|
431
|
+
this._onDiagnosticsChange.fire({ uri, diagnostics });
|
|
432
|
+
}
|
|
433
|
+
}
|
|
434
|
+
const sqlExprDiagnosticService = new SqlExprDiagnosticService();
|
|
435
|
+
/**
|
|
436
|
+
*
|
|
437
|
+
* @returns The Sql Expression Diagnostic Service.
|
|
438
|
+
*/
|
|
439
|
+
function getSqlExprDiagnosticService() {
|
|
440
|
+
return sqlExprDiagnosticService;
|
|
441
|
+
}
|
|
442
|
+
function setupMode(defaults) {
|
|
443
|
+
const client = new SqlExprWorkerManager(defaults);
|
|
444
|
+
const workerAccessor = async (...uris) => await client.getLanguageServiceWorker(...uris);
|
|
445
|
+
sqlExprWorker = workerAccessor;
|
|
446
|
+
// Use the sql-expression Monarch Json to define the highlighting
|
|
447
|
+
languageDefaultsBase.languages.setMonarchTokensProvider(sqlExprDefaults.sqlExprDefaults.languageId, sqlExprLanguageSyntax);
|
|
448
|
+
languageDefaultsBase.languages.setLanguageConfiguration(sqlExprDefaults.sqlExprDefaults.languageId, sqlExprLanguageConfig);
|
|
449
|
+
const completionProvider = new SqlExprCompletionProvider(workerAccessor, sqlExprDefaults.sqlExprDefaults);
|
|
450
|
+
languageDefaultsBase.languages.registerCompletionItemProvider(sqlExprDefaults.sqlExprDefaults.languageId, completionProvider);
|
|
451
|
+
// Creates and registers a Completion Adapter
|
|
452
|
+
// Registers a completion item provider for our custom language
|
|
453
|
+
// TODO: Creates and registers a Formatter
|
|
454
|
+
// languages.registerDocumentFormattingEditProvider(
|
|
455
|
+
// SqlExprDefaults.languageId,
|
|
456
|
+
// new FormattingProvider(workerAccessor, SqlExprDefaults),
|
|
457
|
+
// );
|
|
458
|
+
// eslint-disable-next-line no-new
|
|
459
|
+
new SqlExprDiagnosticsAdapter(defaults.languageId, workerAccessor, {
|
|
460
|
+
defaults,
|
|
461
|
+
diagnosticService: sqlExprDiagnosticService,
|
|
462
|
+
});
|
|
463
|
+
}
|
|
464
|
+
|
|
465
|
+
exports.getSqlExprDiagnosticService = getSqlExprDiagnosticService;
|
|
466
|
+
exports.getSqlExprWorker = getSqlExprWorker;
|
|
467
|
+
exports.setupMode = setupMode;
|
|
@@ -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
6
|
'use strict';
|
|
7
7
|
|
|
8
|
-
const languageDefaultsBase = require('./language-defaults-base-
|
|
8
|
+
const languageDefaultsBase = require('./language-defaults-base-a5648a80.js');
|
|
9
9
|
|
|
10
10
|
/*!-----------------------------------------------------------------------------
|
|
11
11
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
@@ -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
6
|
'use strict';
|
|
7
7
|
|
|
8
|
-
const languageDefaultsBase = require('./language-defaults-base-
|
|
8
|
+
const languageDefaultsBase = require('./language-defaults-base-a5648a80.js');
|
|
9
9
|
|
|
10
10
|
/*!-----------------------------------------------------------------------------
|
|
11
11
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
@@ -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
|
import { Uri } from 'monaco-editor';
|
|
7
7
|
import { f as fieldsToProfileValues, i as isPredefinedProfile, a as isFeatureSetCollectionDefinition, b as isFeatureSetDefinition, c as isFeatureDefinition, L as LanguageDefaultsBase, E as EditorProfile } from './language-defaults-base.js';
|