@arcgis/coding-components 4.31.0-next.5 → 4.31.0-next.51

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.
Files changed (203) hide show
  1. package/README.md +22 -3
  2. package/dist/arcgis-coding-components/arcgis-coding-components.esm.js +2 -2
  3. package/dist/arcgis-coding-components/assets/arcade-language/t9n/profile.t9n.ar.json +1 -1
  4. package/dist/arcgis-coding-components/assets/arcade-language/t9n/profile.t9n.bg.json +1 -1
  5. package/dist/arcgis-coding-components/assets/arcade-language/t9n/profile.t9n.bs.json +1 -1
  6. package/dist/arcgis-coding-components/assets/arcade-language/t9n/profile.t9n.ca.json +6 -6
  7. package/dist/arcgis-coding-components/assets/arcade-language/t9n/profile.t9n.cs.json +1 -1
  8. package/dist/arcgis-coding-components/assets/arcade-language/t9n/profile.t9n.da.json +1 -1
  9. package/dist/arcgis-coding-components/assets/arcade-language/t9n/profile.t9n.de.json +1 -1
  10. package/dist/arcgis-coding-components/assets/arcade-language/t9n/profile.t9n.el.json +1 -1
  11. package/dist/arcgis-coding-components/assets/arcade-language/t9n/profile.t9n.es.json +1 -1
  12. package/dist/arcgis-coding-components/assets/arcade-language/t9n/profile.t9n.et.json +1 -1
  13. package/dist/arcgis-coding-components/assets/arcade-language/t9n/profile.t9n.fi.json +1 -1
  14. package/dist/arcgis-coding-components/assets/arcade-language/t9n/profile.t9n.fr.json +1 -1
  15. package/dist/arcgis-coding-components/assets/arcade-language/t9n/profile.t9n.he.json +1 -1
  16. package/dist/arcgis-coding-components/assets/arcade-language/t9n/profile.t9n.hr.json +1 -1
  17. package/dist/arcgis-coding-components/assets/arcade-language/t9n/profile.t9n.id.json +1 -1
  18. package/dist/arcgis-coding-components/assets/arcade-language/t9n/profile.t9n.it.json +1 -1
  19. package/dist/arcgis-coding-components/assets/arcade-language/t9n/profile.t9n.ko.json +1 -1
  20. package/dist/arcgis-coding-components/assets/arcade-language/t9n/profile.t9n.nb.json +1 -1
  21. package/dist/arcgis-coding-components/assets/arcade-language/t9n/profile.t9n.nl.json +1 -1
  22. package/dist/arcgis-coding-components/assets/arcade-language/t9n/profile.t9n.pl.json +1 -1
  23. package/dist/arcgis-coding-components/assets/arcade-language/t9n/profile.t9n.pt-BR.json +1 -1
  24. package/dist/arcgis-coding-components/assets/arcade-language/t9n/profile.t9n.pt-PT.json +1 -1
  25. package/dist/arcgis-coding-components/assets/arcade-language/t9n/profile.t9n.ru.json +1 -1
  26. package/dist/arcgis-coding-components/assets/arcade-language/t9n/profile.t9n.sk.json +1 -1
  27. package/dist/arcgis-coding-components/assets/arcade-language/t9n/profile.t9n.sl.json +1 -1
  28. package/dist/arcgis-coding-components/assets/arcade-language/t9n/profile.t9n.sr.json +1 -1
  29. package/dist/arcgis-coding-components/assets/arcade-language/t9n/profile.t9n.sv.json +1 -1
  30. package/dist/arcgis-coding-components/assets/arcade-language/t9n/profile.t9n.th.json +1 -1
  31. package/dist/arcgis-coding-components/assets/arcade-language/t9n/profile.t9n.tr.json +1 -1
  32. package/dist/arcgis-coding-components/assets/arcade-language/t9n/profile.t9n.uk.json +5 -5
  33. package/dist/arcgis-coding-components/assets/arcade-language/t9n/profile.t9n.vi.json +1 -1
  34. package/dist/arcgis-coding-components/assets/arcade-language/t9n/profile.t9n.zh-CN.json +1 -1
  35. package/dist/arcgis-coding-components/assets/arcade-language/t9n/profile.t9n.zh-HK.json +1 -1
  36. package/dist/arcgis-coding-components/assets/arcade-language/t9n/profile.t9n.zh-TW.json +1 -1
  37. package/dist/arcgis-coding-components/assets/arcade-results/t9n/arcade-results.t9n.ca.json +2 -2
  38. package/dist/arcgis-coding-components/assets/arcade-results/t9n/arcade-results.t9n.de.json +1 -1
  39. package/dist/arcgis-coding-components/assets/arcade-results/t9n/arcade-results.t9n.he.json +1 -1
  40. package/dist/arcgis-coding-components/assets/arcade-variables/t9n/arcade-variables.t9n.ca.json +1 -1
  41. package/dist/arcgis-coding-components/assets/arcade-variables/t9n/arcade-variables.t9n.it.json +1 -1
  42. package/dist/arcgis-coding-components/assets/code-editor/sql-expr.worker.js +460 -7
  43. package/dist/arcgis-coding-components/assets/language-api-panel/t9n/language-api-panel.t9n.ca.json +1 -1
  44. package/dist/arcgis-coding-components/assets/sql-expression-editor/api/sql-expression-api.t9n.en.json +30 -30
  45. package/dist/arcgis-coding-components/index.esm.js +2 -2
  46. package/dist/arcgis-coding-components/{p-ae6af9eb.js → p-01da9b87.js} +2 -2
  47. package/dist/arcgis-coding-components/p-0e466656.js +6 -0
  48. package/dist/arcgis-coding-components/{p-3d5b8c4b.js → p-1e2c061f.js} +12 -12
  49. package/dist/arcgis-coding-components/{p-2c85c4b2.js → p-1f4dd8ea.js} +2 -2
  50. package/dist/arcgis-coding-components/{p-2d32fb1b.js → p-2d187b80.js} +3 -3
  51. package/dist/arcgis-coding-components/p-38b10ccb.js +6 -0
  52. package/dist/arcgis-coding-components/p-3e54590d.entry.js +6 -0
  53. package/dist/arcgis-coding-components/{p-e31be2c5.js → p-65b4b095.js} +1 -1
  54. package/dist/arcgis-coding-components/{p-c41f6d7c.js → p-6787dd4c.js} +3 -3
  55. package/dist/arcgis-coding-components/{p-7f776266.js → p-833ae4ee.js} +2 -2
  56. package/dist/arcgis-coding-components/p-8b045366.js +6 -0
  57. package/dist/arcgis-coding-components/{p-7bd74de6.entry.js → p-9218ae01.entry.js} +2 -2
  58. package/dist/arcgis-coding-components/{p-de85c014.js → p-96bba7f5.js} +1 -1
  59. package/dist/arcgis-coding-components/p-cccd46d5.js +7 -0
  60. package/dist/arcgis-coding-components/p-d2287ce9.js +6 -0
  61. package/dist/arcgis-coding-components/{p-28d34a6e.entry.js → p-d3f04192.entry.js} +2 -2
  62. package/dist/arcgis-coding-components/{p-60739af5.js → p-d67469e8.js} +2 -2
  63. package/dist/arcgis-coding-components/{p-aa9d06e6.js → p-e16c05ff.js} +3 -3
  64. package/dist/cjs/{app-globals-886c7ef0.js → app-globals-b5d3bda0.js} +1 -1
  65. package/dist/cjs/arcade-defaults-a59b98c8.js +350 -0
  66. package/dist/cjs/{arcade-mode-2175ca7d.js → arcade-mode-bbcc64c9.js} +4 -4
  67. package/dist/cjs/arcgis-arcade-editor_6.cjs.entry.js +60 -27
  68. package/dist/cjs/arcgis-coding-components.cjs.js +5 -5
  69. package/dist/cjs/arcgis-sql-expression-editor.cjs.entry.js +4 -4
  70. package/dist/cjs/arcgis-sql-expression-fields.cjs.entry.js +4 -4
  71. package/dist/cjs/{css-b5a232da.js → css-50ab4ba4.js} +1 -1
  72. package/dist/cjs/{cssMode-f67c30d4.js → cssMode-cde87050.js} +2 -3
  73. package/dist/cjs/{html-d57fda6b.js → html-88890272.js} +2 -3
  74. package/dist/cjs/{htmlMode-c1513225.js → htmlMode-61827280.js} +2 -3
  75. package/dist/cjs/{index-6563aa26.js → index-1662a35f.js} +43 -15
  76. package/dist/cjs/index.cjs.js +4 -4
  77. package/dist/cjs/{javascript-d7362563.js → javascript-2c62b4fe.js} +3 -4
  78. package/dist/cjs/{jsonMode-1ea2f163.js → jsonMode-46c758c3.js} +2 -3
  79. package/dist/cjs/{language-defaults-base-66e1921b.js → language-defaults-base-1351cde9.js} +822 -1062
  80. package/dist/cjs/loader.cjs.js +4 -4
  81. package/dist/cjs/{sql-expr-defaults-e30d7627.js → sql-expr-defaults-c1878109.js} +119 -95
  82. package/dist/cjs/sql-expr-mode-4e83413c.js +467 -0
  83. package/dist/cjs/{tsMode-9db1a5aa.js → tsMode-187fbff9.js} +2 -3
  84. package/dist/cjs/{typescript-f6d1b2b4.js → typescript-ed13744f.js} +2 -3
  85. package/dist/components/arcade-defaults.js +239 -4
  86. package/dist/components/arcade-mode.js +3 -2
  87. package/dist/components/arcade-results.js +3 -3
  88. package/dist/components/arcade-suggestions.js +2 -2
  89. package/dist/components/arcade-variables.js +2 -2
  90. package/dist/components/arcgis-arcade-editor.js +7 -6
  91. package/dist/components/arcgis-arcade-results.js +1 -1
  92. package/dist/components/arcgis-arcade-suggestions.js +1 -1
  93. package/dist/components/arcgis-arcade-variables.js +1 -1
  94. package/dist/components/arcgis-assets.d.ts +26 -26
  95. package/dist/components/arcgis-assets.js +2 -2
  96. package/dist/components/arcgis-code-editor.js +1 -1
  97. package/dist/components/arcgis-language-api-panel.js +1 -1
  98. package/dist/components/arcgis-sql-expression-editor.js +2 -2
  99. package/dist/components/arcgis-sql-expression-fields.js +1 -1
  100. package/dist/components/{chunk-6TARY3NN.js → chunk-BMBYH3VH.js} +42 -74
  101. package/dist/components/code-editor.js +16 -23
  102. package/dist/components/fields.js +4 -4
  103. package/dist/components/index.js +1 -1
  104. package/dist/components/index2.js +4 -4
  105. package/dist/components/language-api-panel.js +2 -2
  106. package/dist/components/language-defaults-base.js +81 -323
  107. package/dist/components/markdown.js +1 -1
  108. package/dist/components/sql-expr-defaults.js +77 -24
  109. package/dist/components/sql-expr-mode.js +282 -24951
  110. package/dist/components/sql-expression-fields.js +2 -2
  111. package/dist/components/useT9n.js +41 -2
  112. package/dist/components/utilities.js +1 -1
  113. package/dist/esm/{app-globals-4531df03.js → app-globals-f291bf24.js} +1 -1
  114. package/dist/esm/arcade-defaults-5377abc7.js +345 -0
  115. package/dist/esm/{arcade-mode-121c8f8b.js → arcade-mode-b416088e.js} +4 -4
  116. package/dist/esm/arcgis-arcade-editor_6.entry.js +60 -27
  117. package/dist/esm/arcgis-coding-components.js +6 -6
  118. package/dist/esm/arcgis-sql-expression-editor.entry.js +4 -4
  119. package/dist/esm/arcgis-sql-expression-fields.entry.js +4 -4
  120. package/dist/esm/{css-f03ce15d.js → css-7dfaa788.js} +1 -1
  121. package/dist/esm/{cssMode-9350af4a.js → cssMode-d241d003.js} +2 -3
  122. package/dist/esm/{html-8a5ee186.js → html-7ffb87f8.js} +2 -3
  123. package/dist/esm/{htmlMode-dbcde814.js → htmlMode-ffeaf752.js} +2 -3
  124. package/dist/esm/{index-71c8a762.js → index-2b9dd0f5.js} +43 -15
  125. package/dist/esm/index.js +4 -4
  126. package/dist/esm/{javascript-b11dc132.js → javascript-347f3916.js} +3 -4
  127. package/dist/esm/{jsonMode-7afef1a4.js → jsonMode-25ecfd73.js} +2 -3
  128. package/dist/esm/{language-defaults-base-47e8d77c.js → language-defaults-base-4fef2327.js} +819 -1062
  129. package/dist/esm/loader.js +5 -5
  130. package/dist/esm/{sql-expr-defaults-fa9b2d75.js → sql-expr-defaults-e9b958fc.js} +116 -95
  131. package/dist/esm/sql-expr-mode-a8f41e49.js +463 -0
  132. package/dist/esm/{tsMode-76190ec2.js → tsMode-05c939be.js} +2 -3
  133. package/dist/esm/{typescript-346e9d47.js → typescript-dfb2a986.js} +2 -3
  134. package/dist/loader/cdn.js +2 -3
  135. package/dist/loader/index.cjs.js +2 -3
  136. package/dist/loader/index.es2017.js +2 -3
  137. package/dist/loader/index.js +2 -3
  138. package/dist/types/components/arcade-editor/arcade-editor.d.ts +13 -3
  139. package/dist/types/components/arcade-results/arcade-results.d.ts +1 -1
  140. package/dist/types/components/arcade-suggestions/arcade-suggestions.d.ts +1 -1
  141. package/dist/types/components/arcade-variables/arcade-variables.d.ts +1 -1
  142. package/dist/types/components/code-editor/code-editor.d.ts +14 -4
  143. package/dist/types/components/language-api-panel/language-api-panel.d.ts +1 -1
  144. package/dist/types/components.d.ts +13 -13
  145. package/dist/types/data/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 +8 -1
  146. package/dist/types/data/actions-runner-1/_work/arcgis-web-components/arcgis-web-components/packages/coding-packages/coding-components/.stencil/stories/internal/arcade-editor/editorContext.d.ts +5 -1
  147. package/dist/types/stencil-public-runtime.d.ts +3 -8
  148. package/dist/types/utils/arcade-monaco/arcade-defaults.d.ts +1 -0
  149. package/dist/types/utils/arcade-monaco/arcade-language-features.d.ts +1 -0
  150. package/dist/types/utils/arcade-monaco/arcade-profile-strategy.d.ts +9 -0
  151. package/dist/types/utils/fields.d.ts +2 -2
  152. package/dist/types/utils/profile/editor-profile.d.ts +7 -6
  153. package/dist/types/utils/profile/types.d.ts +53 -65
  154. package/dist/types/utils/profile/utils.d.ts +9 -8
  155. package/dist/types/utils/sql-expr-monaco/sql-expr-completion.d.ts +56 -5
  156. package/dist/types/utils/sql-expr-monaco/sql-expr-constants.d.ts +61 -0
  157. package/dist/types/utils/sql-expr-monaco/sql-expr-contribution.d.ts +1 -11
  158. package/dist/types/utils/sql-expr-monaco/sql-expr-defaults.d.ts +0 -1
  159. package/dist/types/utils/sql-expr-monaco/sql-expr-language-features.d.ts +18 -534
  160. package/dist/types/utils/sql-expr-monaco/sql-expr-mode.d.ts +34 -1
  161. package/dist/types/utils/sql-expr-monaco/sql-expr-parser-utils.d.ts +30 -0
  162. package/dist/types/utils/sql-expr-monaco/sql-expr-service-accessors.d.ts +19 -0
  163. package/dist/types/utils/sql-expr-monaco/sql-expr-validation-diagnostic-adapter.d.ts +0 -7
  164. package/dist/types/utils/sql-expr-monaco/sql-expr-validation-utils.d.ts +73 -77
  165. package/dist/types/utils/sql-expr-monaco/sql-expr-validation.d.ts +5 -6
  166. package/dist/types/utils/sql-expr-monaco/sql-expr-worker-manager.d.ts +2 -0
  167. package/dist/types/utils/sql-expr-monaco/sql-expr.worker.d.ts +11 -8
  168. package/dist/types/utils/sql-expr-monaco/sql-expression-profile-strategy.d.ts +13 -0
  169. package/dist/types/utils/sql-expr-monaco/types.d.ts +30 -28
  170. package/package.json +19 -19
  171. package/dist/arcgis-coding-components/p-43da2244.js +0 -6
  172. package/dist/arcgis-coding-components/p-5b62a1ac.entry.js +0 -6
  173. package/dist/arcgis-coding-components/p-65bb8c77.js +0 -6
  174. package/dist/arcgis-coding-components/p-88b5d206.js +0 -6
  175. package/dist/arcgis-coding-components/p-cbf4fec2.js +0 -6
  176. package/dist/arcgis-coding-components/p-e89166f0.js +0 -7
  177. package/dist/cjs/arcade-defaults-56b6742a.js +0 -116
  178. package/dist/cjs/sql-expr-mode-74c5c2c2.js +0 -25135
  179. package/dist/esm/arcade-defaults-d85fe608.js +0 -111
  180. package/dist/esm/polyfills/core-js.js +0 -11
  181. package/dist/esm/polyfills/dom.js +0 -79
  182. package/dist/esm/polyfills/es5-html-element.js +0 -1
  183. package/dist/esm/polyfills/index.js +0 -34
  184. package/dist/esm/polyfills/system.js +0 -6
  185. package/dist/esm/sql-expr-mode-931857be.js +0 -25132
  186. package/dist/types/utils/profile/predefined-profile.d.ts +0 -4
  187. package/dist/types/utils/sql-expr-monaco/DependentFiles/DateOnly.d.ts +0 -41
  188. package/dist/types/utils/sql-expr-monaco/DependentFiles/SqlInterval.d.ts +0 -16
  189. package/dist/types/utils/sql-expr-monaco/DependentFiles/SqlTimestampOffset.d.ts +0 -26
  190. package/dist/types/utils/sql-expr-monaco/DependentFiles/TimeOnly.d.ts +0 -37
  191. package/dist/types/utils/sql-expr-monaco/DependentFiles/UnknownTimeZone.d.ts +0 -11
  192. package/dist/types/utils/sql-expr-monaco/DependentFiles/WhereGrammar.d.ts +0 -122
  193. package/dist/types/utils/sql-expr-monaco/DependentFiles/sqlCompareUtils.d.ts +0 -5
  194. package/dist/types/utils/sql-expr-monaco/DependentFiles/sqlDateParsingUtils.d.ts +0 -18
  195. package/dist/types/utils/sql-expr-monaco/DependentFiles/sqlUtils.d.ts +0 -6
  196. package/dist/types/utils/sql-expr-monaco/DependentFiles/standardizedFunctions.d.ts +0 -156
  197. package/dist/types/utils/sql-expr-monaco/DependentFiles/support.d.ts +0 -150
  198. package/dist/types/utils/sql-expr-monaco/PeggyGrammar/sql92grammar.d.ts +0 -1397
  199. package/dist/types/utils/sql-expr-monaco/libraries/date/properties/index.d.ts +0 -59
  200. package/dist/types/utils/sql-expr-monaco/libraries/numeric/properties/index.d.ts +0 -295
  201. package/dist/types/utils/sql-expr-monaco/libraries/string/properties/index.d.ts +0 -135
  202. package/dist/types/utils/sql-expr-monaco/sql-expr-validation-adapter.d.ts +0 -3
  203. package/dist/types/utils/sql-expr-profile/predefined-profile.d.ts +0 -2
@@ -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.5
4
+ * v4.31.0-next.51
5
5
  */
6
6
  'use strict';
7
7
 
@@ -0,0 +1,350 @@
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.51
5
+ */
6
+ 'use strict';
7
+
8
+ const languageDefaultsBase = require('./language-defaults-base-1351cde9.js');
9
+ const index = require('./index-1662a35f.js');
10
+
11
+ /**
12
+ * Returns the arcade diagnostic service.
13
+ * Example:
14
+ * ```ts
15
+ * const diagnosticService = await getArcadeDiagnosticService();
16
+ * diagnosticService.onDidChangeDiagnostics(({uri, diaganostics }) => {
17
+ * // Filter the diagnostics for the uri of interest
18
+ * // Do something with the diagnostics
19
+ * });
20
+ * ```
21
+ */
22
+ async function getArcadeDiagnosticService() {
23
+ const mode = await getMode();
24
+ return mode.getArcadeDiagnosticService();
25
+ }
26
+ /**
27
+ * Returns the arcade worker for the model.
28
+ * Example:
29
+ * ```ts
30
+ * const arcadeWorker = await getArcadeWorker(model.uri);
31
+ * ```
32
+ * @returns arcade worker
33
+ */
34
+ async function getArcadeWorker(uri) {
35
+ const mode = await getMode();
36
+ return await mode.getArcadeWorker(uri);
37
+ }
38
+ /**
39
+ * Request the arcade mode
40
+ * @returns arcade mode module
41
+ */
42
+ async function getMode() {
43
+ return await Promise.resolve().then(function () { return require('./arcade-mode-bbcc64c9.js'); });
44
+ }
45
+
46
+ // #region convert editor profile to apiProfile
47
+ /**
48
+ * Converts an editor profile to an api profile.
49
+ * The api profile is an optimized version of the editor profile designed for minimal data transfer between the main thread and the worker.
50
+ */
51
+ async function arcadeEditorToApiProfile(editorProfile) {
52
+ const { apiVersion, bundles, hiddenApiItems } = editorProfile.toEditorProfileDefinition();
53
+ const variables = await variablesToLSVariable(editorProfile.dictionaryVariables);
54
+ return { apiVersion, bundles, variables, hiddenApiItems: hiddenApiItems?.map((s) => s.toLowerCase()) };
55
+ }
56
+ async function variablesToLSVariable(editorVariables, kind = languageDefaultsBase.main.exports.CompletionItemKind.Variable) {
57
+ return await Promise.all(editorVariables.map(async (editorVariable) => {
58
+ switch (editorVariable.type) {
59
+ case "dictionary":
60
+ return await dictionaryToLSDictionary(editorVariable, kind);
61
+ case "feature":
62
+ return await featureToLSFeature(editorVariable, kind);
63
+ default:
64
+ return variableToLSVariable(editorVariable, kind);
65
+ }
66
+ }));
67
+ }
68
+ function variableToLSVariable(editorVariable, kind) {
69
+ const { name, type } = editorVariable;
70
+ const description = editorVariable.getDescription();
71
+ return {
72
+ name,
73
+ description,
74
+ type,
75
+ completion: {
76
+ label: name,
77
+ detail: name,
78
+ insertText: name,
79
+ insertTextMode: languageDefaultsBase.main.exports.InsertTextMode.asIs,
80
+ insertTextFormat: languageDefaultsBase.main.exports.InsertTextFormat.PlainText,
81
+ kind,
82
+ documentation: { kind: "markdown", value: description },
83
+ },
84
+ };
85
+ }
86
+ async function featureToLSFeature(editorFeature, kind) {
87
+ // Get the source for the definition
88
+ const source = await editorFeature.loadSource();
89
+ const { name } = editorFeature;
90
+ const description = editorFeature.getDescription();
91
+ const resultCompletion = {
92
+ label: name,
93
+ detail: name,
94
+ insertText: name,
95
+ insertTextMode: languageDefaultsBase.main.exports.InsertTextMode.asIs,
96
+ insertTextFormat: languageDefaultsBase.main.exports.InsertTextFormat.PlainText,
97
+ kind,
98
+ };
99
+ const result = {
100
+ name,
101
+ description,
102
+ type: "dictionary",
103
+ properties: [],
104
+ completion: resultCompletion,
105
+ };
106
+ // No source definition, then it will be a feature without any known fields
107
+ if (!source) {
108
+ return result;
109
+ }
110
+ // Create properties for the fields and the aliases
111
+ // Also improve the feature completion documentation
112
+ const [properties, featureCompletionDescription] = languageDefaultsBase.fieldsToProfileValues(source.fields, description, true);
113
+ result.properties = properties;
114
+ resultCompletion.documentation = { kind: "markdown", value: featureCompletionDescription };
115
+ return result;
116
+ }
117
+ async function dictionaryToLSDictionary(editorDictionary, kind) {
118
+ const { name, dictionaryVariables: variables } = editorDictionary;
119
+ const description = editorDictionary.getDescription();
120
+ const completionDescription = variables.reduce((previous, p) => {
121
+ if (previous !== "") {
122
+ previous += " \n \n";
123
+ }
124
+ previous += `**${p.name}** \n${p.type}`;
125
+ const description = p.getDescription();
126
+ if (description) {
127
+ previous += ` \n${description}`;
128
+ }
129
+ return previous;
130
+ }, description);
131
+ return {
132
+ name,
133
+ description,
134
+ type: "dictionary",
135
+ properties: await variablesToLSVariable(variables, languageDefaultsBase.main.exports.CompletionItemKind.Field),
136
+ completion: {
137
+ label: name,
138
+ detail: name,
139
+ insertText: name,
140
+ insertTextMode: languageDefaultsBase.main.exports.InsertTextMode.asIs,
141
+ insertTextFormat: languageDefaultsBase.main.exports.InsertTextFormat.PlainText,
142
+ kind,
143
+ documentation: { kind: "markdown", value: completionDescription },
144
+ },
145
+ };
146
+ }
147
+ // #endregion
148
+ // #region predefined profile to editor profile definition
149
+ /**
150
+ * Get a PredefinedProfile for a locale. If not already loaded then fetch it.
151
+ * If the locale doesn't exist or the locale profile file doesn't exist then returns
152
+ * the english version of the profile.
153
+ */
154
+ async function getSdkPredefinedProfiles(locale = "en") {
155
+ const profiles = sdkPredefinedProfilesMap.get(locale);
156
+ if (profiles) {
157
+ return profiles;
158
+ }
159
+ if (!languageDefaultsBase.supportedLocales.has(locale)) {
160
+ return await getSdkPredefinedProfiles("en");
161
+ }
162
+ try {
163
+ const response = await fetch(index.getAssetPath(`./assets/arcade-language/profiles/arcade-profiles.t9n.${locale}.json`));
164
+ if (response.ok) {
165
+ return cacheSdkPredefinedProfiles(locale, (await response.json()));
166
+ }
167
+ if (locale === "en") {
168
+ return null;
169
+ }
170
+ return await getSdkPredefinedProfiles("en");
171
+ }
172
+ catch {
173
+ return null;
174
+ }
175
+ }
176
+ const sdkPredefinedProfilesMap = new Map();
177
+ /**
178
+ * Convert a stored profile into a PredefinedProfile and add it to the in-memory
179
+ * Map of profiles per locale.
180
+ */
181
+ function cacheSdkPredefinedProfiles(locale, profiles) {
182
+ const map = new Map();
183
+ profiles.forEach((profile) => {
184
+ map.set(profile.id, profile);
185
+ });
186
+ sdkPredefinedProfilesMap.set(locale, map);
187
+ return map;
188
+ }
189
+ async function getSdkPredefinedProfile(id, locale = "en") {
190
+ const profiles = await getSdkPredefinedProfiles(locale);
191
+ return profiles?.get(id) ?? null;
192
+ }
193
+ function isExtendedPredefinedProfileDefinition(item) {
194
+ return !!item && typeof item === "object" && "additionalVariables" in item && Array.isArray(item.additionalVariables);
195
+ }
196
+ function convertApiVariables(variables) {
197
+ return variables?.map(convertApiVariable);
198
+ }
199
+ function convertApiVariable(variable) {
200
+ switch (variable.type) {
201
+ case "dictionary":
202
+ return {
203
+ ...variable,
204
+ type: variable.type,
205
+ properties: convertApiVariables(variable.properties),
206
+ };
207
+ case "array": {
208
+ return {
209
+ ...variable,
210
+ type: variable.type,
211
+ elementType: { type: "number", name: "number" },
212
+ };
213
+ }
214
+ default:
215
+ return { ...variable, type: variable.type };
216
+ }
217
+ }
218
+ async function convertToEditorProfileDefinition(predefinedProfile, locale = "en") {
219
+ if (!languageDefaultsBase.isPredefinedProfile(predefinedProfile)) {
220
+ return undefined;
221
+ }
222
+ const sdkPredefinedProfile = await getSdkPredefinedProfile(predefinedProfile.id, locale);
223
+ if (!sdkPredefinedProfile) {
224
+ return undefined;
225
+ }
226
+ const editorProfile = {
227
+ bundles: [...sdkPredefinedProfile.bundles],
228
+ variables: [],
229
+ hiddenApiItems: predefinedProfile.hiddenApiItems?.map((s) => s.toLowerCase()),
230
+ };
231
+ // Merge the SDK variables' definitions/properties with the predefined profile definitions.
232
+ sdkPredefinedProfile.variables.forEach((predefinedVariable) => {
233
+ // Don't include disabled variables
234
+ if (predefinedProfile.disabledVariables?.includes(predefinedVariable.name)) {
235
+ return;
236
+ }
237
+ // Try to get a definition from the predefined profile, for the variable that needs one.
238
+ const definition = predefinedProfile.definitions[predefinedVariable.name];
239
+ // Note: Something is weird with TS. The sdkVariables are being casted to the wrong type
240
+ // despite the type checking from the switch statement.
241
+ switch (predefinedVariable.type) {
242
+ case "dictionary": {
243
+ // For dictionary, we support properties overrride
244
+ return editorProfile.variables.push(convertApiVariable({
245
+ ...predefinedVariable,
246
+ type: predefinedVariable.type,
247
+ properties: Array.isArray(definition) ? [...definition] : predefinedVariable.properties,
248
+ }));
249
+ }
250
+ case "feature":
251
+ // If the definition is not valid, then we don't include it.
252
+ if (!languageDefaultsBase.isFeatureDefinition(definition)) {
253
+ return;
254
+ }
255
+ return editorProfile.variables.push({ ...predefinedVariable, type: predefinedVariable.type, definition });
256
+ case "featureSet":
257
+ // If the definition is not valid, then we don't include it.
258
+ if (!languageDefaultsBase.isFeatureSetDefinition(definition)) {
259
+ return;
260
+ }
261
+ return editorProfile.variables.push({ ...predefinedVariable, type: predefinedVariable.type, definition });
262
+ case "featureSetCollection":
263
+ // If the definition is not valid, then we don't include it.
264
+ if (!languageDefaultsBase.isFeatureSetCollectionDefinition(definition)) {
265
+ return;
266
+ }
267
+ return editorProfile.variables.push({ ...predefinedVariable, type: predefinedVariable.type, definition });
268
+ default:
269
+ return editorProfile.variables.push(convertApiVariable(predefinedVariable));
270
+ }
271
+ });
272
+ if (isExtendedPredefinedProfileDefinition(predefinedProfile)) {
273
+ editorProfile.variables.push(...(predefinedProfile.additionalVariables ?? []));
274
+ }
275
+ return editorProfile;
276
+ }
277
+ // #endregion
278
+
279
+ const arcadeLanguageId = "arcade";
280
+ class ArcadeLanguageServiceDefaults extends languageDefaultsBase.LanguageDefaultsBase {
281
+ constructor() {
282
+ super(...arguments);
283
+ this._languageId = arcadeLanguageId;
284
+ this._languageOptions = {};
285
+ }
286
+ /**
287
+ * Create an EditorProfile for the given model id using the given definition and locale.
288
+ * The EditorProfile is used by the the Arcade Language service as well by the cosing components.
289
+ * The definition can be a pre-defined profile or an editor profile definition.
290
+ * If the locale is not provided then the 'en' locale is used.
291
+ * @param modelId The model id for which to create the context.
292
+ * @param definition The definition to use for the model context.
293
+ * @param locale The locale to use for the model context.
294
+ * @returns The EditorProfile for the model.
295
+ */
296
+ async setProfileForModel(modelId, definition, apiContext = { locale: "en" }) {
297
+ // Convert pre-defined profile to a runtime profile
298
+ if (languageDefaultsBase.isPredefinedProfile(definition)) {
299
+ definition = await convertToEditorProfileDefinition(definition, apiContext.locale);
300
+ }
301
+ const profileStrings = await languageDefaultsBase.fetchT9nStringsBundle(apiContext.locale, index.getAssetPath("./assets/arcade-language/t9n"), "profile.t9n.");
302
+ if (!profileStrings) {
303
+ throw new Error(`Failed to load the language bundle for ${apiContext.locale}`);
304
+ }
305
+ this.disposeForModel(modelId);
306
+ const key = this._getApiKey(modelId);
307
+ const editorProfile = new languageDefaultsBase.EditorProfile(definition, profileStrings);
308
+ this._profileMap.set(key, editorProfile);
309
+ const apiProfile = await arcadeEditorToApiProfile(editorProfile);
310
+ this.updateApiContextForModel(modelId, {
311
+ locale: apiContext.locale,
312
+ profile: apiProfile,
313
+ snippets: apiContext.snippets,
314
+ });
315
+ }
316
+ /**
317
+ * Set or update the Arcade language service options.
318
+ * @param languageOptions The language options to set.
319
+ */
320
+ setLanguageOptions(languageOptions = {}) {
321
+ // Check if options have actually changed.
322
+ // Avoid restarting the worker when no updates.
323
+ // Today we only have the 'assetsPath' as a property
324
+ if (this._languageOptions.assetsPath === languageOptions.assetsPath) {
325
+ return;
326
+ }
327
+ this._languageOptions = { ...this._languageOptions, ...languageOptions };
328
+ this._onDidChange.fire(this);
329
+ }
330
+ /**
331
+ * Gets the API library for the given model id.
332
+ * @param modelId The model id for which to get the API library.
333
+ * @returns The API library for the model.
334
+ */
335
+ async getApiLibrary(modelId) {
336
+ const uri = languageDefaultsBase.Uri.parse(modelId);
337
+ const worker = await getArcadeWorker(uri);
338
+ return await worker.getApiLibrary(this.getApiContextForModel(uri));
339
+ }
340
+ }
341
+ const arcadeDefaults = new ArcadeLanguageServiceDefaults();
342
+ const arcade = {
343
+ setProfileForModel: arcadeDefaults.setProfileForModel.bind(arcadeDefaults),
344
+ getApiLibrary: arcadeDefaults.getApiLibrary.bind(arcadeDefaults),
345
+ };
346
+
347
+ exports.arcade = arcade;
348
+ exports.arcadeDefaults = arcadeDefaults;
349
+ exports.getArcadeDiagnosticService = getArcadeDiagnosticService;
350
+ exports.getMode = getMode;
@@ -1,12 +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.5
4
+ * v4.31.0-next.51
5
5
  */
6
6
  'use strict';
7
7
 
8
- const languageDefaultsBase = require('./language-defaults-base-66e1921b.js');
9
- require('./index-6563aa26.js');
8
+ const languageDefaultsBase = require('./language-defaults-base-1351cde9.js');
10
9
 
11
10
  var V={False:"false",Null:"null",True:"true"},f={Break:"break",Continue:"continue",Else:"else",For:"for",From:"from",Function:"function",If:"if",Import:"import",Export:"export",In:"in",Return:"return",Var:"var",While:"while"},Ee=["++","--"],Je=["-","+","!","~"],Qe=["=","/=","*=","%=","+=","-="],Ze=["||","&&"],Lt=["|","&",">>","<<",">>>","^","==","!=","<","<=",">",">=","+","-","*","/","%"];var U=[[],[],[]];Ee.forEach(t=>U[t.length-1]?.push(t));Je.forEach(t=>U[t.length-1]?.push(t));Ze.forEach(t=>U[t.length-1]?.push(t));Qe.forEach(t=>U[t.length-1]?.push(t));Lt.forEach(t=>U[t.length-1]?.push(t));var ft=Object.values(f),gt=Object.values(V);gt.map(t=>({label:t,kind:languageDefaultsBase.main.exports.CompletionItemKind.Constant}));ft.map(t=>({label:t,kind:languageDefaultsBase.main.exports.CompletionItemKind.Keyword}));
12
11
 
@@ -345,6 +344,7 @@ function isInsertReplaceEdit(edit) {
345
344
  return (typeof edit.insert !== "undefined" &&
346
345
  typeof edit.replace !== "undefined");
347
346
  }
347
+ // TODO: extract this function to common util
348
348
  function toCompletionItemKind(kind) {
349
349
  const mItemKind = languageDefaultsBase.languages.CompletionItemKind;
350
350
  switch (kind) {
@@ -533,7 +533,7 @@ let arcadeWorker;
533
533
  async function getArcadeWorker(...uris) {
534
534
  return await new Promise((resolve, reject) => {
535
535
  if (!arcadeWorker) {
536
- reject(new Error("TypeScript not registered!"));
536
+ reject(new Error("Arcade not registered!"));
537
537
  return;
538
538
  }
539
539
  resolve(arcadeWorker(...uris));