@arcgis/coding-components 4.30.0-next.7 → 4.30.0-next.70

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 (182) hide show
  1. package/LICENSE.md +1 -1
  2. package/README.md +2 -4
  3. package/dist/arcgis-coding-components/arcgis-coding-components.css +1 -1
  4. package/dist/arcgis-coding-components/arcgis-coding-components.esm.js +2 -2
  5. package/dist/arcgis-coding-components/assets/arcade-language/api/arcade-api.t9n.ar.json +25 -0
  6. package/dist/arcgis-coding-components/assets/arcade-language/api/arcade-api.t9n.bg.json +25 -0
  7. package/dist/arcgis-coding-components/assets/arcade-language/api/arcade-api.t9n.bs.json +25 -0
  8. package/dist/arcgis-coding-components/assets/arcade-language/api/arcade-api.t9n.ca.json +25 -0
  9. package/dist/arcgis-coding-components/assets/arcade-language/api/arcade-api.t9n.cs.json +25 -0
  10. package/dist/arcgis-coding-components/assets/arcade-language/api/arcade-api.t9n.da.json +25 -0
  11. package/dist/arcgis-coding-components/assets/arcade-language/api/arcade-api.t9n.de.json +25 -0
  12. package/dist/arcgis-coding-components/assets/arcade-language/api/arcade-api.t9n.el.json +25 -0
  13. package/dist/arcgis-coding-components/assets/arcade-language/api/arcade-api.t9n.en.json +25 -0
  14. package/dist/arcgis-coding-components/assets/arcade-language/api/arcade-api.t9n.es.json +25 -0
  15. package/dist/arcgis-coding-components/assets/arcade-language/api/arcade-api.t9n.et.json +25 -0
  16. package/dist/arcgis-coding-components/assets/arcade-language/api/arcade-api.t9n.fi.json +25 -0
  17. package/dist/arcgis-coding-components/assets/arcade-language/api/arcade-api.t9n.fr.json +25 -0
  18. package/dist/arcgis-coding-components/assets/arcade-language/api/arcade-api.t9n.he.json +25 -0
  19. package/dist/arcgis-coding-components/assets/arcade-language/api/arcade-api.t9n.hr.json +25 -0
  20. package/dist/arcgis-coding-components/assets/arcade-language/api/arcade-api.t9n.hu.json +25 -0
  21. package/dist/arcgis-coding-components/assets/arcade-language/api/arcade-api.t9n.id.json +25 -0
  22. package/dist/arcgis-coding-components/assets/arcade-language/api/arcade-api.t9n.it.json +25 -0
  23. package/dist/arcgis-coding-components/assets/arcade-language/api/arcade-api.t9n.ja.json +25 -0
  24. package/dist/arcgis-coding-components/assets/arcade-language/api/arcade-api.t9n.ko.json +25 -0
  25. package/dist/arcgis-coding-components/assets/arcade-language/api/arcade-api.t9n.lt.json +25 -0
  26. package/dist/arcgis-coding-components/assets/arcade-language/api/arcade-api.t9n.lv.json +25 -0
  27. package/dist/arcgis-coding-components/assets/arcade-language/api/arcade-api.t9n.nb.json +25 -0
  28. package/dist/arcgis-coding-components/assets/arcade-language/api/arcade-api.t9n.nl.json +25 -0
  29. package/dist/arcgis-coding-components/assets/arcade-language/api/arcade-api.t9n.pl.json +25 -0
  30. package/dist/arcgis-coding-components/assets/arcade-language/api/arcade-api.t9n.pt-BR.json +25 -0
  31. package/dist/arcgis-coding-components/assets/arcade-language/api/arcade-api.t9n.pt-PT.json +25 -0
  32. package/dist/arcgis-coding-components/assets/arcade-language/api/arcade-api.t9n.ro.json +25 -0
  33. package/dist/arcgis-coding-components/assets/arcade-language/api/arcade-api.t9n.ru.json +25 -0
  34. package/dist/arcgis-coding-components/assets/arcade-language/api/arcade-api.t9n.sk.json +25 -0
  35. package/dist/arcgis-coding-components/assets/arcade-language/api/arcade-api.t9n.sl.json +25 -0
  36. package/dist/arcgis-coding-components/assets/arcade-language/api/arcade-api.t9n.sr.json +25 -0
  37. package/dist/arcgis-coding-components/assets/arcade-language/api/arcade-api.t9n.sv.json +25 -0
  38. package/dist/arcgis-coding-components/assets/arcade-language/api/arcade-api.t9n.th.json +25 -0
  39. package/dist/arcgis-coding-components/assets/arcade-language/api/arcade-api.t9n.tr.json +25 -0
  40. package/dist/arcgis-coding-components/assets/arcade-language/api/arcade-api.t9n.uk.json +25 -0
  41. package/dist/arcgis-coding-components/assets/arcade-language/api/arcade-api.t9n.vi.json +25 -0
  42. package/dist/arcgis-coding-components/assets/arcade-language/api/arcade-api.t9n.zh-CN.json +25 -0
  43. package/dist/arcgis-coding-components/assets/arcade-language/api/arcade-api.t9n.zh-HK.json +25 -0
  44. package/dist/arcgis-coding-components/assets/arcade-language/api/arcade-api.t9n.zh-TW.json +25 -0
  45. package/dist/arcgis-coding-components/assets/arcade-language/t9n/profile.t9n.ar.json +2 -0
  46. package/dist/arcgis-coding-components/assets/arcade-language/t9n/profile.t9n.bg.json +2 -0
  47. package/dist/arcgis-coding-components/assets/arcade-language/t9n/profile.t9n.bs.json +2 -0
  48. package/dist/arcgis-coding-components/assets/arcade-language/t9n/profile.t9n.ca.json +2 -0
  49. package/dist/arcgis-coding-components/assets/arcade-language/t9n/profile.t9n.cs.json +2 -0
  50. package/dist/arcgis-coding-components/assets/arcade-language/t9n/profile.t9n.da.json +2 -0
  51. package/dist/arcgis-coding-components/assets/arcade-language/t9n/profile.t9n.de.json +2 -0
  52. package/dist/arcgis-coding-components/assets/arcade-language/t9n/profile.t9n.el.json +2 -0
  53. package/dist/arcgis-coding-components/assets/arcade-language/t9n/profile.t9n.es.json +2 -0
  54. package/dist/arcgis-coding-components/assets/arcade-language/t9n/profile.t9n.et.json +2 -0
  55. package/dist/arcgis-coding-components/assets/arcade-language/t9n/profile.t9n.fi.json +2 -0
  56. package/dist/arcgis-coding-components/assets/arcade-language/t9n/profile.t9n.fr.json +2 -0
  57. package/dist/arcgis-coding-components/assets/arcade-language/t9n/profile.t9n.he.json +2 -0
  58. package/dist/arcgis-coding-components/assets/arcade-language/t9n/profile.t9n.hr.json +2 -0
  59. package/dist/arcgis-coding-components/assets/arcade-language/t9n/profile.t9n.hu.json +2 -0
  60. package/dist/arcgis-coding-components/assets/arcade-language/t9n/profile.t9n.id.json +2 -0
  61. package/dist/arcgis-coding-components/assets/arcade-language/t9n/profile.t9n.it.json +2 -0
  62. package/dist/arcgis-coding-components/assets/arcade-language/t9n/profile.t9n.ja.json +2 -0
  63. package/dist/arcgis-coding-components/assets/arcade-language/t9n/profile.t9n.ko.json +2 -0
  64. package/dist/arcgis-coding-components/assets/arcade-language/t9n/profile.t9n.lt.json +2 -0
  65. package/dist/arcgis-coding-components/assets/arcade-language/t9n/profile.t9n.lv.json +2 -0
  66. package/dist/arcgis-coding-components/assets/arcade-language/t9n/profile.t9n.nb.json +2 -0
  67. package/dist/arcgis-coding-components/assets/arcade-language/t9n/profile.t9n.nl.json +2 -0
  68. package/dist/arcgis-coding-components/assets/arcade-language/t9n/profile.t9n.pl.json +2 -0
  69. package/dist/arcgis-coding-components/assets/arcade-language/t9n/profile.t9n.pt-BR.json +2 -0
  70. package/dist/arcgis-coding-components/assets/arcade-language/t9n/profile.t9n.pt-PT.json +2 -0
  71. package/dist/arcgis-coding-components/assets/arcade-language/t9n/profile.t9n.ro.json +2 -0
  72. package/dist/arcgis-coding-components/assets/arcade-language/t9n/profile.t9n.ru.json +2 -0
  73. package/dist/arcgis-coding-components/assets/arcade-language/t9n/profile.t9n.sk.json +2 -0
  74. package/dist/arcgis-coding-components/assets/arcade-language/t9n/profile.t9n.sl.json +2 -0
  75. package/dist/arcgis-coding-components/assets/arcade-language/t9n/profile.t9n.sr.json +2 -0
  76. package/dist/arcgis-coding-components/assets/arcade-language/t9n/profile.t9n.sv.json +2 -0
  77. package/dist/arcgis-coding-components/assets/arcade-language/t9n/profile.t9n.th.json +2 -0
  78. package/dist/arcgis-coding-components/assets/arcade-language/t9n/profile.t9n.tr.json +2 -0
  79. package/dist/arcgis-coding-components/assets/arcade-language/t9n/profile.t9n.uk.json +2 -0
  80. package/dist/arcgis-coding-components/assets/arcade-language/t9n/profile.t9n.vi.json +2 -0
  81. package/dist/arcgis-coding-components/assets/arcade-language/t9n/profile.t9n.zh-CN.json +2 -0
  82. package/dist/arcgis-coding-components/assets/arcade-language/t9n/profile.t9n.zh-HK.json +2 -0
  83. package/dist/arcgis-coding-components/assets/arcade-language/t9n/profile.t9n.zh-TW.json +2 -0
  84. package/dist/arcgis-coding-components/assets/code-editor/arcade.worker.js +2 -2
  85. package/dist/arcgis-coding-components/assets/code-editor/css.worker.js +1 -1
  86. package/dist/arcgis-coding-components/assets/code-editor/editor.worker.js +1 -1
  87. package/dist/arcgis-coding-components/assets/code-editor/html.worker.js +1 -1
  88. package/dist/arcgis-coding-components/assets/code-editor/json.worker.js +1 -1
  89. package/dist/arcgis-coding-components/assets/code-editor/ts.worker.js +1 -1
  90. package/dist/arcgis-coding-components/index.esm.js +2 -2
  91. package/dist/arcgis-coding-components/{p-1b2a100f.js → p-037e779a.js} +1 -1
  92. package/dist/arcgis-coding-components/{p-3ad3b485.js → p-03a88de8.js} +3 -3
  93. package/dist/arcgis-coding-components/{p-7d529ae0.js → p-456e4ea5.js} +3 -3
  94. package/dist/arcgis-coding-components/p-4d1b559c.js +7 -0
  95. package/dist/arcgis-coding-components/{p-41f5c613.js → p-7824a17a.js} +2 -2
  96. package/dist/arcgis-coding-components/{p-19e41297.js → p-94de647f.js} +2 -2
  97. package/dist/arcgis-coding-components/{p-d15b541d.js → p-9bd93ac2.js} +2 -2
  98. package/dist/arcgis-coding-components/{p-43ca4ff8.js → p-ab3f6c19.js} +2 -2
  99. package/dist/arcgis-coding-components/{p-7d8a653c.js → p-d06c37f8.js} +2 -2
  100. package/dist/arcgis-coding-components/p-e816fac5.js +68 -0
  101. package/dist/arcgis-coding-components/{p-53a0b083.js → p-eefe3c2b.js} +3 -3
  102. package/dist/arcgis-coding-components/p-f5547a20.entry.js +6 -0
  103. package/dist/cjs/{arcade-defaults-85d2771a.js → arcade-defaults-ca722f9f.js} +620 -248
  104. package/dist/cjs/{arcade-mode-d675c5ea.js → arcade-mode-60603548.js} +45 -51
  105. package/dist/cjs/arcgis-arcade-api_6.cjs.entry.js +1560 -289
  106. package/dist/cjs/arcgis-coding-components.cjs.js +3 -3
  107. package/dist/cjs/{css-5e66f5d3.js → css-daddb1cf.js} +1 -1
  108. package/dist/cjs/{cssMode-b94f6c97.js → cssMode-65dddafc.js} +3 -3
  109. package/dist/cjs/{html-b264fb71.js → html-fd58ee3a.js} +3 -3
  110. package/dist/cjs/{htmlMode-14366ebc.js → htmlMode-591a0fc6.js} +3 -3
  111. package/dist/cjs/{index-6542b576.js → index-c731f1b4.js} +40 -4
  112. package/dist/cjs/index.cjs.js +3 -3
  113. package/dist/cjs/{javascript-40266757.js → javascript-07b4dfdf.js} +4 -4
  114. package/dist/cjs/{jsonMode-241f2a4a.js → jsonMode-b9e12d85.js} +3 -3
  115. package/dist/cjs/loader.cjs.js +3 -3
  116. package/dist/cjs/{tsMode-066b04bf.js → tsMode-fc2a3eea.js} +3 -3
  117. package/dist/cjs/{typescript-9ac6fd5a.js → typescript-8a136799.js} +3 -3
  118. package/dist/components/arcade-api.js +21 -32
  119. package/dist/components/arcade-contribution.js +72 -13
  120. package/dist/components/arcade-defaults.js +131 -149
  121. package/dist/components/arcade-mode.js +44 -50
  122. package/dist/components/arcade-results.js +47 -60
  123. package/dist/components/arcade-suggestions.js +23 -33
  124. package/dist/components/arcade-variables.js +22 -36
  125. package/dist/components/arcgis-arcade-api.js +1 -1
  126. package/dist/components/arcgis-arcade-editor.js +60 -150
  127. package/dist/components/arcgis-arcade-results.js +1 -1
  128. package/dist/components/arcgis-arcade-suggestions.js +1 -1
  129. package/dist/components/arcgis-arcade-variables.js +1 -1
  130. package/dist/components/arcgis-assets.d.ts +1 -1
  131. package/dist/components/arcgis-assets.js +1 -1
  132. package/dist/components/arcgis-code-editor.js +1 -1
  133. package/dist/components/chunk-63RMNUHL.js +1275 -0
  134. package/dist/components/code-editor.js +70 -78
  135. package/dist/components/fields.js +45 -45
  136. package/dist/components/index.js +1 -1
  137. package/dist/components/index2.js +389 -3
  138. package/dist/components/markdown.js +9 -11
  139. package/dist/components/useT9n.js +35 -0
  140. package/dist/components/utilities.js +3 -3
  141. package/dist/esm/{arcade-defaults-ef372fd5.js → arcade-defaults-e4c7078b.js} +603 -235
  142. package/dist/esm/{arcade-mode-04d65df2.js → arcade-mode-73b62736.js} +45 -51
  143. package/dist/esm/arcgis-arcade-api_6.entry.js +1560 -289
  144. package/dist/esm/arcgis-coding-components.js +4 -4
  145. package/dist/esm/{css-50e0f632.js → css-4de308d6.js} +1 -1
  146. package/dist/esm/{cssMode-0740511f.js → cssMode-f2830819.js} +3 -3
  147. package/dist/esm/{html-9d2b157c.js → html-88822b8e.js} +3 -3
  148. package/dist/esm/{htmlMode-fd1c3eea.js → htmlMode-812062b4.js} +3 -3
  149. package/dist/esm/{index-7f8b9422.js → index-03c42e1e.js} +40 -4
  150. package/dist/esm/index.js +3 -3
  151. package/dist/esm/{javascript-014d6512.js → javascript-3e83e341.js} +4 -4
  152. package/dist/esm/{jsonMode-ccac7c7d.js → jsonMode-6921d65e.js} +3 -3
  153. package/dist/esm/loader.js +4 -4
  154. package/dist/esm/{tsMode-cfa861b3.js → tsMode-c235482f.js} +3 -3
  155. package/dist/esm/{typescript-9c1ebeca.js → typescript-c0a8cf29.js} +3 -3
  156. package/dist/loader/cdn.js +1 -1
  157. package/dist/loader/index.cjs.js +1 -1
  158. package/dist/loader/index.es2017.js +1 -1
  159. package/dist/loader/index.js +1 -1
  160. package/dist/types/components/arcade-api/arcade-api.d.ts +6 -7
  161. package/dist/types/components/arcade-editor/arcade-editor.d.ts +18 -12
  162. package/dist/types/components/arcade-results/arcade-results.d.ts +6 -9
  163. package/dist/types/components/arcade-suggestions/arcade-suggestions.d.ts +7 -8
  164. package/dist/types/components/arcade-variables/arcade-variables.d.ts +6 -8
  165. package/dist/types/components/code-editor/code-editor.d.ts +23 -13
  166. package/dist/types/components.d.ts +57 -35
  167. package/dist/types/controllers/useT9n.d.ts +1 -0
  168. package/dist/types/data/actions-runner-1/_work/arcgis-web-components/arcgis-web-components/packages/coding-packages/coding-components/.stencil/stencil.config.d.ts +3 -0
  169. 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 +27 -0
  170. 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 +11 -0
  171. package/dist/types/data/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 +6 -0
  172. package/dist/types/data/actions-runner-1/_work/arcgis-web-components/arcgis-web-components/packages/coding-packages/coding-components/.stencil/stories/reference/stories/arcade-editor.stories.d.ts +9 -0
  173. package/dist/types/data/actions-runner-1/_work/arcgis-web-components/arcgis-web-components/packages/coding-packages/coding-components/.stencil/support/sass-inline-url-importer.d.ts +9 -0
  174. package/dist/types/data/actions-runner-1/_work/arcgis-web-components/arcgis-web-components/packages/coding-packages/coding-components/.stencil/support/sass-json-importer.d.ts +19 -0
  175. package/dist/types/data/actions-runner-1/_work/arcgis-web-components/arcgis-web-components/packages/coding-packages/coding-components/.stencil/support/stencil-monaco-plugins.d.ts +6 -0
  176. package/dist/types/utils/arcade-monaco/arcade-language-features.d.ts +1 -1
  177. package/dist/types/utils/profile/types.d.ts +15 -13
  178. package/dist/types/utils/profile/utils.d.ts +1 -3
  179. package/package.json +21 -21
  180. package/dist/arcgis-coding-components/p-1927140d.js +0 -68
  181. package/dist/arcgis-coding-components/p-6aa84514.js +0 -7
  182. package/dist/arcgis-coding-components/p-c4f70a58.entry.js +0 -6
@@ -1,37 +1,16 @@
1
1
  /*!
2
2
  * All material copyright Esri, All Rights Reserved, unless otherwise specified.
3
3
  * See https://js.arcgis.com/4.30/esri/copyright.txt for details.
4
- * v4.30.0-next.7
4
+ * v4.30.0-next.70
5
5
  */
6
6
  import { Emitter, Uri } from 'monaco-editor';
7
7
  import { InsertTextMode, InsertTextFormat, CompletionItemKind } from 'vscode-languageserver-types';
8
- import { i as importLayersFeatureLayer, a as importRequest, s as supportedFields, n as newPortalPortalItem, b as newWebScene, c as newWebMap, f as fieldAlias, d as fieldTypeToIconName, e as fieldTypeToArcadeType } from './fields.js';
8
+ import { n as newLayersFeatureLayer, i as importRequest, s as supportedFields, a as newPortalPortalItem, b as newWebScene, c as newWebMap, f as fieldAlias, d as fieldTypeToIconName, e as fieldTypeToArcadeType } from './fields.js';
9
9
  import { p as portalItemPageUrl } from './utilities.js';
10
- import { e as ee, t as te, G, Z, E, v } from './index2.js';
10
+ import { i as isNotNull, a as isNotUndefined, b as addLTRMark, s as setValuesInString, c as supportedLocales, f as fetchT9NStringsBundle } from './index2.js';
11
11
  import { getArcgisAssetPath as getAssetPath } from "./arcgis-assets.js";
12
12
 
13
- //#region core adapter fix
14
- async function newFeatureLayer(definition) {
15
- const FeatureLayer = await importLayersFeatureLayer();
16
- // Fix title for the layer. Instead of defaulting to the map viewer style.
17
- return new FeatureLayer({ ...definition, sublayerTitleMode: "service-name" });
18
- }
19
- //#endregion
20
13
  //#region Type Guards
21
- function isSupportedLayerInstance(item) {
22
- return (!!item &&
23
- typeof item === "object" &&
24
- "declaredClass" in item &&
25
- typeof item.declaredClass === "string" &&
26
- item.declaredClass.startsWith("esri.layers."));
27
- }
28
- function isFeatureSetInstance(item) {
29
- return (!!item &&
30
- typeof item === "object" &&
31
- "declaredClass" in item &&
32
- typeof item.declaredClass === "string" &&
33
- item.declaredClass === "esri.rest.support.FeatureSet");
34
- }
35
14
  function isQueryableLayerInstance(item) {
36
15
  return (!!item &&
37
16
  typeof item === "object" &&
@@ -81,10 +60,13 @@ function isFeatureLayerItemDefinition(item) {
81
60
  return !!item && typeof item === "object" && "portalItem" in item && item.portalItem != null;
82
61
  }
83
62
  function isFieldsDefinition(item) {
84
- return (!!item && typeof item === "object" && "fields" in item && Array.isArray(item.fields) && !("declaredClass" in item));
63
+ return !!item && typeof item === "object" && "fields" in item && Array.isArray(item.fields);
85
64
  }
86
65
  function isUrlDefinition(item) {
87
- return (!!item && typeof item === "object" && "url" in item && typeof item.url === "string" && !("declaredClass" in item));
66
+ return !!item && typeof item === "object" && "url" in item && typeof item.url === "string";
67
+ }
68
+ function isSupportedServiceUrlDefinition(item) {
69
+ return isUrlDefinition(item) && /\/(?:featureserver|mapserver)(?:\/|$)/iu.test(item.url);
88
70
  }
89
71
  function isSubtypeInstance(item) {
90
72
  return (!!item &&
@@ -154,11 +136,11 @@ async function supportedSourceFromDefinition(definition) {
154
136
  return null;
155
137
  }
156
138
  let source = null;
157
- if (isSupportedLayerInstance(definition) || isFeatureSetInstance(definition) || isFieldsDefinition(definition)) {
139
+ if (isFieldsDefinition(definition)) {
158
140
  source = definition;
159
141
  }
160
142
  else {
161
- source = await newFeatureLayer(definition);
143
+ source = await newLayersFeatureLayer(definition);
162
144
  }
163
145
  if (isLoadableSource(source)) {
164
146
  await source.load();
@@ -169,27 +151,32 @@ async function serviceMetaData(url) {
169
151
  url += "/layers";
170
152
  const request = await importRequest();
171
153
  const response = await request(url, { responseType: "json", query: { f: "json" } });
172
- const data = {
173
- layers: response.data?.layers ?? [],
174
- tables: response.data?.tables ?? []
175
- };
176
154
  const queryCapability = url.endsWith("MapServer/layers") ? "data" : "query";
177
- const layers = filterFeatureLayerInfos(data.layers, queryCapability);
178
- const tables = filterFeatureLayerInfos(data.tables, queryCapability);
155
+ const layers = getSupportedLayerInfos(response.data?.layers, queryCapability);
156
+ const tables = getSupportedLayerInfos(response.data?.tables, queryCapability);
179
157
  return { layers, tables };
180
158
  }
181
- function filterFeatureLayerInfos(layers, queryCapability) {
159
+ function getSupportedLayerInfos(layers, queryCapability) {
160
+ if (!layers) {
161
+ return [];
162
+ }
182
163
  return layers.filter((layer) => {
183
- if (layer.type !== "Feature Layer" && layer.type !== "Table") {
184
- return false;
185
- }
186
- const capabilities = layer.capabilities
187
- ? layer.capabilities
188
- .toLowerCase()
189
- .split(",")
190
- .map((value) => value.trim())
191
- : [];
192
- return capabilities.includes(queryCapability);
164
+ switch (layer.type) {
165
+ case "Feature Layer":
166
+ case "Oriented Imagery Layer":
167
+ case "Catalog Layer":
168
+ case "Table": {
169
+ const capabilities = layer.capabilities
170
+ ? layer.capabilities
171
+ .toLowerCase()
172
+ .split(",")
173
+ .map((value) => value.trim())
174
+ : [];
175
+ return capabilities.includes(queryCapability);
176
+ }
177
+ default:
178
+ return false;
179
+ }
193
180
  });
194
181
  }
195
182
  //#endregion
@@ -197,7 +184,7 @@ function filterFeatureLayerInfos(layers, queryCapability) {
197
184
  //#endregion
198
185
  //#region Support functions
199
186
  async function getRelatedFeatureLayer(layer, relationship) {
200
- const relatedFeatureLayer = await newFeatureLayer({ url: `${layer.url}/${relationship.relatedTableId}` });
187
+ const relatedFeatureLayer = await newLayersFeatureLayer({ url: `${layer.url}/${relationship.relatedTableId}` });
201
188
  await relatedFeatureLayer.load();
202
189
  return relatedFeatureLayer;
203
190
  }
@@ -287,8 +274,8 @@ function variableToLSVariable(editorVariable, kind) {
287
274
  insertTextMode: InsertTextMode.asIs,
288
275
  insertTextFormat: InsertTextFormat.PlainText,
289
276
  kind,
290
- documentation: { kind: "markdown", value: description }
291
- }
277
+ documentation: { kind: "markdown", value: description },
278
+ },
292
279
  };
293
280
  }
294
281
  async function featureToLSFeature(editorFeature, kind) {
@@ -302,14 +289,14 @@ async function featureToLSFeature(editorFeature, kind) {
302
289
  insertText: name,
303
290
  insertTextMode: InsertTextMode.asIs,
304
291
  insertTextFormat: InsertTextFormat.PlainText,
305
- kind
292
+ kind,
306
293
  };
307
294
  const result = {
308
295
  name,
309
296
  description,
310
297
  type: "dictionary",
311
298
  properties: [],
312
- completion: resultCompletion
299
+ completion: resultCompletion,
313
300
  };
314
301
  // No source definition, then it will be a feature without any known fields
315
302
  if (!source) {
@@ -347,8 +334,8 @@ async function featureToLSFeature(editorFeature, kind) {
347
334
  insertTextMode: InsertTextMode.asIs,
348
335
  insertTextFormat: InsertTextFormat.PlainText,
349
336
  kind: CompletionItemKind.Field,
350
- documentation: { kind: "markdown", value: fieldCompletionDescription }
351
- }
337
+ documentation: { kind: "markdown", value: fieldCompletionDescription },
338
+ },
352
339
  });
353
340
  if (!field.alias || field.alias.toLowerCase() === field.name.toLowerCase()) {
354
341
  return;
@@ -369,8 +356,8 @@ async function featureToLSFeature(editorFeature, kind) {
369
356
  insertTextMode: InsertTextMode.asIs,
370
357
  insertTextFormat: InsertTextFormat.PlainText,
371
358
  kind: CompletionItemKind.Field,
372
- documentation: { kind: "markdown", value: aliasCompletionDescription }
373
- }
359
+ documentation: { kind: "markdown", value: aliasCompletionDescription },
360
+ },
374
361
  });
375
362
  });
376
363
  result.properties = [...fieldProfileValues, ...aliasProfileValues];
@@ -403,8 +390,8 @@ async function dictionaryToLSDictionary(editorDictionary, kind) {
403
390
  insertTextMode: InsertTextMode.asIs,
404
391
  insertTextFormat: InsertTextFormat.PlainText,
405
392
  kind,
406
- documentation: { kind: "markdown", value: completionDescription }
407
- }
393
+ documentation: { kind: "markdown", value: completionDescription },
394
+ },
408
395
  };
409
396
  }
410
397
  /**
@@ -431,9 +418,9 @@ class ProfileItemBase {
431
418
  // If the component is under RTL, the string is messed up.
432
419
  // It is converted from $feature to feature$, This is not acceptable since the label
433
420
  // represents a variable name. We are adding in front of the $ sign a right to left mark.
434
- return G(this._label);
421
+ return addLTRMark(this._label);
435
422
  }
436
- return Z(this._profile?.intlStrings[this._label.code], this._label.formatValues);
423
+ return setValuesInString(this._profile?.intlStrings[this._label.code], this._label.formatValues);
437
424
  }
438
425
  /**
439
426
  * Returns the description string.
@@ -445,7 +432,7 @@ class ProfileItemBase {
445
432
  if (typeof this.description === "string") {
446
433
  return this.description;
447
434
  }
448
- return Z(this._profile?.intlStrings[this.description.code], this.description.formatValues);
435
+ return setValuesInString(this._profile?.intlStrings[this.description.code], this.description.formatValues);
449
436
  }
450
437
  /**
451
438
  * Returns true if the item pass the filter test
@@ -622,28 +609,28 @@ class DictionaryVariable extends CollectionBasedVariable {
622
609
  return new FeatureVariable(this, { profile: this._profile, declaration, label: snippet, snippet });
623
610
  case "featureSet":
624
611
  return new FeatureSetVariable(this, { profile: this._profile, declaration, label: snippet, snippet }, [
625
- new ValueVariable({ profile: this._profile, label: snippet, description: "", snippet })
612
+ new ValueVariable({ profile: this._profile, label: snippet, description: "", snippet }),
626
613
  ]);
627
614
  case "featureSetCollection":
628
615
  return new FeatureSetCollectionVariable(this, {
629
616
  profile: this._profile,
630
617
  declaration,
631
618
  label: snippet,
632
- snippet
619
+ snippet,
633
620
  });
634
621
  case "dictionary":
635
622
  return new DictionaryVariable(this, {
636
623
  profile: this._profile,
637
624
  declaration,
638
625
  label: snippet,
639
- snippet
626
+ snippet,
640
627
  });
641
628
  case "array":
642
629
  return new ArrayVariable({
643
630
  profile: this._profile,
644
631
  declaration,
645
632
  label: snippet,
646
- snippet
633
+ snippet,
647
634
  });
648
635
  default:
649
636
  console.error("Editor profile: Invalid profile variable", declaration);
@@ -655,7 +642,7 @@ class DictionaryVariable extends CollectionBasedVariable {
655
642
  type: this.type,
656
643
  name: "",
657
644
  ...this.declaration,
658
- properties: this.dictionaryVariables.map((variable) => variable.toProfileVariableDefinition())
645
+ properties: this.dictionaryVariables.map((variable) => variable.toProfileVariableDefinition()),
659
646
  };
660
647
  }
661
648
  }
@@ -686,7 +673,7 @@ class SourceBasedVariable extends CollectionBasedVariable {
686
673
  return this._profile?.intlStrings.layer ?? "layer";
687
674
  }
688
675
  async loadSource() {
689
- if (ee(this._loadPromise) && te(this._loadPromise)) {
676
+ if (isNotNull(this._loadPromise) && isNotUndefined(this._loadPromise)) {
690
677
  return await this._loadPromise;
691
678
  }
692
679
  this._loadPromise = this._loadSource();
@@ -721,7 +708,7 @@ class SourceBasedVariable extends CollectionBasedVariable {
721
708
  description: fieldAlias(field),
722
709
  snippet: valueSnippet,
723
710
  icon: fieldTypeToIconName(field),
724
- filterDescription: true
711
+ filterDescription: true,
725
712
  });
726
713
  }
727
714
  _getDomainDictionary(field) {
@@ -760,6 +747,7 @@ class SourceBasedVariable extends CollectionBasedVariable {
760
747
  // Sepcial case for the subtype field
761
748
  if (field.name === this._source.subtypeField) {
762
749
  const domainDictionary = this._createDomainDictionary(field);
750
+ domainDictionary.icon = "subtype";
763
751
  domainDictionary.variables.push(this._getTypeOrSubtypeDomainGroup(this._source.subtypes, field));
764
752
  return domainDictionary;
765
753
  }
@@ -814,7 +802,7 @@ class SourceBasedVariable extends CollectionBasedVariable {
814
802
  return null;
815
803
  }
816
804
  const domainValuesGroup = this._getCodedValueDomainGroup(fieldDomain, {
817
- code: "domainvalues"
805
+ code: "domainvalues",
818
806
  });
819
807
  const domainDictionary = this._createDomainDictionary(field);
820
808
  domainDictionary.variables.push(domainValuesGroup);
@@ -832,7 +820,7 @@ class SourceBasedVariable extends CollectionBasedVariable {
832
820
  profile: this._profile,
833
821
  label: `${label}`,
834
822
  description: t.name,
835
- snippet: `"${label}"`
823
+ snippet: `"${label}"`,
836
824
  });
837
825
  }) ?? [];
838
826
  return new GroupOfVariables(this._profile, { code: "subtypes" }, values);
@@ -843,7 +831,7 @@ class SourceBasedVariable extends CollectionBasedVariable {
843
831
  label: `${v.code}`,
844
832
  description: v.name,
845
833
  snippet: `"${v.code}"`,
846
- filterDescription: true
834
+ filterDescription: true,
847
835
  }));
848
836
  return new GroupOfVariables(this._profile, label, values);
849
837
  }
@@ -869,8 +857,8 @@ class SourceBasedVariable extends CollectionBasedVariable {
869
857
  code: "domainvaluesfortypeformat",
870
858
  formatValues: {
871
859
  fieldName: alias,
872
- typeName: type.name
873
- }
860
+ typeName: type.name,
861
+ },
874
862
  });
875
863
  const id = isSubtypeInstance(type) ? type.code : type.id;
876
864
  const label = `${id}`;
@@ -880,7 +868,7 @@ class SourceBasedVariable extends CollectionBasedVariable {
880
868
  label,
881
869
  snippet,
882
870
  description: type.name,
883
- declaration: { name: alias }
871
+ declaration: { name: alias },
884
872
  });
885
873
  subtypeDictionary.variables = [domainValuesGroup];
886
874
  variables.push(subtypeDictionary);
@@ -902,7 +890,7 @@ class SourceBasedVariable extends CollectionBasedVariable {
902
890
  description: alias,
903
891
  snippet: valueSnippet,
904
892
  icon: "form-dropdown",
905
- declaration: { name: field.name }
893
+ declaration: { name: field.name },
906
894
  });
907
895
  // Add the header group
908
896
  const headerGroup = new GroupOfVariables(this._profile, alias, [
@@ -910,8 +898,8 @@ class SourceBasedVariable extends CollectionBasedVariable {
910
898
  profile: this._profile,
911
899
  label: valueSnippet,
912
900
  description: "",
913
- snippet: valueSnippet
914
- })
901
+ snippet: valueSnippet,
902
+ }),
915
903
  ]);
916
904
  domainDictionary.variables = [headerGroup];
917
905
  // Add the SubtypeName or DomainName snippet if available
@@ -921,7 +909,7 @@ class SourceBasedVariable extends CollectionBasedVariable {
921
909
  profile: this._profile,
922
910
  label: subtypeOrDomainNameSnippet,
923
911
  description: "",
924
- snippet: subtypeOrDomainNameSnippet
912
+ snippet: subtypeOrDomainNameSnippet,
925
913
  }));
926
914
  }
927
915
  return domainDictionary;
@@ -951,10 +939,10 @@ class SourceBasedVariable extends CollectionBasedVariable {
951
939
  declaration: { definition: relatedLayer },
952
940
  label: relatedLayer.title,
953
941
  description: "",
954
- nonInteractive: true
942
+ nonInteractive: true,
955
943
  }, [new ValueVariable({ profile: this._profile, label: snippet, description: "", snippet })], { exposeRelationships: true, sourceTableId: source.layerId });
956
944
  }));
957
- relationshipsGroup.variables = relationshipItems.filter(ee);
945
+ relationshipsGroup.variables = relationshipItems.filter(isNotNull);
958
946
  if (!relationshipsGroup.variables.length) {
959
947
  return null;
960
948
  }
@@ -967,8 +955,8 @@ class FeatureVariable extends SourceBasedVariable {
967
955
  this.type = "feature";
968
956
  }
969
957
  get title() {
970
- if (isSupportedLayerInstance(this._source)) {
971
- return this._source.title;
958
+ if (isTitleCapableSource(this._source)) {
959
+ return this._source.title ?? "";
972
960
  }
973
961
  return { code: "feature" };
974
962
  }
@@ -982,14 +970,14 @@ class FeatureVariable extends SourceBasedVariable {
982
970
  throw new Error("Invalid definition");
983
971
  }
984
972
  // The title group and snippet
985
- const title = isSupportedLayerInstance(this._source) ? this._source.title : "";
973
+ const title = isTitleCapableSource(this._source) ? this._source.title ?? "" : "";
986
974
  this.variables.push(new GroupOfVariables(this._profile, title, [
987
975
  new ValueVariable({
988
976
  profile: this._profile,
989
977
  label: this.snippet,
990
978
  description: "",
991
- snippet: this.snippet
992
- })
979
+ snippet: this.snippet,
980
+ }),
993
981
  ]));
994
982
  // The collection of feature attribute values
995
983
  const valuesGroup = new GroupOfVariables(this._profile, { code: "values" });
@@ -1004,7 +992,7 @@ class FeatureVariable extends SourceBasedVariable {
1004
992
  description: "Geometry",
1005
993
  snippet,
1006
994
  icon: "shapes",
1007
- filterDescription: true
995
+ filterDescription: true,
1008
996
  });
1009
997
  valuesGroup.variables.push(geometryProperty);
1010
998
  }
@@ -1017,8 +1005,8 @@ class FeatureVariable extends SourceBasedVariable {
1017
1005
  this.variables.push(relationshipsGroup);
1018
1006
  }
1019
1007
  }
1020
- catch (e) {
1021
- console.error("Loading issue", e, this);
1008
+ catch (error) {
1009
+ console.error("Error with definition", error, this._definition);
1022
1010
  this._source = null;
1023
1011
  }
1024
1012
  finally {
@@ -1040,8 +1028,8 @@ class FeatureSetVariable extends SourceBasedVariable {
1040
1028
  this.type = "featureSet";
1041
1029
  }
1042
1030
  get title() {
1043
- if (isSupportedLayerInstance(this._source)) {
1044
- return this._source.title;
1031
+ if (isTitleCapableSource(this._source)) {
1032
+ return this._source.title ?? "";
1045
1033
  }
1046
1034
  return { code: "featureset" };
1047
1035
  }
@@ -1068,8 +1056,8 @@ class FeatureSetVariable extends SourceBasedVariable {
1068
1056
  this.variables.push(relationshipsGroup);
1069
1057
  }
1070
1058
  }
1071
- catch (e) {
1072
- console.error("Loading issue", e, this);
1059
+ catch (error) {
1060
+ console.error("Error with definition", error, this._definition);
1073
1061
  this._source = null;
1074
1062
  }
1075
1063
  finally {
@@ -1118,7 +1106,7 @@ class FeatureSetCollectionVariable extends CollectionBasedVariable {
1118
1106
  return this._profile?.intlStrings.map ?? "map";
1119
1107
  }
1120
1108
  async loadSource() {
1121
- if (ee(this._loadPromise) && te(this._loadPromise)) {
1109
+ if (isNotNull(this._loadPromise) && isNotUndefined(this._loadPromise)) {
1122
1110
  return await this._loadPromise;
1123
1111
  }
1124
1112
  this._loadPromise = this._loadSource();
@@ -1139,24 +1127,24 @@ class FeatureSetCollectionVariable extends CollectionBasedVariable {
1139
1127
  : {
1140
1128
  code: "webmapformat",
1141
1129
  formatValues: {
1142
- webMapTitle: getMapPortalItem(this._featureSetCollections.source)?.title || "Untitled map"
1143
- }
1130
+ webMapTitle: getMapPortalItem(this._featureSetCollections.source)?.title || "Untitled map",
1131
+ },
1144
1132
  };
1145
1133
  const headerGroup = new GroupOfVariables(this._profile, groupLabel, [
1146
1134
  new ValueVariable({
1147
1135
  profile: this._profile,
1148
1136
  label: this.snippet,
1149
1137
  description: "",
1150
- snippet: this.snippet
1151
- })
1138
+ snippet: this.snippet,
1139
+ }),
1152
1140
  ]);
1153
1141
  // Creates the groups for the layer and tables
1154
1142
  const layersGroup = new GroupOfVariables(this._profile, { code: "layers" }, this._featureSetCollections.layers);
1155
1143
  const tablesGroup = new GroupOfVariables(this._profile, { code: "tables" }, this._featureSetCollections.tables);
1156
1144
  this.variables.push(headerGroup, layersGroup, tablesGroup);
1157
1145
  }
1158
- catch (e) {
1159
- console.error("Loading issue", e, this);
1146
+ catch (error) {
1147
+ console.error("Error with definition", error, this._definition);
1160
1148
  this._featureSetCollections = null;
1161
1149
  }
1162
1150
  finally {
@@ -1171,7 +1159,7 @@ class FeatureSetCollectionVariable extends CollectionBasedVariable {
1171
1159
  if (isMapInstance(this._definition)) {
1172
1160
  return await this._featureSetCollectionFromMap(this._definition);
1173
1161
  }
1174
- if (isSupportedLayerInstance(this._definition)) {
1162
+ if (isUrlDefinition(this._definition)) {
1175
1163
  return await this._featureSetCollectionFromUrl(this._definition.url);
1176
1164
  }
1177
1165
  if (isPortalItemDefinition(this._definition)) {
@@ -1179,10 +1167,6 @@ class FeatureSetCollectionVariable extends CollectionBasedVariable {
1179
1167
  // or Feature Service
1180
1168
  return await this._featureSetCollectionFromPortalItem(this._definition.portalItem);
1181
1169
  }
1182
- if (isUrlDefinition(this._definition)) {
1183
- // Assume that the url is pointing to a feature server
1184
- return await this._featureSetCollectionFromUrl(this._definition.url);
1185
- }
1186
1170
  return null;
1187
1171
  }
1188
1172
  async _featureSetCollectionFromMap(map) {
@@ -1195,7 +1179,7 @@ class FeatureSetCollectionVariable extends CollectionBasedVariable {
1195
1179
  return {
1196
1180
  layers: this._convertWebMapLayersToVariables(map.layers),
1197
1181
  tables: this._convertWebMapLayersToVariables(map.tables, true),
1198
- source: map
1182
+ source: map,
1199
1183
  };
1200
1184
  }
1201
1185
  async _featureSetCollectionFromPortalItem(definition) {
@@ -1226,12 +1210,12 @@ class FeatureSetCollectionVariable extends CollectionBasedVariable {
1226
1210
  }
1227
1211
  const metadata = await serviceMetaData(processedUrl);
1228
1212
  const layersPromise = Promise.all(metadata.layers.map(async (layerInfo) => {
1229
- const featureLayer = await newFeatureLayer({ url: `${processedUrl}/${layerInfo.id}` });
1213
+ const featureLayer = await newLayersFeatureLayer({ url: `${processedUrl}/${layerInfo.id}` });
1230
1214
  await featureLayer.load();
1231
1215
  return this._createFeatureSetVariable(featureLayer);
1232
1216
  }));
1233
1217
  const tablesPromise = Promise.all(metadata.tables.map(async (layerInfo) => {
1234
- const table = await newFeatureLayer({ url: `${processedUrl}/${layerInfo.id}` });
1218
+ const table = await newLayersFeatureLayer({ url: `${processedUrl}/${layerInfo.id}` });
1235
1219
  await table.load();
1236
1220
  return this._createFeatureSetVariable(table);
1237
1221
  }));
@@ -1261,9 +1245,11 @@ class FeatureSetCollectionVariable extends CollectionBasedVariable {
1261
1245
  return new FeatureSetVariable(this, {
1262
1246
  profile: this._profile,
1263
1247
  declaration: { name: featureLayer.title, definition: featureLayer },
1264
- label: featureLayer.title,
1248
+ label: isFromWebMap
1249
+ ? featureLayer.title
1250
+ : featureLayer.sourceJSON.name ?? featureLayer.title,
1265
1251
  description: "",
1266
- nonInteractive: true
1252
+ nonInteractive: true,
1267
1253
  }, this._makeFeatureSetSnippets(featureLayer, isFromWebMap));
1268
1254
  }
1269
1255
  _makeFeatureSetSnippets(featureLayer, isFromWebMap = false) {
@@ -1275,7 +1261,7 @@ class FeatureSetCollectionVariable extends CollectionBasedVariable {
1275
1261
  const snippetByName = `FeatureSetByName(${this.snippet}, "${featureLayer.title}")`;
1276
1262
  return [
1277
1263
  new ValueVariable({ profile: this._profile, label: snippetById, description: "", snippet: snippetById }),
1278
- new ValueVariable({ profile: this._profile, label: snippetByName, description: "", snippet: snippetByName })
1264
+ new ValueVariable({ profile: this._profile, label: snippetByName, description: "", snippet: snippetByName }),
1279
1265
  ];
1280
1266
  }
1281
1267
  else {
@@ -1300,7 +1286,7 @@ class EditorProfile extends DictionaryVariable {
1300
1286
  // Delay the load of the variable declarations so we have a `this`
1301
1287
  super(undefined, {
1302
1288
  profile: null,
1303
- declaration: { properties: [] }
1289
+ declaration: { properties: [] },
1304
1290
  });
1305
1291
  this.definition = definition;
1306
1292
  this.intlStrings = intlStrings;
@@ -1332,28 +1318,20 @@ class EditorProfile extends DictionaryVariable {
1332
1318
  toEditorProfileDefinition() {
1333
1319
  return {
1334
1320
  ...this.definition,
1335
- variables: this.dictionaryVariables.map((variable) => variable.toProfileVariableDefinition())
1321
+ variables: this.dictionaryVariables.map((variable) => variable.toProfileVariableDefinition()),
1336
1322
  };
1337
1323
  }
1338
1324
  }
1339
1325
  //#endregion
1340
1326
 
1341
1327
  function isFeatureDefinition(item) {
1342
- return (isSupportedLayerInstance(item) ||
1343
- isFeatureSetInstance(item) ||
1344
- isUrlDefinition(item) ||
1345
- isFieldsDefinition(item) ||
1346
- isFeatureLayerItemDefinition(item));
1328
+ return isUrlDefinition(item) || isFieldsDefinition(item) || isFeatureLayerItemDefinition(item);
1347
1329
  }
1348
1330
  function isFeatureSetDefinition(item) {
1349
- return (isQueryableLayerInstance(item) ||
1350
- isFeatureSetInstance(item) ||
1351
- isUrlDefinition(item) ||
1352
- isFieldsDefinition(item) ||
1353
- isFeatureLayerItemDefinition(item));
1331
+ return isUrlDefinition(item) || isFieldsDefinition(item) || isFeatureLayerItemDefinition(item);
1354
1332
  }
1355
1333
  function isFeatureSetCollectionDefinition(item) {
1356
- return isPortalItemDefinition(item) || isMapInstance(item) || isFeatureSetDefinition(item);
1334
+ return isPortalItemDefinition(item) || isMapInstance(item) || isSupportedServiceUrlDefinition(item);
1357
1335
  }
1358
1336
  /**
1359
1337
  * Get a PredefinedProfile for a locale. If not already loaded then fetch it.
@@ -1365,7 +1343,7 @@ async function getSdkPredefinedProfiles(locale = "en") {
1365
1343
  if (profiles) {
1366
1344
  return profiles;
1367
1345
  }
1368
- if (!E.has(locale)) {
1346
+ if (!supportedLocales.has(locale)) {
1369
1347
  return await getSdkPredefinedProfiles("en");
1370
1348
  }
1371
1349
  try {
@@ -1403,7 +1381,7 @@ function isExtendedPredefinedProfileDefinition(item) {
1403
1381
  return !!item && typeof item === "object" && "additionalVariables" in item && Array.isArray(item.additionalVariables);
1404
1382
  }
1405
1383
  function convertApiVariables(variables) {
1406
- return variables.map(convertApiVariable);
1384
+ return variables?.map(convertApiVariable);
1407
1385
  }
1408
1386
  function convertApiVariable(variable) {
1409
1387
  switch (variable.type) {
@@ -1411,13 +1389,13 @@ function convertApiVariable(variable) {
1411
1389
  return {
1412
1390
  ...variable,
1413
1391
  type: variable.type,
1414
- properties: convertApiVariables(variable.properties)
1392
+ properties: convertApiVariables(variable.properties),
1415
1393
  };
1416
1394
  case "array": {
1417
1395
  return {
1418
1396
  ...variable,
1419
1397
  type: variable.type,
1420
- elementType: { type: "number", name: "number" }
1398
+ elementType: { type: "number", name: "number" },
1421
1399
  };
1422
1400
  }
1423
1401
  default:
@@ -1435,43 +1413,47 @@ async function convertToEditorProfileDefinition(predefinedProfile, locale = "en"
1435
1413
  const editorProfile = {
1436
1414
  bundles: [...sdkPredefinedProfile.bundles],
1437
1415
  variables: [],
1438
- hiddenApiItems: predefinedProfile.hiddenApiItems?.map((s) => s.toLowerCase())
1416
+ hiddenApiItems: predefinedProfile.hiddenApiItems?.map((s) => s.toLowerCase()),
1439
1417
  };
1440
1418
  // Merge the SDK variables' definitions/properties with the predefined profile definitions.
1441
- sdkPredefinedProfile.variables.forEach((sdkVariable) => {
1419
+ sdkPredefinedProfile.variables.forEach((predefinedVariable) => {
1442
1420
  // Don't include disabled variables
1443
- if (predefinedProfile.disabledVariables?.includes(sdkVariable.name)) {
1421
+ if (predefinedProfile.disabledVariables?.includes(predefinedVariable.name)) {
1444
1422
  return;
1445
1423
  }
1446
- // Try to get a definition from the predefined profile.
1447
- const definition = predefinedProfile.definitions[sdkVariable.name];
1424
+ // Try to get a definition from the predefined profile, for the variable that needs one.
1425
+ const definition = predefinedProfile.definitions[predefinedVariable.name];
1448
1426
  // Note: Something is weird with TS. The sdkVariables are being casted to the wrong type
1449
1427
  // despite the type checking from the switch statement.
1450
- switch (sdkVariable.type) {
1451
- case "dictionary":
1428
+ switch (predefinedVariable.type) {
1429
+ case "dictionary": {
1452
1430
  // For dictionary, we support properties overrride
1453
1431
  return editorProfile.variables.push(convertApiVariable({
1454
- ...sdkVariable,
1455
- type: sdkVariable.type,
1456
- properties: Array.isArray(definition) ? [...definition] : sdkVariable.properties
1432
+ ...predefinedVariable,
1433
+ type: predefinedVariable.type,
1434
+ properties: Array.isArray(definition) ? [...definition] : predefinedVariable.properties,
1457
1435
  }));
1436
+ }
1458
1437
  case "feature":
1459
- if (isFeatureDefinition(definition)) {
1460
- return editorProfile.variables.push({ ...sdkVariable, type: sdkVariable.type, definition });
1438
+ // If the definition is not valid, then we don't include it.
1439
+ if (!isFeatureDefinition(definition)) {
1440
+ return;
1461
1441
  }
1462
- return editorProfile.variables.push({ ...sdkVariable, type: sdkVariable.type });
1442
+ return editorProfile.variables.push({ ...predefinedVariable, type: predefinedVariable.type, definition });
1463
1443
  case "featureSet":
1464
- if (isFeatureSetDefinition(definition)) {
1465
- return editorProfile.variables.push({ ...sdkVariable, type: sdkVariable.type, definition });
1444
+ // If the definition is not valid, then we don't include it.
1445
+ if (!isFeatureSetDefinition(definition)) {
1446
+ return;
1466
1447
  }
1467
- return editorProfile.variables.push({ ...sdkVariable, type: sdkVariable.type });
1448
+ return editorProfile.variables.push({ ...predefinedVariable, type: predefinedVariable.type, definition });
1468
1449
  case "featureSetCollection":
1469
- if (isFeatureSetCollectionDefinition(definition)) {
1470
- return editorProfile.variables.push({ ...sdkVariable, type: sdkVariable.type, definition });
1450
+ // If the definition is not valid, then we don't include it.
1451
+ if (!isFeatureSetCollectionDefinition(definition)) {
1452
+ return;
1471
1453
  }
1472
- return editorProfile.variables.push({ ...sdkVariable, type: sdkVariable.type });
1454
+ return editorProfile.variables.push({ ...predefinedVariable, type: predefinedVariable.type, definition });
1473
1455
  default:
1474
- return editorProfile.variables.push(convertApiVariable(sdkVariable));
1456
+ return editorProfile.variables.push(convertApiVariable(predefinedVariable));
1475
1457
  }
1476
1458
  });
1477
1459
  if (isExtendedPredefinedProfileDefinition(predefinedProfile)) {
@@ -1482,7 +1464,7 @@ async function convertToEditorProfileDefinition(predefinedProfile, locale = "en"
1482
1464
 
1483
1465
  const arcadeLanguageId = "arcade";
1484
1466
  const defaultContext = {
1485
- locale: "en"
1467
+ locale: "en",
1486
1468
  };
1487
1469
  class ArcadeLanguageServiceDefaults {
1488
1470
  constructor() {
@@ -1536,7 +1518,7 @@ class ArcadeLanguageServiceDefaults {
1536
1518
  if (isPredefinedProfile(definition)) {
1537
1519
  definition = await convertToEditorProfileDefinition(definition, apiContext.locale);
1538
1520
  }
1539
- const intlStrings = await v(apiContext.locale, getAssetPath("./assets/arcade-language/t9n"), "profile.t9n.");
1521
+ const intlStrings = await fetchT9NStringsBundle(apiContext.locale, getAssetPath("./assets/arcade-language/t9n"), "profile.t9n.");
1540
1522
  if (!intlStrings) {
1541
1523
  throw new Error(`Failed to load the language bundle for ${apiContext.locale}`);
1542
1524
  }
@@ -1548,7 +1530,7 @@ class ArcadeLanguageServiceDefaults {
1548
1530
  this.updateApiContextForModel(modelId, {
1549
1531
  locale: apiContext.locale,
1550
1532
  profile: apiProfile,
1551
- snippets: apiContext.snippets
1533
+ snippets: apiContext.snippets,
1552
1534
  });
1553
1535
  }
1554
1536
  /**
@@ -1615,7 +1597,7 @@ class ArcadeLanguageServiceDefaults {
1615
1597
  }
1616
1598
  const arcadeDefaults = new ArcadeLanguageServiceDefaults();
1617
1599
  const arcade = {
1618
- setProfileForModel: arcadeDefaults.setProfileForModel.bind(arcadeDefaults)
1600
+ setProfileForModel: arcadeDefaults.setProfileForModel.bind(arcadeDefaults),
1619
1601
  };
1620
1602
 
1621
1603
  export { arcade as a, arcadeDefaults as b };