@arcgis/coding-components 4.29.0-beta.92 → 4.29.0-beta.94

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 (160) hide show
  1. package/dist/arcgis-coding-components/arcgis-coding-components.esm.js +6 -1
  2. package/dist/arcgis-coding-components/assets/arcade-language/api/arcade-api.t9n.ar.json +466 -26
  3. package/dist/arcgis-coding-components/assets/arcade-language/api/arcade-api.t9n.bg.json +466 -26
  4. package/dist/arcgis-coding-components/assets/arcade-language/api/arcade-api.t9n.bs.json +466 -26
  5. package/dist/arcgis-coding-components/assets/arcade-language/api/arcade-api.t9n.ca.json +466 -26
  6. package/dist/arcgis-coding-components/assets/arcade-language/api/arcade-api.t9n.cs.json +466 -26
  7. package/dist/arcgis-coding-components/assets/arcade-language/api/arcade-api.t9n.da.json +466 -26
  8. package/dist/arcgis-coding-components/assets/arcade-language/api/arcade-api.t9n.de.json +466 -26
  9. package/dist/arcgis-coding-components/assets/arcade-language/api/arcade-api.t9n.el.json +466 -26
  10. package/dist/arcgis-coding-components/assets/arcade-language/api/arcade-api.t9n.en.json +466 -26
  11. package/dist/arcgis-coding-components/assets/arcade-language/api/arcade-api.t9n.es.json +466 -26
  12. package/dist/arcgis-coding-components/assets/arcade-language/api/arcade-api.t9n.et.json +466 -26
  13. package/dist/arcgis-coding-components/assets/arcade-language/api/arcade-api.t9n.fi.json +466 -26
  14. package/dist/arcgis-coding-components/assets/arcade-language/api/arcade-api.t9n.fr.json +466 -26
  15. package/dist/arcgis-coding-components/assets/arcade-language/api/arcade-api.t9n.he.json +466 -26
  16. package/dist/arcgis-coding-components/assets/arcade-language/api/arcade-api.t9n.hr.json +466 -26
  17. package/dist/arcgis-coding-components/assets/arcade-language/api/arcade-api.t9n.hu.json +466 -26
  18. package/dist/arcgis-coding-components/assets/arcade-language/api/arcade-api.t9n.id.json +466 -26
  19. package/dist/arcgis-coding-components/assets/arcade-language/api/arcade-api.t9n.it.json +466 -26
  20. package/dist/arcgis-coding-components/assets/arcade-language/api/arcade-api.t9n.ja.json +466 -26
  21. package/dist/arcgis-coding-components/assets/arcade-language/api/arcade-api.t9n.ko.json +466 -26
  22. package/dist/arcgis-coding-components/assets/arcade-language/api/arcade-api.t9n.lt.json +466 -26
  23. package/dist/arcgis-coding-components/assets/arcade-language/api/arcade-api.t9n.lv.json +466 -26
  24. package/dist/arcgis-coding-components/assets/arcade-language/api/arcade-api.t9n.nb.json +466 -26
  25. package/dist/arcgis-coding-components/assets/arcade-language/api/arcade-api.t9n.nl.json +466 -26
  26. package/dist/arcgis-coding-components/assets/arcade-language/api/arcade-api.t9n.pl.json +466 -26
  27. package/dist/arcgis-coding-components/assets/arcade-language/api/arcade-api.t9n.pt-BR.json +466 -26
  28. package/dist/arcgis-coding-components/assets/arcade-language/api/arcade-api.t9n.pt-PT.json +466 -26
  29. package/dist/arcgis-coding-components/assets/arcade-language/api/arcade-api.t9n.ro.json +466 -26
  30. package/dist/arcgis-coding-components/assets/arcade-language/api/arcade-api.t9n.ru.json +466 -26
  31. package/dist/arcgis-coding-components/assets/arcade-language/api/arcade-api.t9n.sk.json +466 -26
  32. package/dist/arcgis-coding-components/assets/arcade-language/api/arcade-api.t9n.sl.json +466 -26
  33. package/dist/arcgis-coding-components/assets/arcade-language/api/arcade-api.t9n.sr.json +466 -26
  34. package/dist/arcgis-coding-components/assets/arcade-language/api/arcade-api.t9n.sv.json +466 -26
  35. package/dist/arcgis-coding-components/assets/arcade-language/api/arcade-api.t9n.th.json +466 -26
  36. package/dist/arcgis-coding-components/assets/arcade-language/api/arcade-api.t9n.tr.json +466 -26
  37. package/dist/arcgis-coding-components/assets/arcade-language/api/arcade-api.t9n.uk.json +466 -26
  38. package/dist/arcgis-coding-components/assets/arcade-language/api/arcade-api.t9n.vi.json +466 -26
  39. package/dist/arcgis-coding-components/assets/arcade-language/api/arcade-api.t9n.zh-CN.json +466 -26
  40. package/dist/arcgis-coding-components/assets/arcade-language/api/arcade-api.t9n.zh-HK.json +466 -26
  41. package/dist/arcgis-coding-components/assets/arcade-language/api/arcade-api.t9n.zh-TW.json +466 -26
  42. package/dist/arcgis-coding-components/assets/arcade-language/profiles/arcade-profiles.t9n.ar.json +9 -2
  43. package/dist/arcgis-coding-components/assets/arcade-language/profiles/arcade-profiles.t9n.bg.json +9 -2
  44. package/dist/arcgis-coding-components/assets/arcade-language/profiles/arcade-profiles.t9n.bs.json +9 -2
  45. package/dist/arcgis-coding-components/assets/arcade-language/profiles/arcade-profiles.t9n.ca.json +9 -2
  46. package/dist/arcgis-coding-components/assets/arcade-language/profiles/arcade-profiles.t9n.cs.json +9 -2
  47. package/dist/arcgis-coding-components/assets/arcade-language/profiles/arcade-profiles.t9n.da.json +9 -2
  48. package/dist/arcgis-coding-components/assets/arcade-language/profiles/arcade-profiles.t9n.de.json +9 -2
  49. package/dist/arcgis-coding-components/assets/arcade-language/profiles/arcade-profiles.t9n.el.json +9 -2
  50. package/dist/arcgis-coding-components/assets/arcade-language/profiles/arcade-profiles.t9n.en.json +9 -2
  51. package/dist/arcgis-coding-components/assets/arcade-language/profiles/arcade-profiles.t9n.es.json +9 -2
  52. package/dist/arcgis-coding-components/assets/arcade-language/profiles/arcade-profiles.t9n.et.json +9 -2
  53. package/dist/arcgis-coding-components/assets/arcade-language/profiles/arcade-profiles.t9n.fi.json +9 -2
  54. package/dist/arcgis-coding-components/assets/arcade-language/profiles/arcade-profiles.t9n.fr.json +9 -2
  55. package/dist/arcgis-coding-components/assets/arcade-language/profiles/arcade-profiles.t9n.he.json +9 -2
  56. package/dist/arcgis-coding-components/assets/arcade-language/profiles/arcade-profiles.t9n.hr.json +9 -2
  57. package/dist/arcgis-coding-components/assets/arcade-language/profiles/arcade-profiles.t9n.hu.json +9 -2
  58. package/dist/arcgis-coding-components/assets/arcade-language/profiles/arcade-profiles.t9n.id.json +9 -2
  59. package/dist/arcgis-coding-components/assets/arcade-language/profiles/arcade-profiles.t9n.it.json +9 -2
  60. package/dist/arcgis-coding-components/assets/arcade-language/profiles/arcade-profiles.t9n.ja.json +9 -2
  61. package/dist/arcgis-coding-components/assets/arcade-language/profiles/arcade-profiles.t9n.ko.json +9 -2
  62. package/dist/arcgis-coding-components/assets/arcade-language/profiles/arcade-profiles.t9n.lt.json +9 -2
  63. package/dist/arcgis-coding-components/assets/arcade-language/profiles/arcade-profiles.t9n.lv.json +9 -2
  64. package/dist/arcgis-coding-components/assets/arcade-language/profiles/arcade-profiles.t9n.nb.json +9 -2
  65. package/dist/arcgis-coding-components/assets/arcade-language/profiles/arcade-profiles.t9n.nl.json +9 -2
  66. package/dist/arcgis-coding-components/assets/arcade-language/profiles/arcade-profiles.t9n.pl.json +9 -2
  67. package/dist/arcgis-coding-components/assets/arcade-language/profiles/arcade-profiles.t9n.pt-BR.json +9 -2
  68. package/dist/arcgis-coding-components/assets/arcade-language/profiles/arcade-profiles.t9n.pt-PT.json +9 -2
  69. package/dist/arcgis-coding-components/assets/arcade-language/profiles/arcade-profiles.t9n.ro.json +9 -2
  70. package/dist/arcgis-coding-components/assets/arcade-language/profiles/arcade-profiles.t9n.ru.json +9 -2
  71. package/dist/arcgis-coding-components/assets/arcade-language/profiles/arcade-profiles.t9n.sk.json +9 -2
  72. package/dist/arcgis-coding-components/assets/arcade-language/profiles/arcade-profiles.t9n.sl.json +9 -2
  73. package/dist/arcgis-coding-components/assets/arcade-language/profiles/arcade-profiles.t9n.sr.json +9 -2
  74. package/dist/arcgis-coding-components/assets/arcade-language/profiles/arcade-profiles.t9n.sv.json +9 -2
  75. package/dist/arcgis-coding-components/assets/arcade-language/profiles/arcade-profiles.t9n.th.json +9 -2
  76. package/dist/arcgis-coding-components/assets/arcade-language/profiles/arcade-profiles.t9n.tr.json +9 -2
  77. package/dist/arcgis-coding-components/assets/arcade-language/profiles/arcade-profiles.t9n.uk.json +9 -2
  78. package/dist/arcgis-coding-components/assets/arcade-language/profiles/arcade-profiles.t9n.vi.json +9 -2
  79. package/dist/arcgis-coding-components/assets/arcade-language/profiles/arcade-profiles.t9n.zh-CN.json +9 -2
  80. package/dist/arcgis-coding-components/assets/arcade-language/profiles/arcade-profiles.t9n.zh-HK.json +9 -2
  81. package/dist/arcgis-coding-components/assets/arcade-language/profiles/arcade-profiles.t9n.zh-TW.json +9 -2
  82. package/dist/arcgis-coding-components/assets/code-editor/arcade.worker.js +1 -1
  83. package/dist/arcgis-coding-components/index.esm.js +6 -1
  84. package/dist/arcgis-coding-components/{p-a1a4f5fc.js → p-06b7a85d.js} +6 -1
  85. package/dist/arcgis-coding-components/{p-4c959bce.js → p-22837217.js} +15 -10
  86. package/dist/arcgis-coding-components/{p-ccafed7f.js → p-2b1aca7c.js} +5 -0
  87. package/dist/arcgis-coding-components/{p-75ae922a.js → p-4c4149bc.js} +6 -1
  88. package/dist/arcgis-coding-components/{p-79707082.js → p-5fb23065.js} +6 -1
  89. package/dist/arcgis-coding-components/{p-009eaccf.js → p-8f020f20.js} +5 -0
  90. package/dist/arcgis-coding-components/p-a051ec0a.entry.js +6 -0
  91. package/dist/arcgis-coding-components/{p-cdfe57a1.js → p-a17571b6.js} +6 -1
  92. package/dist/arcgis-coding-components/{p-1d062d47.js → p-a6429039.js} +6 -1
  93. package/dist/arcgis-coding-components/{p-590b795b.js → p-c2344fd6.js} +6 -1
  94. package/dist/arcgis-coding-components/{p-ca7059d4.js → p-d37fa51c.js} +6 -1
  95. package/dist/arcgis-coding-components/p-db60fe10.js +6 -0
  96. package/dist/cjs/{arcade-defaults-7faf4d5f.js → arcade-defaults-042fbece.js} +487 -362
  97. package/dist/cjs/{arcade-mode-26b8bc7a.js → arcade-mode-b495cb6f.js} +24 -20
  98. package/dist/cjs/arcgis-arcade-api_6.cjs.entry.js +176 -112
  99. package/dist/cjs/arcgis-coding-components.cjs.js +6 -1
  100. package/dist/cjs/{css-eb1c8e5c.js → css-19093b80.js} +5 -0
  101. package/dist/cjs/{cssMode-90f06d02.js → cssMode-ce70c012.js} +7 -2
  102. package/dist/cjs/{html-1aa8e458.js → html-04cbd899.js} +7 -2
  103. package/dist/cjs/{htmlMode-d3283acc.js → htmlMode-5e973c6f.js} +7 -2
  104. package/dist/cjs/{index-aaf14a3e.js → index-30445be8.js} +5 -0
  105. package/dist/cjs/index.cjs.js +7 -2
  106. package/dist/cjs/{javascript-7a4d9023.js → javascript-8717f18b.js} +8 -3
  107. package/dist/cjs/{jsonMode-73be73dc.js → jsonMode-b93b2667.js} +7 -2
  108. package/dist/cjs/loader.cjs.js +6 -1
  109. package/dist/cjs/{tsMode-95a699e0.js → tsMode-73e2fe2f.js} +7 -2
  110. package/dist/cjs/{typescript-588df930.js → typescript-a75c0ef4.js} +7 -2
  111. package/dist/components/arcade-api.js +11 -6
  112. package/dist/components/arcade-contribution.js +16 -6
  113. package/dist/components/arcade-defaults.js +243 -118
  114. package/dist/components/arcade-mode.js +22 -18
  115. package/dist/components/arcade-results.js +137 -85
  116. package/dist/components/arcade-suggestions.js +9 -4
  117. package/dist/components/arcade-variables.js +10 -5
  118. package/dist/components/arcgis-arcade-api.js +5 -0
  119. package/dist/components/arcgis-arcade-editor.js +20 -8
  120. package/dist/components/arcgis-arcade-results.js +5 -0
  121. package/dist/components/arcgis-arcade-suggestions.js +5 -0
  122. package/dist/components/arcgis-arcade-variables.js +5 -0
  123. package/dist/components/arcgis-code-editor.js +5 -0
  124. package/dist/components/code-editor.js +9 -4
  125. package/dist/components/fields.js +5 -0
  126. package/dist/components/functional-components.js +5 -0
  127. package/dist/components/index.js +5 -0
  128. package/dist/components/index2.js +7 -2
  129. package/dist/components/markdown.js +5 -0
  130. package/dist/components/utilities.js +7 -2
  131. package/dist/esm/{arcade-defaults-0bc49d1c.js → arcade-defaults-106e7abf.js} +479 -354
  132. package/dist/esm/{arcade-mode-01365fb8.js → arcade-mode-a890a073.js} +24 -20
  133. package/dist/esm/arcgis-arcade-api_6.entry.js +176 -112
  134. package/dist/esm/arcgis-coding-components.js +7 -2
  135. package/dist/esm/{css-aade9167.js → css-5029659c.js} +5 -0
  136. package/dist/esm/{cssMode-edce5a89.js → cssMode-c3ebc40a.js} +7 -2
  137. package/dist/esm/{html-00b724af.js → html-13c9342a.js} +7 -2
  138. package/dist/esm/{htmlMode-ad3459b7.js → htmlMode-053279f0.js} +7 -2
  139. package/dist/esm/{index-3732acb8.js → index-c845e955.js} +5 -0
  140. package/dist/esm/index.js +7 -2
  141. package/dist/esm/{javascript-bdd52d83.js → javascript-c580af02.js} +8 -3
  142. package/dist/esm/{jsonMode-7b4c07fb.js → jsonMode-cd51566e.js} +7 -2
  143. package/dist/esm/loader.js +7 -2
  144. package/dist/esm/{tsMode-0bd06180.js → tsMode-c0164816.js} +7 -2
  145. package/dist/esm/{typescript-dfdad07a.js → typescript-7e6d57f4.js} +7 -2
  146. package/dist/loader/cdn.js +5 -1
  147. package/dist/loader/index.cjs.js +5 -1
  148. package/dist/loader/index.es2017.js +5 -1
  149. package/dist/loader/index.js +5 -1
  150. package/dist/types/components/arcade-editor/arcade-editor.d.ts +1 -1
  151. package/dist/types/components/arcade-results/arcade-results.d.ts +0 -5
  152. package/dist/types/components.d.ts +3 -3
  153. package/dist/types/utils/arcade-executor.d.ts +12 -4
  154. package/dist/types/utils/arcade-monaco/arcade.worker.d.ts +6 -4
  155. package/dist/types/utils/profile/editor-profile.d.ts +10 -5
  156. package/dist/types/utils/profile/types.d.ts +3 -3
  157. package/dist/types/utils/profile/utils.d.ts +4 -0
  158. package/package.json +10 -10
  159. package/dist/arcgis-coding-components/p-86772125.js +0 -1
  160. package/dist/arcgis-coding-components/p-ac769046.entry.js +0 -1
@@ -1,8 +1,13 @@
1
+ /*!
2
+ * All material copyright Esri, All Rights Reserved, unless otherwise specified.
3
+ * See https://js.arcgis.com/4.29/esri/copyright.txt for details.
4
+ * v4.29.0-beta.94
5
+ */
1
6
  import { Emitter, Uri } from 'monaco-editor';
2
- import { CompletionItemKind, InsertTextMode, InsertTextFormat } from 'vscode-languageserver-types';
7
+ import { InsertTextMode, InsertTextFormat, CompletionItemKind } from 'vscode-languageserver-types';
3
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';
4
9
  import { p as portalItemPageUrl } from './utilities.js';
5
- import { V, X, G, D, E, N } from './index2.js';
10
+ import { Z, e as ee, J, I, E, N } from './index2.js';
6
11
  import { getAssetPath } from '@stencil/core/internal/client';
7
12
 
8
13
  async function newPortalItem(definition) {
@@ -42,6 +47,13 @@ function isQueryableLayerInstance(item) {
42
47
  "queryFeatures" in item &&
43
48
  typeof item.queryFeatures === "function");
44
49
  }
50
+ function isSubtypeSublayerInstance(item) {
51
+ return (!!item &&
52
+ typeof item === "object" &&
53
+ "declaredClass" in item &&
54
+ typeof item.declaredClass === "string" &&
55
+ item.declaredClass === "esri.layers.support.SubtypeSublayer");
56
+ }
45
57
  function isGroupLayerInstance(item) {
46
58
  return (!!item &&
47
59
  typeof item === "object" &&
@@ -68,6 +80,24 @@ function isFieldsDefinition(item) {
68
80
  function isUrlDefinition(item) {
69
81
  return (!!item && typeof item === "object" && "url" in item && typeof item.url === "string" && !("declaredClass" in item));
70
82
  }
83
+ function isSubtypeInstance(item) {
84
+ return (!!item &&
85
+ typeof item === "object" &&
86
+ "declaredClass" in item &&
87
+ item.declaredClass === "esri.layers.support.Subtype");
88
+ }
89
+ function isCodedValueDomainInstance(item) {
90
+ return (!!item &&
91
+ typeof item === "object" &&
92
+ "declaredClass" in item &&
93
+ item.declaredClass === "esri.layers.support.CodedValueDomain");
94
+ }
95
+ function isInheritedDomainInstance(item) {
96
+ return (!!item &&
97
+ typeof item === "object" &&
98
+ "declaredClass" in item &&
99
+ item.declaredClass === "esri.layers.support.InheritedDomain");
100
+ }
71
101
  function isPredefinedProfile(item) {
72
102
  return (!!item &&
73
103
  typeof item === "object" &&
@@ -78,29 +108,29 @@ function isPredefinedProfile(item) {
78
108
  !Array.isArray(item.definitions));
79
109
  }
80
110
 
81
- function resolveIntlPath(dictionary, path) {
82
- if (!dictionary) {
83
- return "";
84
- }
85
- const pathSegments = path.split(".");
86
- let pathSegment = pathSegments.shift();
87
- let entry = dictionary;
88
- while (entry && pathSegment) {
89
- // @ts-expect-error
90
- entry = entry[pathSegment];
91
- pathSegment = pathSegments.shift();
92
- }
93
- return typeof entry === "string" ? entry : path;
111
+ function isTitleCapableSource(item) {
112
+ return !!item && typeof item === "object" && "title" in item && typeof item.title === "string";
113
+ }
114
+ function isUrlCapableSource(item) {
115
+ return !!item && typeof item === "object" && "url" in item && typeof item.url === "string";
116
+ }
117
+ function isLayerIdCapableSource(item) {
118
+ return !!item && typeof item === "object" && "layerId" in item && typeof item.layerId === "number";
94
119
  }
95
- function isTypesCapabaleLayer(item) {
96
- return !!item && typeof item === "object" && "typeIdField" in item;
120
+ function isFeatureTypesCapableLayer(item) {
121
+ return !!item && typeof item === "object" && "typeIdField" in item && "types" in item;
97
122
  }
98
123
  function isDomainsCapableLayer(item) {
99
124
  return !!item && typeof item === "object" && "getFieldDomain" in item && typeof item.getFieldDomain === "function";
100
125
  }
126
+ function isSubtypeFieldCapableLayer(item) {
127
+ return !!item && typeof item === "object" && "subtypeField" in item;
128
+ }
129
+ function isSubtypesCapableLayer(item) {
130
+ return isSubtypeFieldCapableLayer(item) && "subtypes" in item;
131
+ }
101
132
  function isRelationshipsCapableLayer(item) {
102
- return (!!item &&
103
- typeof item === "object" &&
133
+ return (isLayerIdCapableSource(item) &&
104
134
  "relationships" in item &&
105
135
  "url" in item &&
106
136
  Array.isArray(item.relationships) &&
@@ -127,7 +157,23 @@ function sortFields(layer) {
127
157
  if (secondField.type === "oid") {
128
158
  return 1;
129
159
  }
130
- if (isTypesCapabaleLayer(layer)) {
160
+ if (isSubtypeSublayerInstance(layer)) {
161
+ if (firstField.name === layer.parent.subtypeField) {
162
+ return -1;
163
+ }
164
+ if (secondField.name === layer.parent.subtypeField) {
165
+ return 1;
166
+ }
167
+ }
168
+ if (isSubtypeFieldCapableLayer(layer)) {
169
+ if (firstField.name === layer.subtypeField) {
170
+ return -1;
171
+ }
172
+ if (secondField.name === layer.subtypeField) {
173
+ return 1;
174
+ }
175
+ }
176
+ if (isFeatureTypesCapableLayer(layer)) {
131
177
  if (firstField.name === layer.typeIdField) {
132
178
  return -1;
133
179
  }
@@ -138,20 +184,19 @@ function sortFields(layer) {
138
184
  return firstField.name.localeCompare(secondField.name, "en", { sensitivity: "base" });
139
185
  };
140
186
  }
141
- function getSubtypesProperties(profile, types, field) {
187
+ function getTypeOrSubtypeDomainGroup(profile, types, field) {
142
188
  // Try the coded domain first
143
- const group = getDomainValuesProperties(profile, field.domain, { code: "subtypes" });
144
- if (group) {
145
- return group;
146
- }
147
- // No coded domain for the subtypes, we will manufacture it
148
- const values = types.map((t) => new ValueVariable({ profile, label: `${t.id}`, description: t.name, snippet: `"${t.id}"` }));
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
+ }) ?? [];
149
197
  return new GroupOfVariables(profile, { code: "subtypes" }, values);
150
198
  }
151
- function getDomainValuesProperties(profile, domain, label) {
152
- if (!domain || domain.type !== "coded-value") {
153
- return null;
154
- }
199
+ function getCodedValueDomainGroup(profile, domain, label) {
155
200
  const values = domain.codedValues.map((v) => new ValueVariable({
156
201
  profile,
157
202
  label: `${v.code}`,
@@ -161,29 +206,33 @@ function getDomainValuesProperties(profile, domain, label) {
161
206
  }));
162
207
  return new GroupOfVariables(profile, label, values);
163
208
  }
164
- function getDomainValuesBySubtypeGroup(profile, types, field) {
209
+ function getDomainValuesGroup(profile, types, field) {
165
210
  const variables = [];
166
- types.forEach((t) => {
167
- let domain = t.domains[field.name];
211
+ if (!types || types.length === 0) {
212
+ return null;
213
+ }
214
+ types.forEach((type) => {
215
+ let domain = type.domains[field.name];
168
216
  if (!domain) {
169
217
  return;
170
218
  }
171
- if (domain.type === "inherited") {
219
+ if (isInheritedDomainInstance(domain)) {
172
220
  domain = field.domain;
173
221
  return;
174
222
  }
175
- const domainValuesGroup = getDomainValuesProperties(profile, domain, {
223
+ if (!isCodedValueDomainInstance(domain)) {
224
+ return;
225
+ }
226
+ const domainValuesGroup = getCodedValueDomainGroup(profile, domain, {
176
227
  code: "domainvaluesfortypeformat",
177
228
  formatValues: {
178
229
  fieldName: field.alias ?? field.name,
179
- typeName: t.name
230
+ typeName: type.name
180
231
  }
181
232
  });
182
- if (!domainValuesGroup) {
183
- return;
184
- }
185
- const label = `${t.id}`;
186
- const snippet = `"${t.id}""`;
233
+ const id = isSubtypeInstance(type) ? type.code : type.id;
234
+ const label = `${id}`;
235
+ const snippet = `"${id}""`;
187
236
  const subtypeDictionary = new DictionaryVariable({ profile, label, snippet });
188
237
  subtypeDictionary.variables = [domainValuesGroup];
189
238
  variables.push(subtypeDictionary);
@@ -193,6 +242,9 @@ function getDomainValuesBySubtypeGroup(profile, types, field) {
193
242
  }
194
243
  return new GroupOfVariables(profile, { code: "domainvaluesbysubtypes" }, variables);
195
244
  }
245
+ function areAllDomainsInherited(types, field) {
246
+ return types?.every((type) => type.domains[field.name]?.type === "inherited") ?? false;
247
+ }
196
248
  // const validIdentifierExpr = new RegExp(/^[a-z_$][\w$]*$/gi);
197
249
  const validIdentifierExpr = /^[a-z_$][a-z0-9_$]*$/giu;
198
250
  function getMemberExpressionProperty(prop, includeDot = true) {
@@ -255,10 +307,7 @@ function filterFeatureLayerInfos(layers, queryCapability) {
255
307
  //#endregion
256
308
  //#region Functions to Editor Variables to a language service variables
257
309
  async function variablesToLSVariable(editorVariables, kind = CompletionItemKind.Variable) {
258
- if (!editorVariables) {
259
- return [];
260
- }
261
- const properties = await Promise.all(editorVariables.map(async (editorVariable) => {
310
+ return await Promise.all(editorVariables.map(async (editorVariable) => {
262
311
  switch (editorVariable.type) {
263
312
  case "dictionary":
264
313
  return await dictionaryToLSDictionary(editorVariable, kind);
@@ -268,7 +317,6 @@ async function variablesToLSVariable(editorVariables, kind = CompletionItemKind.
268
317
  return variableToLSVariable(editorVariable, kind);
269
318
  }
270
319
  }));
271
- return properties.filter((p) => p);
272
320
  }
273
321
  function variableToLSVariable(editorVariable, kind) {
274
322
  const { name, type } = editorVariable;
@@ -386,7 +434,7 @@ async function dictionaryToLSDictionary(editorDictionary, kind) {
386
434
  previous += ` \n${description}`;
387
435
  }
388
436
  return previous;
389
- }, description ?? "");
437
+ }, description);
390
438
  return {
391
439
  name,
392
440
  description,
@@ -427,9 +475,9 @@ class ProfileItemBase {
427
475
  // If the component is under RTL, the string is messed up.
428
476
  // It is converted from $feature to feature$, This is not acceptable since the label
429
477
  // represents a variable name. We are adding in front of the $ sign a right to left mark.
430
- return G(this._label);
478
+ return J(this._label);
431
479
  }
432
- return D(this._profile?.intlStrings[this._label.code], this._label.formatValues);
480
+ return I(this._profile?.intlStrings[this._label.code], this._label.formatValues);
433
481
  }
434
482
  /**
435
483
  * Returns the description string.
@@ -441,7 +489,7 @@ class ProfileItemBase {
441
489
  if (typeof this.description === "string") {
442
490
  return this.description;
443
491
  }
444
- return D(this._profile?.intlStrings[this.description.code ?? ""], this.description.formatValues);
492
+ return I(this._profile?.intlStrings[this.description.code], this.description.formatValues);
445
493
  }
446
494
  /**
447
495
  * Returns true if the item pass the filter test
@@ -464,7 +512,7 @@ class VariableBase extends ProfileItemBase {
464
512
  super(props.profile, props.label, props.description ?? props.declaration?.description);
465
513
  this.declaration = props.declaration ?? {};
466
514
  this.name = props.declaration?.name ?? "";
467
- this.snippet = props.snippet || "";
515
+ this.snippet = props.snippet ?? "";
468
516
  this.nonInteractive = props.nonInteractive ?? false;
469
517
  this.filterDescription = props.filterDescription ?? false;
470
518
  this.icon = props.icon;
@@ -482,7 +530,7 @@ class ValueVariable extends VariableBase {
482
530
  }
483
531
  getDescription() {
484
532
  if (this.description == null) {
485
- return resolveIntlPath(this._profile?.intlStrings, this.type.toLowerCase()) ?? "";
533
+ return this._profile?.intlStrings[this.type.toLowerCase()] ?? "";
486
534
  }
487
535
  return super.getDescription();
488
536
  }
@@ -503,7 +551,7 @@ class ArrayVariable extends VariableBase {
503
551
  }
504
552
  getDescription() {
505
553
  if (this.description == null) {
506
- return resolveIntlPath(this._profile?.intlStrings, this.type.toLowerCase()) ?? "";
554
+ return this._profile?.intlStrings[this.type.toLowerCase()] ?? "";
507
555
  }
508
556
  return super.getDescription();
509
557
  }
@@ -518,8 +566,8 @@ class ArrayVariable extends VariableBase {
518
566
  * collection is ready or not.
519
567
  */
520
568
  class CollectionBasedVariable extends VariableBase {
521
- constructor(props) {
522
- super(props);
569
+ constructor() {
570
+ super(...arguments);
523
571
  this.isCollection = true;
524
572
  this._loaded = true;
525
573
  /**
@@ -655,42 +703,53 @@ class SourceBasedVariable extends CollectionBasedVariable {
655
703
  this._definition = props.declaration?.definition;
656
704
  }
657
705
  get title() {
658
- return this._source?.title ?? "";
706
+ return isTitleCapableSource(this._source) ? this._source.title : "";
659
707
  }
660
708
  get url() {
661
- return this._definition?.url ?? "";
709
+ return isUrlCapableSource(this._source) ? this._source.url : "";
662
710
  }
663
711
  get informationUrl() {
664
712
  if (!this.loaded) {
665
713
  return null;
666
714
  }
667
- const url = this._source?.url;
668
- if (!url) {
715
+ if (!this.url) {
669
716
  return null;
670
717
  }
671
- const layerId = this._source?.layerId ?? "";
672
- return `${url}/${layerId}`;
718
+ return isLayerIdCapableSource(this._source) ? `${this.url}/${this._source.layerId}` : this.url;
673
719
  }
674
720
  get informationType() {
675
721
  return this._profile?.intlStrings.layer ?? "layer";
676
722
  }
677
723
  async loadSource() {
678
- if (V(this._loadPromise) && X(this._loadPromise)) {
724
+ if (Z(this._loadPromise) && ee(this._loadPromise)) {
679
725
  return await this._loadPromise;
680
726
  }
681
727
  this._loadPromise = this._loadSource();
682
728
  return await this._loadPromise;
683
729
  }
730
+ _getValueSnippet(field) {
731
+ // If the source is a feature, then we want to assemble the snippet ($feature) with the field name as a member expression
732
+ return this.type === "feature" ? assembleMemberExpression(this.snippet, field.name) : field.name;
733
+ }
734
+ _getSubtypeOrDomainNameSnippet(field) {
735
+ if (this.type !== "feature") {
736
+ return null;
737
+ }
738
+ if (isSubtypeFieldCapableLayer(this._source) && field.name === this._source.subtypeField) {
739
+ return `SubtypeName(${this.snippet})`;
740
+ }
741
+ return `DomainName(${this.snippet}, "${field.name}")`;
742
+ }
684
743
  _getFieldProperty(field) {
685
744
  // Check if the field is the type id field or of the field has a coded domain.
686
745
  // If it has then the property will be an exanpdable property (dictionary).
687
746
  // Otherwise just return a simple value property.
688
- const subtypesOrDomainValuesDictionary = this._getSubtypesOrDomainValuesDictionary(field);
747
+ const subtypesOrDomainValuesDictionary = this._getDomainDictionary(field);
689
748
  if (subtypesOrDomainValuesDictionary) {
690
749
  return subtypesOrDomainValuesDictionary;
691
750
  }
692
751
  // Create the value property
693
- const valueSnippet = this.type === "feature" ? assembleMemberExpression(this.snippet, field.name) : field.name;
752
+ const valueSnippet = this._getValueSnippet(field);
694
753
  return new ValueVariable({
695
754
  profile: this._profile,
696
755
  label: valueSnippet,
@@ -700,12 +759,107 @@ class SourceBasedVariable extends CollectionBasedVariable {
700
759
  filterDescription: true
701
760
  });
702
761
  }
703
- _getSubtypesOrDomainValuesDictionary(field) {
762
+ _getDomainDictionary(field) {
704
763
  if (!isDomainsCapableLayer(this._source)) {
705
764
  return null;
706
765
  }
707
- // Create the domain dictionary, we may not use it
708
- const valueSnippet = this.type === "feature" ? assembleMemberExpression(this.snippet, field.name) : field.name;
766
+ // Note we have multiple scenarios:
767
+ // - Layers without subtypes or feature types: We will check if the field has a domain
768
+ // - Layers with only subtypes: We will parse the subtypes metadata and create a dictionary
769
+ // - Layers with only feature types: We will parse the feature types metadata
770
+ // - Layers with both subtypes and feature types: we will actually use the subtypes metadata
771
+ // Summary, we will always use the subtypes metadata if available.
772
+ if (isSubtypeFieldCapableLayer(this._source) && !!this._source.subtypeField) {
773
+ return this._getSubtypeDomainDictionary(field);
774
+ }
775
+ if (isFeatureTypesCapableLayer(this._source) && !!this._source.typeIdField) {
776
+ return this._getFeatureTypeDomainDictionary(field);
777
+ }
778
+ return this._getFieldDomainDictionary(field);
779
+ }
780
+ _getSubtypeDomainDictionary(field) {
781
+ // Should be tested before calling this function
782
+ if (!isSubtypeFieldCapableLayer(this._source)) {
783
+ return null;
784
+ }
785
+ // If the source has a subtype field but doesn't have subtypes, it is certainly a subtype sublayer
786
+ if (!isSubtypesCapableLayer(this._source)) {
787
+ // For the subtype field there is no domain
788
+ if (field.name === this._source.subtypeField) {
789
+ return null;
790
+ }
791
+ // For the other fields, we will use the getFieldDomain function
792
+ return this._getFieldDomainDictionary(field);
793
+ }
794
+ // The code here shoud be executed for layers that have subtypes
795
+ // Sepcial case for the subtype field
796
+ if (field.name === this._source.subtypeField) {
797
+ const domainDictionary = this._createDomainDictionary(field);
798
+ domainDictionary.variables.push(getTypeOrSubtypeDomainGroup(this._profile, this._source.subtypes, field));
799
+ return domainDictionary;
800
+ }
801
+ // Check if all the domains for the field in the types are inherited.
802
+ // If it is we can simplify the structure by avoiding splitting in subtypes
803
+ if (areAllDomainsInherited(this._source.subtypes, field)) {
804
+ return this._getFieldDomainDictionary(field);
805
+ }
806
+ // We have domains per subtype
807
+ // We need to go thru each types and create a dictionary.
808
+ const domainValuesBySubtypeGroup = getDomainValuesGroup(this._profile, this._source.subtypes, field);
809
+ if (!domainValuesBySubtypeGroup) {
810
+ return null;
811
+ }
812
+ const domainDictionary = this._createDomainDictionary(field);
813
+ domainDictionary.variables.push(domainValuesBySubtypeGroup);
814
+ return domainDictionary;
815
+ }
816
+ _getFeatureTypeDomainDictionary(field) {
817
+ // SHould be tested before calling this function
818
+ if (!isFeatureTypesCapableLayer(this._source)) {
819
+ return null;
820
+ }
821
+ // Special case for the type id field
822
+ if (field.name === this._source.typeIdField) {
823
+ const domainDictionary = this._createDomainDictionary(field);
824
+ domainDictionary.variables.push(getTypeOrSubtypeDomainGroup(this._profile, this._source.types, field));
825
+ return domainDictionary;
826
+ }
827
+ // Check if all the domains for the field in the types are inherited.
828
+ // If it is we can simplify the structure by avoiding splitting in subtypes
829
+ if (areAllDomainsInherited(this._source.types, field)) {
830
+ return this._getFieldDomainDictionary(field);
831
+ }
832
+ // We have domains per feature type
833
+ // We need to go thru each types and create a dictionary.
834
+ const domainValuesByFeatureTypeGroup = getDomainValuesGroup(this._profile, this._source.types, field);
835
+ if (!domainValuesByFeatureTypeGroup) {
836
+ return null;
837
+ }
838
+ const domainDictionary = this._createDomainDictionary(field);
839
+ domainDictionary.variables.push(domainValuesByFeatureTypeGroup);
840
+ return domainDictionary;
841
+ }
842
+ _getFieldDomainDictionary(field) {
843
+ // SHould be tested before calling this function
844
+ if (!isDomainsCapableLayer(this._source)) {
845
+ return null;
846
+ }
847
+ const fieldDomain = this._source.getFieldDomain(field.name);
848
+ if (!isCodedValueDomainInstance(fieldDomain)) {
849
+ return null;
850
+ }
851
+ const domainValuesGroup = getCodedValueDomainGroup(this._profile, fieldDomain, {
852
+ code: "domainvalues"
853
+ });
854
+ const domainDictionary = this._createDomainDictionary(field);
855
+ domainDictionary.variables.push(domainValuesGroup);
856
+ return domainDictionary;
857
+ }
858
+ _createDomainDictionary(field) {
859
+ // Create the domain dictionary.
860
+ // The dictionary will have a header group and a value group.
861
+ // At this point we are only creating the header group in the dictionary.
862
+ const valueSnippet = this._getValueSnippet(field);
709
863
  const domainDictionary = new DictionaryVariable({
710
864
  profile: this._profile,
711
865
  label: valueSnippet,
@@ -723,45 +877,16 @@ class SourceBasedVariable extends CollectionBasedVariable {
723
877
  })
724
878
  ]);
725
879
  domainDictionary.variables = [headerGroup];
726
- // If it is the subtype field then get its coded domain values
727
- if (isTypesCapabaleLayer(this._source) && field.name === this._source.typeIdField) {
728
- const subtypesGroup = getSubtypesProperties(this._profile, this._source.types, field);
729
- domainDictionary.variables.push(subtypesGroup);
730
- return domainDictionary;
731
- }
732
- // Since its' not the subtype field then add the snippet for the domain name
733
- if (this.type === "feature") {
734
- const domainNameSnippet = `DomainName(${this.snippet}, "${field.name}")`;
880
+ // Add the SubtypeName or DomainName snippet if available
881
+ const subtypeOrDomainNameSnippet = this._getSubtypeOrDomainNameSnippet(field);
882
+ if (subtypeOrDomainNameSnippet) {
735
883
  headerGroup.variables.push(new ValueVariable({
736
884
  profile: this._profile,
737
- label: domainNameSnippet,
885
+ label: subtypeOrDomainNameSnippet,
738
886
  description: "",
739
- snippet: domainNameSnippet
887
+ snippet: subtypeOrDomainNameSnippet
740
888
  }));
741
889
  }
742
- if (isTypesCapabaleLayer(this._source)) {
743
- // Check if all the domains for the field in the types are inherited.
744
- // If it is we can simplify the structure by avoiding splitting in subtypes
745
- const allInherited = this._source.types.every((t) => t.domains[field.name].type === "inherited");
746
- if (!allInherited) {
747
- // We have domains per subtype
748
- // We need to go thru each types and create a dictionary.
749
- const domainValuesBySubtypeGroup = getDomainValuesBySubtypeGroup(this._profile, this._source.types, field);
750
- if (!domainValuesBySubtypeGroup) {
751
- return null;
752
- }
753
- domainDictionary.variables.push(domainValuesBySubtypeGroup);
754
- return domainDictionary;
755
- }
756
- }
757
- // Either we have types but all the domains are inherited or we don't have types
758
- const domainValuesGroup = getDomainValuesProperties(this._profile, this._source.getFieldDomain(field.name), {
759
- code: "domainvalues"
760
- });
761
- if (!domainValuesGroup) {
762
- return null;
763
- }
764
- domainDictionary.variables.push(domainValuesGroup);
765
890
  return domainDictionary;
766
891
  }
767
892
  async _getRelationshipsProperty() {
@@ -792,7 +917,7 @@ class SourceBasedVariable extends CollectionBasedVariable {
792
917
  nonInteractive: true
793
918
  }, [new ValueVariable({ profile: this._profile, label: snippet, description: "", snippet })], { exposeRelationships: true, sourceTableId: source.layerId });
794
919
  }));
795
- relationshipsGroup.variables = relationshipItems.filter(V);
920
+ relationshipsGroup.variables = relationshipItems.filter(Z);
796
921
  if (!relationshipsGroup.variables.length) {
797
922
  return null;
798
923
  }
@@ -950,7 +1075,7 @@ class FeatureSetCollectionVariable extends CollectionBasedVariable {
950
1075
  return this._profile?.intlStrings.featureservice ?? "featureservice";
951
1076
  }
952
1077
  async loadSource() {
953
- if (V(this._loadPromise) && X(this._loadPromise)) {
1078
+ if (Z(this._loadPromise) && ee(this._loadPromise)) {
954
1079
  return await this._loadPromise;
955
1080
  }
956
1081
  this._loadPromise = this._loadSource();
@@ -971,7 +1096,7 @@ class FeatureSetCollectionVariable extends CollectionBasedVariable {
971
1096
  : {
972
1097
  code: "webmapformat",
973
1098
  formatValues: {
974
- webMapTitle: this._featureSetCollections.source.portalItem.title ?? "Untitled map"
1099
+ webMapTitle: this._featureSetCollections.source.portalItem.title || "Untitled map"
975
1100
  }
976
1101
  };
977
1102
  const headerGroup = new GroupOfVariables(this._profile, groupLabel, [
@@ -1048,22 +1173,25 @@ class FeatureSetCollectionVariable extends CollectionBasedVariable {
1048
1173
  }
1049
1174
  }
1050
1175
  async _featureSetCollectionFromUrl(url) {
1051
- url = url.replace(/\/featureserver\/[0-9]*/iu, "/FeatureServer");
1052
- url = url.replace(/\/mapserver\/[0-9]*/iu, "/MapServer");
1053
- url = url.split("?")[0];
1054
- const metadata = await serviceMetaData(url);
1176
+ let processedUrl = url.replace(/\/featureserver\/[0-9]*/iu, "/FeatureServer");
1177
+ processedUrl = processedUrl.replace(/\/mapserver\/[0-9]*/iu, "/MapServer");
1178
+ processedUrl = processedUrl.split("?")[0];
1179
+ if (!processedUrl) {
1180
+ return null;
1181
+ }
1182
+ const metadata = await serviceMetaData(processedUrl);
1055
1183
  const layersPromise = Promise.all(metadata.layers.map(async (layerInfo) => {
1056
- const featureLayer = await newFeatureLayer({ url: `${url}/${layerInfo.id}` });
1184
+ const featureLayer = await newFeatureLayer({ url: `${processedUrl}/${layerInfo.id}` });
1057
1185
  await featureLayer.load();
1058
1186
  return this._createFeatureSetVariable(featureLayer);
1059
1187
  }));
1060
1188
  const tablesPromise = Promise.all(metadata.tables.map(async (layerInfo) => {
1061
- const table = await newFeatureLayer({ url: `${url}/${layerInfo.id}` });
1189
+ const table = await newFeatureLayer({ url: `${processedUrl}/${layerInfo.id}` });
1062
1190
  await table.load();
1063
1191
  return this._createFeatureSetVariable(table);
1064
1192
  }));
1065
1193
  const [layers, tables] = await Promise.all([layersPromise, tablesPromise]);
1066
- return { layers, tables, source: url };
1194
+ return { layers, tables, source: processedUrl };
1067
1195
  }
1068
1196
  _convertWebMapLayersToVariables(layers, filteringTables = false) {
1069
1197
  const layerVariables = [];
@@ -1198,7 +1326,7 @@ async function getSdkPredefinedProfiles(locale = "en") {
1198
1326
  try {
1199
1327
  const response = await fetch(getAssetPath(`./assets/arcade-language/profiles/arcade-profiles.t9n.${locale}.json`));
1200
1328
  if (response.ok) {
1201
- return cacheSdkPredefinedProfiles(locale, await response.json());
1329
+ return cacheSdkPredefinedProfiles(locale, (await response.json()));
1202
1330
  }
1203
1331
  if (locale === "en") {
1204
1332
  return null;
@@ -1226,13 +1354,10 @@ async function getSdkPredefinedProfile(id, locale = "en") {
1226
1354
  const profiles = await getSdkPredefinedProfiles(locale);
1227
1355
  return profiles?.get(id) ?? null;
1228
1356
  }
1229
- function isExtendedPredefinedProfileDefinition(predefinedProfileDefinition) {
1230
- return Array.isArray(predefinedProfileDefinition?.additionalVariables);
1357
+ function isExtendedPredefinedProfileDefinition(item) {
1358
+ return !!item && typeof item === "object" && "additionalVariables" in item && Array.isArray(item.additionalVariables);
1231
1359
  }
1232
1360
  function convertApiVariables(variables) {
1233
- if (!variables) {
1234
- return [];
1235
- }
1236
1361
  return variables.map(convertApiVariable);
1237
1362
  }
1238
1363
  function convertApiVariable(variable) {