@arcgis/coding-components 4.29.0-beta.99 → 4.29.0

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 (164) hide show
  1. package/dist/arcgis-coding-components/arcgis-coding-components.esm.js +2 -2
  2. package/dist/arcgis-coding-components/assets/arcade-language/api/arcade-api.t9n.ar.json +111 -111
  3. package/dist/arcgis-coding-components/assets/arcade-language/api/arcade-api.t9n.bg.json +113 -113
  4. package/dist/arcgis-coding-components/assets/arcade-language/api/arcade-api.t9n.bs.json +111 -111
  5. package/dist/arcgis-coding-components/assets/arcade-language/api/arcade-api.t9n.ca.json +111 -111
  6. package/dist/arcgis-coding-components/assets/arcade-language/api/arcade-api.t9n.cs.json +111 -111
  7. package/dist/arcgis-coding-components/assets/arcade-language/api/arcade-api.t9n.da.json +111 -111
  8. package/dist/arcgis-coding-components/assets/arcade-language/api/arcade-api.t9n.de.json +111 -111
  9. package/dist/arcgis-coding-components/assets/arcade-language/api/arcade-api.t9n.el.json +111 -111
  10. package/dist/arcgis-coding-components/assets/arcade-language/api/arcade-api.t9n.en.json +19 -19
  11. package/dist/arcgis-coding-components/assets/arcade-language/api/arcade-api.t9n.es.json +111 -111
  12. package/dist/arcgis-coding-components/assets/arcade-language/api/arcade-api.t9n.et.json +111 -111
  13. package/dist/arcgis-coding-components/assets/arcade-language/api/arcade-api.t9n.fi.json +111 -111
  14. package/dist/arcgis-coding-components/assets/arcade-language/api/arcade-api.t9n.fr.json +111 -111
  15. package/dist/arcgis-coding-components/assets/arcade-language/api/arcade-api.t9n.he.json +111 -111
  16. package/dist/arcgis-coding-components/assets/arcade-language/api/arcade-api.t9n.hr.json +111 -111
  17. package/dist/arcgis-coding-components/assets/arcade-language/api/arcade-api.t9n.hu.json +111 -111
  18. package/dist/arcgis-coding-components/assets/arcade-language/api/arcade-api.t9n.id.json +111 -111
  19. package/dist/arcgis-coding-components/assets/arcade-language/api/arcade-api.t9n.it.json +111 -111
  20. package/dist/arcgis-coding-components/assets/arcade-language/api/arcade-api.t9n.ja.json +111 -111
  21. package/dist/arcgis-coding-components/assets/arcade-language/api/arcade-api.t9n.ko.json +111 -111
  22. package/dist/arcgis-coding-components/assets/arcade-language/api/arcade-api.t9n.lt.json +111 -111
  23. package/dist/arcgis-coding-components/assets/arcade-language/api/arcade-api.t9n.lv.json +111 -111
  24. package/dist/arcgis-coding-components/assets/arcade-language/api/arcade-api.t9n.nb.json +111 -111
  25. package/dist/arcgis-coding-components/assets/arcade-language/api/arcade-api.t9n.nl.json +66 -66
  26. package/dist/arcgis-coding-components/assets/arcade-language/api/arcade-api.t9n.pl.json +66 -66
  27. package/dist/arcgis-coding-components/assets/arcade-language/api/arcade-api.t9n.pt-BR.json +111 -111
  28. package/dist/arcgis-coding-components/assets/arcade-language/api/arcade-api.t9n.pt-PT.json +111 -111
  29. package/dist/arcgis-coding-components/assets/arcade-language/api/arcade-api.t9n.ro.json +66 -66
  30. package/dist/arcgis-coding-components/assets/arcade-language/api/arcade-api.t9n.ru.json +111 -111
  31. package/dist/arcgis-coding-components/assets/arcade-language/api/arcade-api.t9n.sk.json +111 -111
  32. package/dist/arcgis-coding-components/assets/arcade-language/api/arcade-api.t9n.sl.json +111 -111
  33. package/dist/arcgis-coding-components/assets/arcade-language/api/arcade-api.t9n.sr.json +111 -111
  34. package/dist/arcgis-coding-components/assets/arcade-language/api/arcade-api.t9n.sv.json +111 -111
  35. package/dist/arcgis-coding-components/assets/arcade-language/api/arcade-api.t9n.th.json +111 -111
  36. package/dist/arcgis-coding-components/assets/arcade-language/api/arcade-api.t9n.tr.json +111 -111
  37. package/dist/arcgis-coding-components/assets/arcade-language/api/arcade-api.t9n.uk.json +111 -111
  38. package/dist/arcgis-coding-components/assets/arcade-language/api/arcade-api.t9n.vi.json +111 -111
  39. package/dist/arcgis-coding-components/assets/arcade-language/api/arcade-api.t9n.zh-CN.json +66 -66
  40. package/dist/arcgis-coding-components/assets/arcade-language/api/arcade-api.t9n.zh-HK.json +66 -66
  41. package/dist/arcgis-coding-components/assets/arcade-language/api/arcade-api.t9n.zh-TW.json +66 -66
  42. package/dist/arcgis-coding-components/assets/arcade-language/profiles/arcade-profiles.t9n.ar.json +4 -4
  43. package/dist/arcgis-coding-components/assets/arcade-language/profiles/arcade-profiles.t9n.bg.json +4 -4
  44. package/dist/arcgis-coding-components/assets/arcade-language/profiles/arcade-profiles.t9n.bs.json +4 -4
  45. package/dist/arcgis-coding-components/assets/arcade-language/profiles/arcade-profiles.t9n.ca.json +4 -4
  46. package/dist/arcgis-coding-components/assets/arcade-language/profiles/arcade-profiles.t9n.cs.json +4 -4
  47. package/dist/arcgis-coding-components/assets/arcade-language/profiles/arcade-profiles.t9n.da.json +3 -3
  48. package/dist/arcgis-coding-components/assets/arcade-language/profiles/arcade-profiles.t9n.de.json +3 -3
  49. package/dist/arcgis-coding-components/assets/arcade-language/profiles/arcade-profiles.t9n.el.json +4 -4
  50. package/dist/arcgis-coding-components/assets/arcade-language/profiles/arcade-profiles.t9n.en.json +3 -3
  51. package/dist/arcgis-coding-components/assets/arcade-language/profiles/arcade-profiles.t9n.es.json +4 -4
  52. package/dist/arcgis-coding-components/assets/arcade-language/profiles/arcade-profiles.t9n.et.json +3 -3
  53. package/dist/arcgis-coding-components/assets/arcade-language/profiles/arcade-profiles.t9n.fi.json +4 -4
  54. package/dist/arcgis-coding-components/assets/arcade-language/profiles/arcade-profiles.t9n.fr.json +4 -4
  55. package/dist/arcgis-coding-components/assets/arcade-language/profiles/arcade-profiles.t9n.he.json +4 -4
  56. package/dist/arcgis-coding-components/assets/arcade-language/profiles/arcade-profiles.t9n.hr.json +4 -4
  57. package/dist/arcgis-coding-components/assets/arcade-language/profiles/arcade-profiles.t9n.hu.json +4 -4
  58. package/dist/arcgis-coding-components/assets/arcade-language/profiles/arcade-profiles.t9n.id.json +4 -4
  59. package/dist/arcgis-coding-components/assets/arcade-language/profiles/arcade-profiles.t9n.it.json +4 -4
  60. package/dist/arcgis-coding-components/assets/arcade-language/profiles/arcade-profiles.t9n.ja.json +4 -4
  61. package/dist/arcgis-coding-components/assets/arcade-language/profiles/arcade-profiles.t9n.ko.json +4 -4
  62. package/dist/arcgis-coding-components/assets/arcade-language/profiles/arcade-profiles.t9n.lt.json +4 -4
  63. package/dist/arcgis-coding-components/assets/arcade-language/profiles/arcade-profiles.t9n.lv.json +4 -4
  64. package/dist/arcgis-coding-components/assets/arcade-language/profiles/arcade-profiles.t9n.nb.json +4 -4
  65. package/dist/arcgis-coding-components/assets/arcade-language/profiles/arcade-profiles.t9n.nl.json +4 -4
  66. package/dist/arcgis-coding-components/assets/arcade-language/profiles/arcade-profiles.t9n.pl.json +4 -4
  67. package/dist/arcgis-coding-components/assets/arcade-language/profiles/arcade-profiles.t9n.pt-BR.json +4 -4
  68. package/dist/arcgis-coding-components/assets/arcade-language/profiles/arcade-profiles.t9n.pt-PT.json +4 -4
  69. package/dist/arcgis-coding-components/assets/arcade-language/profiles/arcade-profiles.t9n.ro.json +4 -4
  70. package/dist/arcgis-coding-components/assets/arcade-language/profiles/arcade-profiles.t9n.ru.json +3 -3
  71. package/dist/arcgis-coding-components/assets/arcade-language/profiles/arcade-profiles.t9n.sk.json +4 -4
  72. package/dist/arcgis-coding-components/assets/arcade-language/profiles/arcade-profiles.t9n.sl.json +4 -4
  73. package/dist/arcgis-coding-components/assets/arcade-language/profiles/arcade-profiles.t9n.sr.json +4 -4
  74. package/dist/arcgis-coding-components/assets/arcade-language/profiles/arcade-profiles.t9n.sv.json +4 -4
  75. package/dist/arcgis-coding-components/assets/arcade-language/profiles/arcade-profiles.t9n.th.json +4 -4
  76. package/dist/arcgis-coding-components/assets/arcade-language/profiles/arcade-profiles.t9n.tr.json +4 -4
  77. package/dist/arcgis-coding-components/assets/arcade-language/profiles/arcade-profiles.t9n.uk.json +4 -4
  78. package/dist/arcgis-coding-components/assets/arcade-language/profiles/arcade-profiles.t9n.vi.json +4 -4
  79. package/dist/arcgis-coding-components/assets/arcade-language/profiles/arcade-profiles.t9n.zh-CN.json +4 -4
  80. package/dist/arcgis-coding-components/assets/arcade-language/profiles/arcade-profiles.t9n.zh-HK.json +4 -4
  81. package/dist/arcgis-coding-components/assets/arcade-language/profiles/arcade-profiles.t9n.zh-TW.json +4 -4
  82. package/dist/arcgis-coding-components/index.esm.js +2 -2
  83. package/dist/arcgis-coding-components/{p-e1cb02b3.js → p-0a2edf01.js} +2 -2
  84. package/dist/arcgis-coding-components/p-11e79992.js +6 -0
  85. package/dist/arcgis-coding-components/{p-f75beb80.js → p-36e2cbc2.js} +3 -3
  86. package/dist/arcgis-coding-components/{p-457e3916.js → p-4406b5a8.js} +2 -2
  87. package/dist/arcgis-coding-components/{p-87d7ad9e.js → p-4eb30e60.js} +1 -1
  88. package/dist/arcgis-coding-components/{p-7f9d3fdc.js → p-619ca372.js} +1 -1
  89. package/dist/arcgis-coding-components/{p-7e0e8ecc.js → p-71125c69.js} +2 -2
  90. package/dist/arcgis-coding-components/{p-0bab0228.js → p-8d7f0979.js} +2 -2
  91. package/dist/arcgis-coding-components/p-9b8091c1.entry.js +6 -0
  92. package/dist/arcgis-coding-components/{p-ad86a5f5.js → p-bd81fdff.js} +11 -11
  93. package/dist/arcgis-coding-components/{p-f23f7fee.js → p-ecc8dd8a.js} +2 -2
  94. package/dist/arcgis-coding-components/{p-4648782b.js → p-f9016c56.js} +2 -2
  95. package/dist/cjs/{arcade-defaults-5dd9ebb7.js → arcade-defaults-b30ccec8.js} +271 -236
  96. package/dist/cjs/{arcade-mode-0b4c53a1.js → arcade-mode-eb755260.js} +11 -14
  97. package/dist/cjs/arcgis-arcade-api_6.cjs.entry.js +160 -184
  98. package/dist/cjs/arcgis-coding-components.cjs.js +3 -3
  99. package/dist/cjs/{css-fe7f8980.js → css-9e907aa0.js} +1 -1
  100. package/dist/cjs/{cssMode-4c9b3a32.js → cssMode-e4189b13.js} +3 -3
  101. package/dist/cjs/{html-b044fbba.js → html-2582ae43.js} +3 -3
  102. package/dist/cjs/{htmlMode-956a6ffa.js → htmlMode-0edcf1ee.js} +3 -3
  103. package/dist/cjs/{index-aaceaf1f.js → index-54d6f9be.js} +1 -1
  104. package/dist/cjs/index.cjs.js +3 -3
  105. package/dist/cjs/{javascript-6c55ac8b.js → javascript-425c653a.js} +4 -4
  106. package/dist/cjs/{jsonMode-d83e322c.js → jsonMode-eea03515.js} +3 -3
  107. package/dist/cjs/loader.cjs.js +3 -3
  108. package/dist/cjs/{tsMode-5c5ffa3e.js → tsMode-b92c9221.js} +3 -3
  109. package/dist/cjs/{typescript-6143656a.js → typescript-cfc1221c.js} +3 -3
  110. package/dist/components/arcade-api.js +20 -18
  111. package/dist/components/arcade-contribution.js +9 -8
  112. package/dist/components/arcade-defaults.js +188 -168
  113. package/dist/components/arcade-mode.js +10 -12
  114. package/dist/components/arcade-results.js +29 -83
  115. package/dist/components/arcade-suggestions.js +15 -12
  116. package/dist/components/arcade-variables.js +30 -21
  117. package/dist/components/arcgis-arcade-api.js +1 -1
  118. package/dist/components/arcgis-arcade-editor.js +61 -49
  119. package/dist/components/arcgis-arcade-results.js +1 -1
  120. package/dist/components/arcgis-arcade-suggestions.js +1 -1
  121. package/dist/components/arcgis-arcade-variables.js +1 -1
  122. package/dist/components/arcgis-code-editor.js +1 -1
  123. package/dist/components/code-editor.js +1 -1
  124. package/dist/components/fields.js +37 -23
  125. package/dist/components/index.js +1 -1
  126. package/dist/components/index2.js +3 -3
  127. package/dist/components/markdown.js +10 -1
  128. package/dist/components/utilities.js +4 -4
  129. package/dist/esm/{arcade-defaults-2d7283d4.js → arcade-defaults-a5dc6132.js} +267 -233
  130. package/dist/esm/{arcade-mode-a8abe5af.js → arcade-mode-d06b6e4f.js} +11 -14
  131. package/dist/esm/arcgis-arcade-api_6.entry.js +160 -184
  132. package/dist/esm/arcgis-coding-components.js +4 -4
  133. package/dist/esm/{css-d31a02ca.js → css-59b4804d.js} +1 -1
  134. package/dist/esm/{cssMode-5ee45e91.js → cssMode-2bce7da7.js} +3 -3
  135. package/dist/esm/{html-5c2e488c.js → html-3ad47fc0.js} +3 -3
  136. package/dist/esm/{htmlMode-376cd5e8.js → htmlMode-6cb73c91.js} +3 -3
  137. package/dist/esm/{index-1b265749.js → index-ee54d182.js} +1 -1
  138. package/dist/esm/index.js +3 -3
  139. package/dist/esm/{javascript-13ddec2b.js → javascript-8917f926.js} +4 -4
  140. package/dist/esm/{jsonMode-674e89d6.js → jsonMode-9a1dbf00.js} +3 -3
  141. package/dist/esm/loader.js +4 -4
  142. package/dist/esm/{tsMode-4c4398d7.js → tsMode-2caf1509.js} +3 -3
  143. package/dist/esm/{typescript-b328b622.js → typescript-a3abccc0.js} +3 -3
  144. package/dist/loader/cdn.js +1 -1
  145. package/dist/loader/index.cjs.js +1 -1
  146. package/dist/loader/index.es2017.js +1 -1
  147. package/dist/loader/index.js +1 -1
  148. package/dist/types/components/arcade-editor/arcade-editor.d.ts +2 -7
  149. package/dist/types/components/arcade-variables/arcade-variables.d.ts +0 -1
  150. package/dist/types/components.d.ts +2 -7
  151. package/dist/types/utils/arcade-monaco/arcade-contribution.d.ts +2 -2
  152. package/dist/types/utils/arcade-monaco/arcade-theme.d.ts +1 -0
  153. package/dist/types/utils/constants.d.ts +2 -2
  154. package/dist/types/utils/fields.d.ts +1 -0
  155. package/dist/types/utils/markdown.d.ts +3 -0
  156. package/dist/types/utils/profile/editor-profile.d.ts +49 -63
  157. package/dist/types/utils/profile/types.d.ts +122 -1
  158. package/dist/types/utils/profile/utils.d.ts +22 -9
  159. package/package.json +8 -8
  160. package/dist/arcgis-coding-components/p-6d56a4b8.entry.js +0 -6
  161. package/dist/arcgis-coding-components/p-a75f5087.js +0 -6
  162. package/dist/components/functional-components.js +0 -15
  163. package/dist/types/utils/functional-components.d.ts +0 -7
  164. package/dist/types/utils/json-format.d.ts +0 -1
@@ -1,28 +1,23 @@
1
1
  /*!
2
2
  * All material copyright Esri, All Rights Reserved, unless otherwise specified.
3
3
  * See https://js.arcgis.com/4.29/esri/copyright.txt for details.
4
- * v4.29.0-beta.99
4
+ * v4.29.0
5
5
  */
6
6
  import { Emitter, Uri } from 'monaco-editor';
7
7
  import { InsertTextMode, InsertTextFormat, CompletionItemKind } from 'vscode-languageserver-types';
8
- import { i as importPortalPortalItem, a as importLayersFeatureLayer, b as importWebMap, s as supportedFields, n as newWebScene, c as importRequest, f as fieldTypeToIconName, d as fieldTypeToArcadeType } from './fields.js';
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';
9
9
  import { p as portalItemPageUrl } from './utilities.js';
10
- import { Y, e as ee, Z, K, E, N } from './index2.js';
10
+ import { e as ee, t as te, G, Z, E, v } from './index2.js';
11
11
  import { getAssetPath } from '@stencil/core/internal/client';
12
12
 
13
- async function newPortalItem(definition) {
14
- const PortalItem = await importPortalPortalItem();
15
- return new PortalItem(definition);
16
- }
13
+ //#region core adapter fix
17
14
  async function newFeatureLayer(definition) {
18
15
  const FeatureLayer = await importLayersFeatureLayer();
19
16
  // Fix title for the layer. Instead of defaulting to the map viewer style.
20
17
  return new FeatureLayer({ ...definition, sublayerTitleMode: "service-name" });
21
18
  }
22
- async function newWebMap(definition) {
23
- const WebMap = await importWebMap();
24
- return new WebMap(definition);
25
- }
19
+ //#endregion
20
+ //#region Type Guards
26
21
  function isSupportedLayerInstance(item) {
27
22
  return (!!item &&
28
23
  typeof item === "object" &&
@@ -107,7 +102,6 @@ function isPredefinedProfile(item) {
107
102
  typeof item.definitions === "object" &&
108
103
  !Array.isArray(item.definitions));
109
104
  }
110
-
111
105
  function isTitleCapableSource(item) {
112
106
  return !!item && typeof item === "object" && "title" in item && typeof item.title === "string";
113
107
  }
@@ -143,7 +137,54 @@ function isLoadableSource(item) {
143
137
  return !!item && typeof item === "object" && "load" in item && typeof item.load === "function";
144
138
  }
145
139
  //#endregion
146
- //#region Support Functions
140
+ //#region Service Metadata
141
+ async function supportedSourceFromDefinition(definition) {
142
+ if (!definition) {
143
+ return null;
144
+ }
145
+ let source = null;
146
+ if (isSupportedLayerInstance(definition) || isFeatureSetInstance(definition) || isFieldsDefinition(definition)) {
147
+ source = definition;
148
+ }
149
+ else {
150
+ source = await newFeatureLayer(definition);
151
+ }
152
+ if (isLoadableSource(source)) {
153
+ await source.load();
154
+ }
155
+ return source;
156
+ }
157
+ async function serviceMetaData(url) {
158
+ url += "/layers";
159
+ const request = await importRequest();
160
+ const response = await request(url, { responseType: "json", query: { f: "json" } });
161
+ const data = {
162
+ layers: response.data?.layers ?? [],
163
+ tables: response.data?.tables ?? []
164
+ };
165
+ const queryCapability = url.endsWith("MapServer/layers") ? "data" : "query";
166
+ const layers = filterFeatureLayerInfos(data.layers, queryCapability);
167
+ const tables = filterFeatureLayerInfos(data.tables, queryCapability);
168
+ return { layers, tables };
169
+ }
170
+ function filterFeatureLayerInfos(layers, queryCapability) {
171
+ return layers.filter((layer) => {
172
+ if (layer.type !== "Feature Layer" && layer.type !== "Table") {
173
+ return false;
174
+ }
175
+ const capabilities = layer.capabilities
176
+ ? layer.capabilities
177
+ .toLowerCase()
178
+ .split(",")
179
+ .map((value) => value.trim())
180
+ : [];
181
+ return capabilities.includes(queryCapability);
182
+ });
183
+ }
184
+ //#endregion
185
+
186
+ //#endregion
187
+ //#region Support functions
147
188
  async function getRelatedFeatureLayer(layer, relationship) {
148
189
  const relatedFeatureLayer = await newFeatureLayer({ url: `${layer.url}/${relationship.relatedTableId}` });
149
190
  await relatedFeatureLayer.load();
@@ -184,66 +225,8 @@ function sortFields(layer) {
184
225
  return firstField.name.localeCompare(secondField.name, "en", { sensitivity: "base" });
185
226
  };
186
227
  }
187
- function getTypeOrSubtypeDomainGroup(profile, types, field) {
188
- // Try the coded domain first
189
- if (isCodedValueDomainInstance(field.domain)) {
190
- return getCodedValueDomainGroup(profile, field.domain, { code: "subtypes" });
191
- }
192
- // No coded domain, we will manufacture it
193
- const values = types?.map((t) => {
194
- const label = isSubtypeInstance(t) ? t.code : t.id;
195
- return new ValueVariable({ profile, label: `${label}`, description: t.name, snippet: `"${label}"` });
196
- }) ?? [];
197
- return new GroupOfVariables(profile, { code: "subtypes" }, values);
198
- }
199
- function getCodedValueDomainGroup(profile, domain, label) {
200
- const values = domain.codedValues.map((v) => new ValueVariable({
201
- profile,
202
- label: `${v.code}`,
203
- description: v.name,
204
- snippet: `"${v.code}"`,
205
- filterDescription: true
206
- }));
207
- return new GroupOfVariables(profile, label, values);
208
- }
209
- function getDomainValuesGroup(profile, types, field) {
210
- const variables = [];
211
- if (!types || types.length === 0) {
212
- return null;
213
- }
214
- types.forEach((type) => {
215
- let domain = type.domains[field.name];
216
- if (!domain) {
217
- return;
218
- }
219
- if (isInheritedDomainInstance(domain)) {
220
- domain = field.domain;
221
- return;
222
- }
223
- if (!isCodedValueDomainInstance(domain)) {
224
- return;
225
- }
226
- const domainValuesGroup = getCodedValueDomainGroup(profile, domain, {
227
- code: "domainvaluesfortypeformat",
228
- formatValues: {
229
- fieldName: field.alias ?? field.name,
230
- typeName: type.name
231
- }
232
- });
233
- const id = isSubtypeInstance(type) ? type.code : type.id;
234
- const label = `${id}`;
235
- const snippet = `"${id}""`;
236
- const subtypeDictionary = new DictionaryVariable({ profile, label, snippet });
237
- subtypeDictionary.variables = [domainValuesGroup];
238
- variables.push(subtypeDictionary);
239
- });
240
- if (!variables.length) {
241
- return null;
242
- }
243
- return new GroupOfVariables(profile, { code: "domainvaluesbysubtypes" }, variables);
244
- }
245
228
  function areAllDomainsInherited(types, field) {
246
- return types?.every((type) => type.domains[field.name]?.type === "inherited") ?? false;
229
+ return types?.every((type) => type.domains?.[field.name]?.type === "inherited") ?? false;
247
230
  }
248
231
  // const validIdentifierExpr = new RegExp(/^[a-z_$][\w$]*$/gi);
249
232
  const validIdentifierExpr = /^[a-z_$][a-z0-9_$]*$/giu;
@@ -260,52 +243,7 @@ function assembleMemberExpression(obj, prop) {
260
243
  return `${obj}${getMemberExpressionProperty(prop)}`;
261
244
  }
262
245
  //#endregion
263
- //#region Sources
264
- async function supportedSourceFromDefinition(definition) {
265
- if (!definition) {
266
- return null;
267
- }
268
- let source = null;
269
- if (isSupportedLayerInstance(definition) || isFeatureSetInstance(definition) || isFieldsDefinition(definition)) {
270
- source = definition;
271
- }
272
- else {
273
- source = await newFeatureLayer(definition);
274
- }
275
- if (isLoadableSource(source)) {
276
- await source.load();
277
- }
278
- return source;
279
- }
280
- async function serviceMetaData(url) {
281
- url += "/layers";
282
- const request = await importRequest();
283
- const response = await request(url, { responseType: "json", query: { f: "json" } });
284
- const data = {
285
- layers: response.data?.layers ?? [],
286
- tables: response.data?.tables ?? []
287
- };
288
- const queryCapability = url.endsWith("MapServer/layers") ? "data" : "query";
289
- const layers = filterFeatureLayerInfos(data.layers, queryCapability);
290
- const tables = filterFeatureLayerInfos(data.tables, queryCapability);
291
- return { layers, tables };
292
- }
293
- function filterFeatureLayerInfos(layers, queryCapability) {
294
- return layers.filter((layer) => {
295
- if (layer.type !== "Feature Layer" && layer.type !== "Table") {
296
- return false;
297
- }
298
- const capabilities = layer.capabilities
299
- ? layer.capabilities
300
- .toLowerCase()
301
- .split(",")
302
- .map((value) => value.trim())
303
- : [];
304
- return capabilities.includes(queryCapability);
305
- });
306
- }
307
- //#endregion
308
- //#region Functions to Editor Variables to a language service variables
246
+ //#region Editor Profile to Language Service Profile functions
309
247
  async function variablesToLSVariable(editorVariables, kind = CompletionItemKind.Variable) {
310
248
  return await Promise.all(editorVariables.map(async (editorVariable) => {
311
249
  switch (editorVariable.type) {
@@ -373,20 +311,21 @@ async function featureToLSFeature(editorFeature, kind) {
373
311
  if (featureCompletionDescription) {
374
312
  featureCompletionDescription += " \n \n";
375
313
  }
376
- featureCompletionDescription += `**${field.name}** (${field.alias ?? field.name}) \n${field.type}`;
314
+ featureCompletionDescription += `**${field.name}** (${fieldAlias(field)}) \n${field.type}`;
377
315
  if (field.description) {
378
316
  featureCompletionDescription += ` \n'${field.description}`;
379
317
  }
380
318
  // The property for the field
381
319
  const type = fieldTypeToArcadeType(field);
382
320
  const insertText = getMemberExpressionProperty(field.name, false);
321
+ const description = fieldAlias(field);
383
322
  fieldProfileValues.push({
384
323
  name: field.name,
385
- description: field.alias || field.name,
324
+ description,
386
325
  type,
387
326
  completion: {
388
327
  label: field.name,
389
- detail: field.alias || field.name,
328
+ detail: description,
390
329
  insertText,
391
330
  insertTextMode: InsertTextMode.asIs,
392
331
  insertTextFormat: InsertTextFormat.PlainText,
@@ -475,9 +414,9 @@ class ProfileItemBase {
475
414
  // If the component is under RTL, the string is messed up.
476
415
  // It is converted from $feature to feature$, This is not acceptable since the label
477
416
  // represents a variable name. We are adding in front of the $ sign a right to left mark.
478
- return Z(this._label);
417
+ return G(this._label);
479
418
  }
480
- return K(this._profile?.intlStrings[this._label.code], this._label.formatValues);
419
+ return Z(this._profile?.intlStrings[this._label.code], this._label.formatValues);
481
420
  }
482
421
  /**
483
422
  * Returns the description string.
@@ -489,7 +428,7 @@ class ProfileItemBase {
489
428
  if (typeof this.description === "string") {
490
429
  return this.description;
491
430
  }
492
- return K(this._profile?.intlStrings[this.description.code], this.description.formatValues);
431
+ return Z(this._profile?.intlStrings[this.description.code], this.description.formatValues);
493
432
  }
494
433
  /**
495
434
  * Returns true if the item pass the filter test
@@ -566,8 +505,9 @@ class ArrayVariable extends VariableBase {
566
505
  * collection is ready or not.
567
506
  */
568
507
  class CollectionBasedVariable extends VariableBase {
569
- constructor() {
570
- super(...arguments);
508
+ constructor(owner, props) {
509
+ super(props);
510
+ this.owner = owner;
571
511
  this.isCollection = true;
572
512
  this._loaded = true;
573
513
  /**
@@ -577,19 +517,21 @@ class CollectionBasedVariable extends VariableBase {
577
517
  */
578
518
  this.variables = [];
579
519
  }
520
+ get breadcrumb() {
521
+ // If there's an owner, prepend its breadcrumb and append the current name
522
+ if (this.owner) {
523
+ const ownerBreadcrumb = this.owner.breadcrumb;
524
+ return ownerBreadcrumb ? `${ownerBreadcrumb} / ${this.name}` : this.name;
525
+ }
526
+ // If there's no owner, this is the root element, so just return its name
527
+ return this.name;
528
+ }
580
529
  /**
581
530
  * Returns true if the collection has been loaded
582
531
  */
583
532
  get loaded() {
584
533
  return this._loaded;
585
534
  }
586
- /**
587
- * Loads the items if the collection is asynchronous.
588
- * If the colleciton is synchronous then the function is a no-op.
589
- */
590
- async loadSource() {
591
- return;
592
- }
593
535
  /**
594
536
  * Returns an url to the associated information
595
537
  */
@@ -612,8 +554,8 @@ class GroupOfVariables extends ProfileItemBase {
612
554
  }
613
555
  }
614
556
  class DictionaryVariable extends CollectionBasedVariable {
615
- constructor(props) {
616
- super(props);
557
+ constructor(owner, props) {
558
+ super(owner, props);
617
559
  this.type = "dictionary";
618
560
  /**
619
561
  * The variables that the dictionary holds. It is different than the variables.
@@ -627,6 +569,9 @@ class DictionaryVariable extends CollectionBasedVariable {
627
569
  this.variables = [new GroupOfVariables(this._profile, this.snippet, this.dictionaryVariables)];
628
570
  }
629
571
  }
572
+ async loadSource() {
573
+ // No-op
574
+ }
630
575
  loadPropertyDeclarations(declarations) {
631
576
  this.dictionaryVariables = this.createVariableInstances(declarations);
632
577
  this.variables = this.dictionaryVariables;
@@ -651,23 +596,26 @@ class DictionaryVariable extends CollectionBasedVariable {
651
596
  case "text":
652
597
  case "boolean":
653
598
  case "date":
599
+ case "dateOnly":
600
+ case "time":
654
601
  case "geometry":
602
+ case "knowledgeGraph":
655
603
  return new ValueVariable({ profile: this._profile, declaration, label: snippet, snippet });
656
604
  case "feature":
657
- return new FeatureVariable({ profile: this._profile, declaration, label: snippet, snippet });
605
+ return new FeatureVariable(this, { profile: this._profile, declaration, label: snippet, snippet });
658
606
  case "featureSet":
659
- return new FeatureSetVariable({ profile: this._profile, declaration, label: snippet, snippet }, [
607
+ return new FeatureSetVariable(this, { profile: this._profile, declaration, label: snippet, snippet }, [
660
608
  new ValueVariable({ profile: this._profile, label: snippet, description: "", snippet })
661
609
  ]);
662
610
  case "featureSetCollection":
663
- return new FeatureSetCollectionVariable({
611
+ return new FeatureSetCollectionVariable(this, {
664
612
  profile: this._profile,
665
613
  declaration,
666
614
  label: snippet,
667
615
  snippet
668
616
  });
669
617
  case "dictionary":
670
- return new DictionaryVariable({
618
+ return new DictionaryVariable(this, {
671
619
  profile: this._profile,
672
620
  declaration,
673
621
  label: snippet,
@@ -681,7 +629,7 @@ class DictionaryVariable extends CollectionBasedVariable {
681
629
  snippet
682
630
  });
683
631
  default:
684
- console.error("Invalid profile variable", declaration);
632
+ console.error("Editor profile: Invalid profile variable", declaration);
685
633
  return null;
686
634
  }
687
635
  }
@@ -695,8 +643,8 @@ class DictionaryVariable extends CollectionBasedVariable {
695
643
  }
696
644
  }
697
645
  class SourceBasedVariable extends CollectionBasedVariable {
698
- constructor(props, relationshipsProperties) {
699
- super(props);
646
+ constructor(owner, props, relationshipsProperties) {
647
+ super(owner, props);
700
648
  this.relationshipsProperties = relationshipsProperties;
701
649
  this._source = null;
702
650
  this._loaded = false;
@@ -721,7 +669,7 @@ class SourceBasedVariable extends CollectionBasedVariable {
721
669
  return this._profile?.intlStrings.layer ?? "layer";
722
670
  }
723
671
  async loadSource() {
724
- if (Y(this._loadPromise) && ee(this._loadPromise)) {
672
+ if (ee(this._loadPromise) && te(this._loadPromise)) {
725
673
  return await this._loadPromise;
726
674
  }
727
675
  this._loadPromise = this._loadSource();
@@ -753,7 +701,7 @@ class SourceBasedVariable extends CollectionBasedVariable {
753
701
  return new ValueVariable({
754
702
  profile: this._profile,
755
703
  label: valueSnippet,
756
- description: field.alias ?? field.name,
704
+ description: fieldAlias(field),
757
705
  snippet: valueSnippet,
758
706
  icon: fieldTypeToIconName(field),
759
707
  filterDescription: true
@@ -795,7 +743,7 @@ class SourceBasedVariable extends CollectionBasedVariable {
795
743
  // Sepcial case for the subtype field
796
744
  if (field.name === this._source.subtypeField) {
797
745
  const domainDictionary = this._createDomainDictionary(field);
798
- domainDictionary.variables.push(getTypeOrSubtypeDomainGroup(this._profile, this._source.subtypes, field));
746
+ domainDictionary.variables.push(this._getTypeOrSubtypeDomainGroup(this._source.subtypes, field));
799
747
  return domainDictionary;
800
748
  }
801
749
  // Check if all the domains for the field in the types are inherited.
@@ -805,7 +753,7 @@ class SourceBasedVariable extends CollectionBasedVariable {
805
753
  }
806
754
  // We have domains per subtype
807
755
  // We need to go thru each types and create a dictionary.
808
- const domainValuesBySubtypeGroup = getDomainValuesGroup(this._profile, this._source.subtypes, field);
756
+ const domainValuesBySubtypeGroup = this._getDomainValuesGroup(this._source.subtypes, field);
809
757
  if (!domainValuesBySubtypeGroup) {
810
758
  return null;
811
759
  }
@@ -821,7 +769,7 @@ class SourceBasedVariable extends CollectionBasedVariable {
821
769
  // Special case for the type id field
822
770
  if (field.name === this._source.typeIdField) {
823
771
  const domainDictionary = this._createDomainDictionary(field);
824
- domainDictionary.variables.push(getTypeOrSubtypeDomainGroup(this._profile, this._source.types, field));
772
+ domainDictionary.variables.push(this._getTypeOrSubtypeDomainGroup(this._source.types, field));
825
773
  return domainDictionary;
826
774
  }
827
775
  // Check if all the domains for the field in the types are inherited.
@@ -831,7 +779,7 @@ class SourceBasedVariable extends CollectionBasedVariable {
831
779
  }
832
780
  // We have domains per feature type
833
781
  // We need to go thru each types and create a dictionary.
834
- const domainValuesByFeatureTypeGroup = getDomainValuesGroup(this._profile, this._source.types, field);
782
+ const domainValuesByFeatureTypeGroup = this._getDomainValuesGroup(this._source.types, field);
835
783
  if (!domainValuesByFeatureTypeGroup) {
836
784
  return null;
837
785
  }
@@ -848,27 +796,99 @@ class SourceBasedVariable extends CollectionBasedVariable {
848
796
  if (!isCodedValueDomainInstance(fieldDomain)) {
849
797
  return null;
850
798
  }
851
- const domainValuesGroup = getCodedValueDomainGroup(this._profile, fieldDomain, {
799
+ const domainValuesGroup = this._getCodedValueDomainGroup(fieldDomain, {
852
800
  code: "domainvalues"
853
801
  });
854
802
  const domainDictionary = this._createDomainDictionary(field);
855
803
  domainDictionary.variables.push(domainValuesGroup);
856
804
  return domainDictionary;
857
805
  }
806
+ _getTypeOrSubtypeDomainGroup(types, field) {
807
+ // Try the coded domain first
808
+ if (isCodedValueDomainInstance(field.domain)) {
809
+ return this._getCodedValueDomainGroup(field.domain, { code: "subtypes" });
810
+ }
811
+ // No coded domain, we will manufacture it
812
+ const values = types?.map((t) => {
813
+ const label = isSubtypeInstance(t) ? t.code : t.id;
814
+ return new ValueVariable({
815
+ profile: this._profile,
816
+ label: `${label}`,
817
+ description: t.name,
818
+ snippet: `"${label}"`
819
+ });
820
+ }) ?? [];
821
+ return new GroupOfVariables(this._profile, { code: "subtypes" }, values);
822
+ }
823
+ _getCodedValueDomainGroup(domain, label) {
824
+ const values = domain.codedValues.map((v) => new ValueVariable({
825
+ profile: this._profile,
826
+ label: `${v.code}`,
827
+ description: v.name,
828
+ snippet: `"${v.code}"`,
829
+ filterDescription: true
830
+ }));
831
+ return new GroupOfVariables(this._profile, label, values);
832
+ }
833
+ _getDomainValuesGroup(types, field) {
834
+ const variables = [];
835
+ if (!types || types.length === 0) {
836
+ return null;
837
+ }
838
+ types.forEach((type) => {
839
+ let domain = type.domains?.[field.name];
840
+ if (!domain) {
841
+ return;
842
+ }
843
+ if (isInheritedDomainInstance(domain)) {
844
+ domain = field.domain;
845
+ return;
846
+ }
847
+ if (!isCodedValueDomainInstance(domain)) {
848
+ return;
849
+ }
850
+ const alias = fieldAlias(field);
851
+ const domainValuesGroup = this._getCodedValueDomainGroup(domain, {
852
+ code: "domainvaluesfortypeformat",
853
+ formatValues: {
854
+ fieldName: alias,
855
+ typeName: type.name
856
+ }
857
+ });
858
+ const id = isSubtypeInstance(type) ? type.code : type.id;
859
+ const label = `${id}`;
860
+ const snippet = `"${id}""`;
861
+ const subtypeDictionary = new DictionaryVariable(this, {
862
+ profile: this._profile,
863
+ label,
864
+ snippet,
865
+ description: type.name,
866
+ declaration: { name: alias }
867
+ });
868
+ subtypeDictionary.variables = [domainValuesGroup];
869
+ variables.push(subtypeDictionary);
870
+ });
871
+ if (!variables.length) {
872
+ return null;
873
+ }
874
+ return new GroupOfVariables(this._profile, { code: "domainvaluesbysubtypes" }, variables);
875
+ }
858
876
  _createDomainDictionary(field) {
859
877
  // Create the domain dictionary.
860
878
  // The dictionary will have a header group and a value group.
861
879
  // At this point we are only creating the header group in the dictionary.
862
880
  const valueSnippet = this._getValueSnippet(field);
863
- const domainDictionary = new DictionaryVariable({
881
+ const alias = fieldAlias(field);
882
+ const domainDictionary = new DictionaryVariable(this, {
864
883
  profile: this._profile,
865
884
  label: valueSnippet,
866
- description: field.alias ?? field.name,
885
+ description: alias,
867
886
  snippet: valueSnippet,
868
- icon: "form-dropdown"
887
+ icon: "form-dropdown",
888
+ declaration: { name: field.name }
869
889
  });
870
890
  // Add the header group
871
- const headerGroup = new GroupOfVariables(this._profile, field.alias ?? field.name, [
891
+ const headerGroup = new GroupOfVariables(this._profile, alias, [
872
892
  new ValueVariable({
873
893
  profile: this._profile,
874
894
  label: valueSnippet,
@@ -909,7 +929,7 @@ class SourceBasedVariable extends CollectionBasedVariable {
909
929
  return null;
910
930
  }
911
931
  const snippet = `FeatureSetByRelationshipName(${this.snippet}, "${relationship.name}")`;
912
- return new FeatureSetVariable({
932
+ return new FeatureSetVariable(this, {
913
933
  profile: this._profile,
914
934
  declaration: { definition: relatedLayer },
915
935
  label: relatedLayer.title,
@@ -917,7 +937,7 @@ class SourceBasedVariable extends CollectionBasedVariable {
917
937
  nonInteractive: true
918
938
  }, [new ValueVariable({ profile: this._profile, label: snippet, description: "", snippet })], { exposeRelationships: true, sourceTableId: source.layerId });
919
939
  }));
920
- relationshipsGroup.variables = relationshipItems.filter(Y);
940
+ relationshipsGroup.variables = relationshipItems.filter(ee);
921
941
  if (!relationshipsGroup.variables.length) {
922
942
  return null;
923
943
  }
@@ -925,8 +945,8 @@ class SourceBasedVariable extends CollectionBasedVariable {
925
945
  }
926
946
  }
927
947
  class FeatureVariable extends SourceBasedVariable {
928
- constructor(props) {
929
- super(props, { exposeRelationships: true });
948
+ constructor(owner, props) {
949
+ super(owner, props, { exposeRelationships: true });
930
950
  this.type = "feature";
931
951
  }
932
952
  get title() {
@@ -994,11 +1014,11 @@ class FeatureVariable extends SourceBasedVariable {
994
1014
  }
995
1015
  }
996
1016
  class FeatureSetVariable extends SourceBasedVariable {
997
- constructor(props, featureSetSnippets = [],
1017
+ constructor(owner, props, featureSetSnippets = [],
998
1018
  // Relationships for feature set if only supported if the feature set is actually
999
1019
  // representing a relationsip feature layer for a feature source.
1000
1020
  relationshipProps) {
1001
- super(props, relationshipProps);
1021
+ super(owner, props, relationshipProps);
1002
1022
  this.featureSetSnippets = featureSetSnippets;
1003
1023
  this.type = "featureSet";
1004
1024
  }
@@ -1045,8 +1065,8 @@ class FeatureSetVariable extends SourceBasedVariable {
1045
1065
  }
1046
1066
  }
1047
1067
  class FeatureSetCollectionVariable extends CollectionBasedVariable {
1048
- constructor(props) {
1049
- super(props);
1068
+ constructor(owner, props) {
1069
+ super(owner, props);
1050
1070
  this.type = "featureSetCollection";
1051
1071
  this._featureSetCollections = null;
1052
1072
  this._loaded = false;
@@ -1075,7 +1095,7 @@ class FeatureSetCollectionVariable extends CollectionBasedVariable {
1075
1095
  return this._profile?.intlStrings.featureservice ?? "featureservice";
1076
1096
  }
1077
1097
  async loadSource() {
1078
- if (Y(this._loadPromise) && ee(this._loadPromise)) {
1098
+ if (ee(this._loadPromise) && te(this._loadPromise)) {
1079
1099
  return await this._loadPromise;
1080
1100
  }
1081
1101
  this._loadPromise = this._loadSource();
@@ -1096,7 +1116,7 @@ class FeatureSetCollectionVariable extends CollectionBasedVariable {
1096
1116
  : {
1097
1117
  code: "webmapformat",
1098
1118
  formatValues: {
1099
- webMapTitle: this._featureSetCollections.source.portalItem.title || "Untitled map"
1119
+ webMapTitle: this._featureSetCollections.source.portalItem?.title || "Untitled map"
1100
1120
  }
1101
1121
  };
1102
1122
  const headerGroup = new GroupOfVariables(this._profile, groupLabel, [
@@ -1154,7 +1174,7 @@ class FeatureSetCollectionVariable extends CollectionBasedVariable {
1154
1174
  };
1155
1175
  }
1156
1176
  async _featureSetCollectionFromPortalItem(definition) {
1157
- const portalItem = await newPortalItem(definition);
1177
+ const portalItem = await newPortalPortalItem(definition);
1158
1178
  await portalItem.load();
1159
1179
  switch (portalItem.type) {
1160
1180
  case "Web Map": {
@@ -1213,9 +1233,9 @@ class FeatureSetCollectionVariable extends CollectionBasedVariable {
1213
1233
  return layerVariables;
1214
1234
  }
1215
1235
  _createFeatureSetVariable(featureLayer, isFromWebMap = false) {
1216
- return new FeatureSetVariable({
1236
+ return new FeatureSetVariable(this, {
1217
1237
  profile: this._profile,
1218
- declaration: { definition: featureLayer },
1238
+ declaration: { name: featureLayer.title, definition: featureLayer },
1219
1239
  label: featureLayer.title,
1220
1240
  description: "",
1221
1241
  nonInteractive: true
@@ -1253,7 +1273,7 @@ class FeatureSetCollectionVariable extends CollectionBasedVariable {
1253
1273
  class EditorProfile extends DictionaryVariable {
1254
1274
  constructor(definition, intlStrings, locale = "en") {
1255
1275
  // Delay the load of the variable declarations so we have a `this`
1256
- super({
1276
+ super(undefined, {
1257
1277
  profile: null,
1258
1278
  declaration: { properties: [] }
1259
1279
  });
@@ -1491,7 +1511,7 @@ class ArcadeLanguageServiceDefaults {
1491
1511
  if (isPredefinedProfile(definition)) {
1492
1512
  definition = await convertToEditorProfileDefinition(definition, apiContext.locale);
1493
1513
  }
1494
- const intlStrings = await N(apiContext.locale, getAssetPath("./assets/arcade-language/t9n"), "profile.t9n.");
1514
+ const intlStrings = await v(apiContext.locale, getAssetPath("./assets/arcade-language/t9n"), "profile.t9n.");
1495
1515
  if (!intlStrings) {
1496
1516
  throw new Error(`Failed to load the language bundle for ${apiContext.locale}`);
1497
1517
  }