@vannizhang/living-atlas-content-validator 1.5.19-beta.9 → 1.5.20-beta.1

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 (119) hide show
  1. package/README.md +416 -209
  2. package/dist/configureSettings.d.ts +14 -26
  3. package/dist/configureSettings.js +26 -21
  4. package/dist/configureSettings.js.map +1 -1
  5. package/dist/index.d.ts +20 -3
  6. package/dist/index.js +39 -2
  7. package/dist/index.js.map +1 -1
  8. package/dist/lib/accessInformation/isValidAccessInformation.js +1 -0
  9. package/dist/lib/accessInformation/isValidAccessInformation.js.map +1 -1
  10. package/dist/lib/checkTitleAndSnippetSearchability/checkTitleAndSnippetSearchability.js +1 -0
  11. package/dist/lib/checkTitleAndSnippetSearchability/checkTitleAndSnippetSearchability.js.map +1 -1
  12. package/dist/lib/config.d.ts +6 -1
  13. package/dist/lib/config.js +43 -1
  14. package/dist/lib/config.js.map +1 -1
  15. package/dist/lib/deleteProtection/isDeleteProtectionEnabled.js +1 -0
  16. package/dist/lib/deleteProtection/isDeleteProtectionEnabled.js.map +1 -1
  17. package/dist/lib/deprecated/isDeprecated.js +1 -0
  18. package/dist/lib/deprecated/isDeprecated.js.map +1 -1
  19. package/dist/lib/description/isValidDescription.js +1 -0
  20. package/dist/lib/description/isValidDescription.js.map +1 -1
  21. package/dist/lib/featureServiceCDNSetting/checkFeatureServiceCDNSetting.d.ts +10 -0
  22. package/dist/lib/featureServiceCDNSetting/checkFeatureServiceCDNSetting.js +52 -0
  23. package/dist/lib/featureServiceCDNSetting/checkFeatureServiceCDNSetting.js.map +1 -0
  24. package/dist/lib/featureServiceExportDataSetting/checkFeatureServiceExportSetting.d.ts +8 -0
  25. package/dist/lib/featureServiceExportDataSetting/checkFeatureServiceExportSetting.js +54 -0
  26. package/dist/lib/featureServiceExportDataSetting/checkFeatureServiceExportSetting.js.map +1 -0
  27. package/dist/lib/featureServiceExtents/checkFeatureServiceExtents.d.ts +16 -0
  28. package/dist/lib/featureServiceExtents/checkFeatureServiceExtents.js +83 -0
  29. package/dist/lib/featureServiceExtents/checkFeatureServiceExtents.js.map +1 -0
  30. package/dist/lib/featureServiceExtents/checkFeatureServiceExtentsHelpers.d.ts +17 -0
  31. package/dist/lib/featureServiceExtents/checkFeatureServiceExtentsHelpers.js +33 -0
  32. package/dist/lib/featureServiceExtents/checkFeatureServiceExtentsHelpers.js.map +1 -0
  33. package/dist/lib/featureServiceFieldAliases/checkFeatureServiceFieldAliases.js +18 -13
  34. package/dist/lib/featureServiceFieldAliases/checkFeatureServiceFieldAliases.js.map +1 -1
  35. package/dist/lib/featureServiceFieldAliases/helpers.d.ts +19 -0
  36. package/dist/lib/featureServiceFieldAliases/helpers.js +48 -0
  37. package/dist/lib/featureServiceFieldAliases/helpers.js.map +1 -0
  38. package/dist/lib/featureServiceFieldDescriptions/checkFeatureServiceFieldDescriptions.js +31 -15
  39. package/dist/lib/featureServiceFieldDescriptions/checkFeatureServiceFieldDescriptions.js.map +1 -1
  40. package/dist/lib/featureServiceFieldDescriptions/helpers.d.ts +20 -0
  41. package/dist/lib/featureServiceFieldDescriptions/helpers.js +53 -0
  42. package/dist/lib/featureServiceFieldDescriptions/helpers.js.map +1 -0
  43. package/dist/lib/featureServiceFieldDescriptions/scoringConfig.js +1 -1
  44. package/dist/lib/featureServiceFieldIndexes/checkFeatureServiceFieldIndexes.d.ts +10 -0
  45. package/dist/lib/featureServiceFieldIndexes/checkFeatureServiceFieldIndexes.js +53 -0
  46. package/dist/lib/featureServiceFieldIndexes/checkFeatureServiceFieldIndexes.js.map +1 -0
  47. package/dist/lib/featureServiceFieldIndexes/featureServiceFieldIndexesHelpers.d.ts +7 -0
  48. package/dist/lib/featureServiceFieldIndexes/featureServiceFieldIndexesHelpers.js +27 -0
  49. package/dist/lib/featureServiceFieldIndexes/featureServiceFieldIndexesHelpers.js.map +1 -0
  50. package/dist/lib/featureServiceFieldValueTypes/checkFeatureServiceFieldValueTypes.js +19 -15
  51. package/dist/lib/featureServiceFieldValueTypes/checkFeatureServiceFieldValueTypes.js.map +1 -1
  52. package/dist/lib/featureServiceFieldValueTypes/helpers.d.ts +16 -0
  53. package/dist/lib/featureServiceFieldValueTypes/helpers.js +35 -0
  54. package/dist/lib/featureServiceFieldValueTypes/helpers.js.map +1 -0
  55. package/dist/lib/featureServiceFieldValueTypes/scoringConfig.js +1 -1
  56. package/dist/lib/itemExtent/checkItemExtent.d.ts +27 -0
  57. package/dist/lib/itemExtent/checkItemExtent.js +102 -0
  58. package/dist/lib/itemExtent/checkItemExtent.js.map +1 -0
  59. package/dist/lib/itemExtent/checkItemExtentHelpers.d.ts +38 -0
  60. package/dist/lib/itemExtent/checkItemExtentHelpers.js +132 -0
  61. package/dist/lib/itemExtent/checkItemExtentHelpers.js.map +1 -0
  62. package/dist/lib/itemExtent/scoringConfig.d.ts +9 -0
  63. package/dist/lib/itemExtent/scoringConfig.js +13 -0
  64. package/dist/lib/itemExtent/scoringConfig.js.map +1 -0
  65. package/dist/lib/licenseInfo/isValidLicenseInfo.js +1 -0
  66. package/dist/lib/licenseInfo/isValidLicenseInfo.js.map +1 -1
  67. package/dist/lib/sharing/isValidAccess.js +1 -0
  68. package/dist/lib/sharing/isValidAccess.js.map +1 -1
  69. package/dist/lib/ssl/isValidSSL.js +6 -1
  70. package/dist/lib/ssl/isValidSSL.js.map +1 -1
  71. package/dist/lib/summary/isValidSummary.js +1 -0
  72. package/dist/lib/summary/isValidSummary.js.map +1 -1
  73. package/dist/lib/tags/isValidTags.js +1 -0
  74. package/dist/lib/tags/isValidTags.js.map +1 -1
  75. package/dist/lib/thumbnail/isValidThumbnail.js +1 -0
  76. package/dist/lib/thumbnail/isValidThumbnail.js.map +1 -1
  77. package/dist/lib/title/isValidTitle.js +1 -0
  78. package/dist/lib/title/isValidTitle.js.map +1 -1
  79. package/dist/lib/userProfileDescription/isValidUserProfileDescription.js +1 -0
  80. package/dist/lib/userProfileDescription/isValidUserProfileDescription.js.map +1 -1
  81. package/dist/lib/userProfileName/isValidUserProfileName.js +1 -0
  82. package/dist/lib/userProfileName/isValidUserProfileName.js.map +1 -1
  83. package/dist/lib/userProfileThumbnail/isValidUserProfileThumbnail.js +1 -0
  84. package/dist/lib/userProfileThumbnail/isValidUserProfileThumbnail.js.map +1 -1
  85. package/dist/lib/util/isFeatureService.d.ts +6 -0
  86. package/dist/lib/util/isFeatureService.js +21 -1
  87. package/dist/lib/util/isFeatureService.js.map +1 -1
  88. package/dist/lib/util/shouldValidateByBetaRules.d.ts +0 -1
  89. package/dist/lib/util/shouldValidateByBetaRules.js +27 -26
  90. package/dist/lib/util/shouldValidateByBetaRules.js.map +1 -1
  91. package/dist/lib/util/stringsConfig.d.ts +5 -1
  92. package/dist/lib/util/stringsConfig.js +60 -22
  93. package/dist/lib/util/stringsConfig.js.map +1 -1
  94. package/dist/lib/validate/validate.d.ts +14 -2
  95. package/dist/lib/validate/validate.js +28 -1
  96. package/dist/lib/validate/validate.js.map +1 -1
  97. package/dist/locale/en.json +50 -10
  98. package/dist/package-info.json +1 -1
  99. package/dist/services/feature-service/fetchFeatureServiceAdminJSON.d.ts +14 -0
  100. package/dist/services/feature-service/fetchFeatureServiceAdminJSON.js +57 -0
  101. package/dist/services/feature-service/fetchFeatureServiceAdminJSON.js.map +1 -0
  102. package/dist/services/feature-service/fetchFeatureServiceLayersAndTables.d.ts +11 -6
  103. package/dist/services/feature-service/fetchFeatureServiceLayersAndTables.js +56 -16
  104. package/dist/services/feature-service/fetchFeatureServiceLayersAndTables.js.map +1 -1
  105. package/dist/services/feature-service/fetchFeatureServiceRootJSON.d.ts +16 -0
  106. package/dist/services/feature-service/fetchFeatureServiceRootJSON.js +84 -0
  107. package/dist/services/feature-service/fetchFeatureServiceRootJSON.js.map +1 -0
  108. package/dist/services/feature-service/getFeatureServerURL.d.ts +12 -0
  109. package/dist/services/feature-service/getFeatureServerURL.js +37 -0
  110. package/dist/services/feature-service/getFeatureServerURL.js.map +1 -0
  111. package/dist/types/index.d.ts +180 -2
  112. package/dist/types/index.js +5 -0
  113. package/dist/types/index.js.map +1 -1
  114. package/package.json +2 -2
  115. package/dist/locale/de.json +0 -204
  116. package/dist/locale/es.json +0 -204
  117. package/dist/locale/fr.json +0 -204
  118. package/dist/locale/ja.json +0 -204
  119. package/dist/locale/pt-br.json +0 -204
@@ -172,33 +172,73 @@
172
172
  "ADD_TOPIC_INFO": "Add topic to communicate what this item is about."
173
173
  },
174
174
  "featureLayerFieldAliases": {
175
- "GUIDANCE_DEFAULT": "Field aliases are the user-friendly, human-readable names of the fields in your feature service.",
176
- "SCORING_MSG_DEFAULT": "Points are awarded if 90% or more of the fields in each feature layer of the feature service have aliases defined.",
175
+ "GUIDANCE_DEFAULT": "<p>By default, most layers start out using the field <strong>Names</strong> as the field <strong>Aliases</strong>, making them identical. This puts the burden on each user to translate each Field Name to a useful Field Alias (sometimes shown as Display Name). If, as the the owner of this item, you provide Field Aliases now, it cumulatively saves hundreds or thousands of hours of work for others who find your layer and want to use it. By putting this additional metadata &quot;on board&quot; the layer, users do not have to go find that information in metadata documents since the information is already present. As a result, each user can learn what this field represents simply by reading the Field Alias in all the places where it appears: map legend, pop-up, data table, all interfaces where the user is asked to choose a field.</p><br/><p>From the item page, go to the <strong>Data</strong> tab, click on <strong>Fields</strong> button, and click on the first field under the column <strong>Display Name</strong>. To edit the <strong>Field Alias</strong> (also referred to as <strong>Display Name</strong>), click the pencil button and enter an easy to understand Field Alias / Display Name. Tip: copy/paste content from a data dictionary, an official metadata document or PDF that describes each field.</p><br/><p><strong>Examples:</strong> in the Field Alias text, change &quot;LASTEDITOR&quot; to &quot;Last Editor&quot;; change &quot;FEATURECODE&quot; to &quot;Facility Site Code&quot;; change &quot;NUMSTORIES&quot; to &quot;Number of Stories.&quot; Note how the Field Name remains unchanged.</p><br/><p>If your item has more than one layer, you will need to set Field Aliases on each layer.</p>",
176
+ "SCORING_MSG_DEFAULT": "Points are awarded if 90% of Field Aliases (Display Names) are edited such that they are no longer identical to the Field Names. If your item has more than one layer, be sure to edit all layers.",
177
177
  "LABEL": "Improve Field Aliases",
178
178
  "TITLE": "Check Field Aliases",
179
- "ADD_FIELD_ALIAS": "Add field aliases to your feature service.",
180
179
  "IMPROVE_FIELD_ALIAS": "Improve field aliases in your feature service.",
181
180
  "NO_FEATURE_LAYER": "This feature service does not have any feature layer or non-spatial table.",
182
181
  "NO_RELEVANT_FIELD": "This feature service does not have any relevant fields (non-system generated) to validate."
183
182
  },
184
183
  "featureLayerFieldTypes": {
185
- "GUIDANCE_DEFAULT": "Field types are the data types of the fields in your feature layer.",
186
- "SCORING_MSG_DEFAULT": "Points are awarded if 90% or more of the fields in each feature layer of the feature service have value types defined.",
184
+ "GUIDANCE_DEFAULT": "<p>To help users and client apps identify how field values should be used or represented, define the types of values that are stored in each attribute field in a hosted feature layer. For example, if you define a text field as a phone number, client apps can format the text in the appropriate manner, such as (123) 456-7890. ArcGIS Online uses field value types to show you the most relevant options when drawing a layer in a map or configuring pop-ups. See the <a href=\"https://doc.arcgis.com/en/arcgis-online/manage-data/describe-fields.htm\" target=\"_blank\">Field Value Types listed here</a>.</p><br/><p>By default, a layer usually does not contain a <strong>Field Value Type</strong> on its attribute fields. This is a missed opportunity to share additional context about what type of value is stored in the field. This puts the burden on each user to go find a metadata document, if available, so that they can learn what exactly is stored in that field. If, as the owner of this item, you provide Field Value Types now, it cumulatively saves hundreds or thousands of hours of work for others who find your layer and want to use it. By putting this additional metadata \"on board\" the layer, users do not have to go find that information in metadata documents since the information is already present. As a result, each user can learn a key detail about what this field represents simply by reading the Field Value Type in all the places where it appears, e.g. when the user clicks on a field information button. It also helps software developers to detect whether a field value will contain a count, percent, measurement etc.</p><br/><p>From the item page, go to the <strong>Data</strong> tab, click on <strong>Fields</strong> button, and click on the first field under the column <strong>Display Name</strong>. To edit the <strong>Field Value Type</strong>, click the pencil button and edit the Field Value Type so that it represents what kinds of values the field contains.</p><br/><p>If your item has more than one layer, you will need to set Field Value Types on each layer.</p",
185
+ "SCORING_MSG_DEFAULT": "Points are awarded if 90% of Field Value Types are set to a value. If your item has more than one layer, be sure to edit all layers.",
187
186
  "LABEL": "Improve Field Value Types",
188
187
  "TITLE": "Check Field Value Types",
189
- "ADD_FIELD_TYPE": "Add field types to your feature service.",
190
- "IMRPOVE_FIELD_TYPE": "Improve field types in your feature service.",
188
+ "IMRPOVE_FIELD_TYPE": "Improve field value types in your feature service.",
191
189
  "NO_FEATURE_LAYER": "This feature service does not have any feature layer or non-spatial table.",
192
190
  "NO_RELEVANT_FIELD": "This feature service does not have any relevant fields (non-system generated) to validate."
193
191
  },
194
192
  "featureLayerFieldDescriptions": {
195
- "GUIDANCE_DEFAULT": "Field descriptions are the descriptions of the fields in your feature service.",
196
- "SCORING_MSG_DEFAULT": "Points are awarded if 90% or more of the fields in each feature layer of the feature service have description defined.",
193
+ "GUIDANCE_DEFAULT": "<p>By default, a layer usually does not contain a <strong>Field Description</strong> on its attribute fields. This puts the burden on each user to go find a metadata document, if available, so that they can learn what exactly is stored in that field. If, as the the owner of this item, you provide Field Descriptions now, it cumulatively saves hundreds or thousands of hours of work for others who find your layer and want to use it. By putting this additional metadata &quot;on board&quot; the layer, users do not have to go find that information in metadata documents since the information is already present. As a result, each user can learn the details about what this field represents simply by reading the Field Description in all the places where it appears, e.g. when the user clicks on a field information button.</p><br/><p>From the item page, go to the <strong>Data</strong> tab, click on <strong>Fields</strong> button, and click on the first field under the column <strong>Display Name</strong>. To edit the <strong>Field Description</strong>, click the pencil button and edit the description so that it explains what the field contains. Tip: copy/paste content from a data dictionary, an official metadata document or PDF that describes each field.</p><br/><p>If your item has more than one layer, you will need to set Field Descriptions on each layer.</p>",
194
+ "SCORING_MSG_DEFAULT": "Points are awarded if 90% of Field Descriptions contain a sentence or more of information describing the attribute. The Field Description must be different than the field alias. If your item has more than one layer, be sure to edit all layers.",
197
195
  "LABEL": "Improve Field Descriptions",
198
196
  "TITLE": "Check Field Descriptions",
199
- "ADD_FIELD_DESCRIPTION": "Add field descriptions to your feature service.",
200
197
  "IMRPOVE_FIELD_DESCRIPTION": "Improve field descriptions in your feature service.",
201
198
  "NO_FEATURE_LAYER": "This feature service does not have any feature layer or non-spatial table.",
202
199
  "NO_RELEVANT_FIELD": "This feature service does not have any relevant fields (non-system generated) to validate."
200
+ },
201
+ "itemExtent": {
202
+ "GUIDANCE_DEFAULT": "The item extent defines the bounding rectangle of the item. It is primarily used in search results whenever a user chooses to search based on current map extent. Extent values should always be in WGS84. The item extent is shown visually so that you can confirm it is set correctly for this item.",
203
+ "SCORING_MSG_DEFAULT": "Points are awarded if the item has a valid extent.",
204
+ "LABEL": "Set a valid item extent",
205
+ "TITLE": "Check Item Extent",
206
+ "NO_EXTENT_MESSAGE": "Extent is not set. Set a valid item extent.",
207
+ "INVALID_EXTENT_MESSAGE": "Extent is not valid. Set a valid item extent.",
208
+ "EXTENT_OUT_OF_RANGE_MESSAGE": "Extent is out of range. Update the item extent to a more appropriate value.",
209
+ "EXTENT_NOT_RECTANGLE_MESSAGE": "Extent is not a rectangle. Update the item extent to a valid rectangle.",
210
+ "EXTENT_IS_POINT_MESSAGE": "Extent is a point. Update the item extent to a more appropriate value.",
211
+ "EXTENT_SET_TO_WORLD_MESSAGE": "Extent is set to the world. Update the item extent to a more appropriate value."
212
+ },
213
+ "featureServiceCDNSetting": {
214
+ "GUIDANCE_DEFAULT": "When a layer is shared publicly, it is cached by a Content Delivery Network (CDN). Using a CDN enhances performance and scalability by delivering content from servers geographically closer to users, significantly reducing latency. If the data is not changing daily, it is recommended to set the cache duration to the maximum (one hour) for best performance.",
215
+ "SCORING_MSG_DEFAULT": "This is an advisory check that does not impact the overall score.",
216
+ "LABEL": "Enable Feature Service CDN Cache",
217
+ "TITLE": "Check CDN Setting",
218
+ "CDN_NOT_ENABLED_MESSAGE": "Enable CDN for the feature service to improve performance and scalability."
219
+ },
220
+ "featureServiceExportDataSetting": {
221
+ "GUIDANCE": "Enabling data export allows others to export the data from your feature service to other formats (e.g. CSV, File Geodatabase, GeoJSON, etc.). Verify that this setting is correct and that it complies with your organization's data sharing, licensing, and privacy policies.",
222
+ "SCORING": "This is an advisory check that does not impact the overall score.",
223
+ "LABEL": "Verify Feature Service Data Export Setting",
224
+ "TITLE": "Check Data Export Setting",
225
+ "EXPORT_DATA_ENABLED_MESSAGE": "Data export is enabled. Confirm this setting is intentional and that it complies with your organization's data sharing, licensing, and privacy policies."
226
+ },
227
+ "featureServiceFieldIndexes": {
228
+ "GUIDANCE": "Field indexes improve the performance of queries and operations on large datasets. By indexing frequently queried fields, you can significantly speed up data retrieval times and enhance overall application performance. It is recommended to review your feature service's fields and add indexes to those that are commonly used in queries, filters, or sorting operations.",
229
+ "SCORING": "This is an advisory check that does not impact the overall score.",
230
+ "LABEL": "Improve Feature Service Field Indexes",
231
+ "TITLE": "Check Field Indexes",
232
+ "NO_FEATURE_LAYER": "This feature service does not have any feature layer or non-spatial table.",
233
+ "IMRPOVE_FIELD_INDEXES": "No non-system generated field indexes found in layer '{{layerName}}'. Consider adding field indexes to frequently queried fields to improve performance."
234
+ },
235
+ "featureServiceExtents": {
236
+ "GUIDANCE": "<p>This advisory check examines your REST endpoint. A feature layer item points to a REST endpoint, which has an Initial Extent and Full Extent on its service, and an Extent on each sublayer in that service. Review each extent in the “Select Extent” option below to ensure your extents are what you would expect.</p><br/><p>If a sublayer is missing an Extent, that layer will cause an error in any geoprocessing tool or function.</p><br/><p>If the service is missing an Initial Extent or Full Extent, that may have negative impacts in apps.</p>",
237
+ "SCORING": "This is an advisory check that does not impact the overall score. Make sure all extents are populated.",
238
+ "LABEL": "Verify Feature Service Extents",
239
+ "TITLE": "Check Feature Service Extents",
240
+ "FULL_EXTENT_ISSUE_MESSAGE": "The Full Extent of the Feature Service is not set or is invalid.",
241
+ "INITIAL_EXTENT_ISSUE_MESSAGE": "The Initial Extent of the Feature Service is not set or is invalid.",
242
+ "LAYER_EXTENT_ISSUE_MESSAGE": "The Extent of layer '{{layerName}}' is not set or is invalid."
203
243
  }
204
244
  }
@@ -1 +1 @@
1
- {"lastCompiledTime":1749141674753}
1
+ {"lastCompiledTime":1764869234420}
@@ -0,0 +1,14 @@
1
+ import { FeatureServiceAdminJSON, IItem } from '../../types';
2
+ /**
3
+ * Fetches the admin JSON of a feature service. This resource provides basic information about the feature service including the feature layers and tables that it contains, the service description, etc.
4
+ * The administrative feature service resource maintains a set of operations that manage the state and contents of the service.
5
+ *
6
+ * @param item - The item representing the feature service.
7
+ * @param token - The token for authentication.
8
+ * @param bypassCache - Whether to bypass the cache (default is false). If true, a query timestamp is added to the request to bypass any cached responses.
9
+ * @returns A promise that resolves to a FeatureServiceAdminJSON object.
10
+ * @throws An error if the item is not a feature service or if the URL is not found.
11
+ *
12
+ * @see https://developers.arcgis.com/rest/services-reference/enterprise/hosted-feature-service/#json-response-syntax
13
+ */
14
+ export declare const fetchFeatureServiceAdminJSON: (item: IItem, token: string, bypassCache?: boolean) => Promise<FeatureServiceAdminJSON>;
@@ -0,0 +1,57 @@
1
+ "use strict";
2
+ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
3
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
4
+ return new (P || (P = Promise))(function (resolve, reject) {
5
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
6
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
7
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
8
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
9
+ });
10
+ };
11
+ Object.defineProperty(exports, "__esModule", { value: true });
12
+ exports.fetchFeatureServiceAdminJSON = void 0;
13
+ const isFeatureService_1 = require("../../lib/util/isFeatureService");
14
+ const getFeatureServerURL_1 = require("./getFeatureServerURL");
15
+ /**
16
+ * Fetches the admin JSON of a feature service. This resource provides basic information about the feature service including the feature layers and tables that it contains, the service description, etc.
17
+ * The administrative feature service resource maintains a set of operations that manage the state and contents of the service.
18
+ *
19
+ * @param item - The item representing the feature service.
20
+ * @param token - The token for authentication.
21
+ * @param bypassCache - Whether to bypass the cache (default is false). If true, a query timestamp is added to the request to bypass any cached responses.
22
+ * @returns A promise that resolves to a FeatureServiceAdminJSON object.
23
+ * @throws An error if the item is not a feature service or if the URL is not found.
24
+ *
25
+ * @see https://developers.arcgis.com/rest/services-reference/enterprise/hosted-feature-service/#json-response-syntax
26
+ */
27
+ const fetchFeatureServiceAdminJSON = (item_1, token_1, ...args_1) => __awaiter(void 0, [item_1, token_1, ...args_1], void 0, function* (item, token, bypassCache = false) {
28
+ if (!item) {
29
+ throw new Error('Item is required');
30
+ }
31
+ if ((0, isFeatureService_1.isFeatureService)(item) === false) {
32
+ throw new Error('Item is not a feature service');
33
+ }
34
+ if (!item.url) {
35
+ throw new Error('URL of the feature service is not found');
36
+ }
37
+ if (!token) {
38
+ throw new Error('Token is required to access admin endpoint');
39
+ }
40
+ // get the feature server URL
41
+ const url = (0, getFeatureServerURL_1.getFeatureServerRootURL)(item.url, true);
42
+ const params = new URLSearchParams({
43
+ f: 'json',
44
+ token,
45
+ });
46
+ if (bypassCache) {
47
+ params.append('queryTimestamp', new Date().getTime().toString());
48
+ }
49
+ const res = yield fetch(`${url}?${params.toString()}`);
50
+ const data = yield res.json();
51
+ if (data.error) {
52
+ throw new Error(data.error.message || 'Error fetching feature service admin JSON');
53
+ }
54
+ return data;
55
+ });
56
+ exports.fetchFeatureServiceAdminJSON = fetchFeatureServiceAdminJSON;
57
+ //# sourceMappingURL=fetchFeatureServiceAdminJSON.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"fetchFeatureServiceAdminJSON.js","sourceRoot":"","sources":["../../../src/services/feature-service/fetchFeatureServiceAdminJSON.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,sEAAmE;AAEnE,+DAAgE;AAEhE;;;;;;;;;;;GAWG;AACI,MAAM,4BAA4B,GAAG,6BAIR,EAAE,oEAHlC,IAAW,EACX,K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erJSON, IItem } from '../../types';
2
2
  /**
3
- * Fetches the layers of a feature service from the ArcGIS REST API.
4
- * @param item - The item representing the feature service.
5
- * @param token - The token for authentication.
6
- * @returns A promise that resolves to an array of FeatureLayerJSON objects.
7
- * @throws An error if the item is not a feature service or if the URL is not found.
3
+ * Fetches the layers and tables from a given feature service item.
4
+ *
5
+ * Attempts to retrieve the feature service layers and tables using the provided authentication token.
6
+ * If an 'Invalid token' error is encountered, it retries the request without the token.
7
+ *
8
+ * @param item - The feature service item to fetch layers and tables from.
9
+ * @param token - The authentication token to use for the request.
10
+ * @param bypassCache - Optional flag to bypass any caching mechanisms. Defaults to false.
11
+ * @returns A promise that resolves to an array of `FeatureLayerJSON` objects representing the layers and tables.
12
+ * @throws Will throw an error if fetching fails, including after retrying without a token.
8
13
  */
9
- export declare const fetchFeatureServiceLayersAndTables: (item: IItem, token: string) => Promise<FeatureLayerJSON[]>;
14
+ export declare const fetchFeatureServiceLayersAndTables: (item: IItem, token: string, bypassCache?: boolean) => Promise<FeatureLayerJSON[]>;
@@ -11,15 +11,51 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
11
11
  Object.defineProperty(exports, "__esModule", { value: true });
12
12
  exports.fetchFeatureServiceLayersAndTables = void 0;
13
13
  const isFeatureService_1 = require("../../lib/util/isFeatureService");
14
+ const getFeatureServerURL_1 = require("./getFeatureServerURL");
15
+ /**
16
+ * Fetches the layers and tables from a given feature service item.
17
+ *
18
+ * Attempts to retrieve the feature service layers and tables using the provided authentication token.
19
+ * If an 'Invalid token' error is encountered, it retries the request without the token.
20
+ *
21
+ * @param item - The feature service item to fetch layers and tables from.
22
+ * @param token - The authentication token to use for the request.
23
+ * @param bypassCache - Optional flag to bypass any caching mechanisms. Defaults to false.
24
+ * @returns A promise that resolves to an array of `FeatureLayerJSON` objects representing the layers and tables.
25
+ * @throws Will throw an error if fetching fails, including after retrying without a token.
26
+ */
27
+ const fetchFeatureServiceLayersAndTables = (item_1, token_1, ...args_1) => __awaiter(void 0, [item_1, token_1, ...args_1], void 0, function* (item, token, bypassCache = false) {
28
+ try {
29
+ return yield fetchFeatureServiceLayersAndTablesHelper(item, token, bypassCache);
30
+ }
31
+ catch (error) {
32
+ // Check for 'Invalid token' error and retry without token
33
+ if (error instanceof Error &&
34
+ error.message &&
35
+ error.message.toLowerCase().includes('invalid token')) {
36
+ try {
37
+ console.warn('Invalid token error detected while fetching feature service layers. Retrying without token...');
38
+ return yield fetchFeatureServiceLayersAndTablesHelper(item, undefined, bypassCache);
39
+ }
40
+ catch (retryError) {
41
+ console.error('Error fetching feature service layers and tables after retry:', retryError);
42
+ throw retryError;
43
+ }
44
+ }
45
+ console.error('Error fetching feature service layers and tables:', error);
46
+ throw error; // rethrow the error for the caller to handle
47
+ }
48
+ });
49
+ exports.fetchFeatureServiceLayersAndTables = fetchFeatureServiceLayersAndTables;
14
50
  /**
15
51
  * Fetches the layers of a feature service from the ArcGIS REST API.
16
52
  * @param item - The item representing the feature service.
17
53
  * @param token - The token for authentication.
54
+ * @param bypassCache - Whether to bypass the cache (default is false). If true, a query timestamp is added to the request to bypass any cached responses.
18
55
  * @returns A promise that resolves to an array of FeatureLayerJSON objects.
19
56
  * @throws An error if the item is not a feature service or if the URL is not found.
20
57
  */
21
- const fetchFeatureServiceLayersAndTables = (item, token) => __awaiter(void 0, void 0, void 0, function* () {
22
- var _a;
58
+ const fetchFeatureServiceLayersAndTablesHelper = (item_1, token_1, ...args_1) => __awaiter(void 0, [item_1, token_1, ...args_1], void 0, function* (item, token, bypassCache = false) {
23
59
  if (!item) {
24
60
  throw new Error('Item is required');
25
61
  }
@@ -29,21 +65,25 @@ const fetchFeatureServiceLayersAndTables = (item, token) => __awaiter(void 0, vo
29
65
  if (!item.url) {
30
66
  throw new Error('URL of the feature service is not found');
31
67
  }
32
- try {
33
- const res = yield fetch(`${item.url}/layers?f=json&token=${token}`);
34
- const data = yield res.json();
35
- if (data.error) {
36
- throw new Error('Error fetching feature service data: ' +
37
- (((_a = data === null || data === void 0 ? void 0 : data.error) === null || _a === void 0 ? void 0 : _a.message) || 'Unknown error'));
38
- }
39
- const layers = data.layers || [];
40
- const tables = data.tables || [];
41
- const layersAndTables = [...layers, ...tables];
42
- return layersAndTables;
68
+ // get the feature server URL
69
+ const url = (0, getFeatureServerURL_1.getFeatureServerRootURL)(item.url);
70
+ const params = new URLSearchParams({
71
+ f: 'json',
72
+ });
73
+ if (token) {
74
+ params.append('token', token);
43
75
  }
44
- catch (error) {
45
- throw new Error('Error fetching feature service data: ' + error);
76
+ if (bypassCache) {
77
+ params.append('queryTimestamp', new Date().getTime().toString());
78
+ }
79
+ const res = yield fetch(`${url}/layers?${params.toString()}`);
80
+ const data = yield res.json();
81
+ if (data.error) {
82
+ throw new Error(data.error.message || 'Error fetching feature service layers');
46
83
  }
84
+ const layers = data.layers || [];
85
+ const tables = data.tables || [];
86
+ const layersAndTables = [...layers, ...tables];
87
+ return layersAndTables;
47
88
  });
48
- exports.fetchFeatureServiceLayersAndTables = fetchFeatureServiceLayersAndTables;
49
89
  //# sourceMappingURL=fetchFeatureServiceLayersAndTables.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"fetchFeatureServiceLayersAndTables.js","sourceRoot":"","sources":["../../../src/services/feature-service/fetchFeatureServiceLayersAndTables.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,sEAAmE;AAQnE;;;;;;GAMG;AACI,MAAM,kCAAkC,GAAG,CAC9C,IAAW,EACX,KAAa,EACc,EAAE;;IAC7B,IAAI,CAAC,IAAI,EAAE,CAAC;QACR,MAAM,IAAI,KAAK,CAAC,kBAAkB,CAAC,CAAC;IACxC,CAAC;IAED,IAAI,IAAA,mCAAgB,EAAC,IAAI,CAAC,KAAK,KAAK,EAAE,CAAC;QACnC,MAAM,IAAI,KAAK,CAAC,+BAA+B,CAAC,CAAC;IACrD,CAAC;IAED,IAAI,CAAC,IAAI,CAAC,GAAG,EAAE,CAAC;QACZ,MAAM,IAAI,KAAK,CAAC,yCAAyC,CAAC,CAAC;IAC/D,CAAC;IAED,IAAI,CAAC;QACD,MAAM,GAAG,GAAG,MAAM,KAAK,CAAC,GAAG,IAAI,CAAC,GAAG,wBAAwB,KAAK,EAAE,CAAC,CAAC;QACpE,MAAM,IAAI,GAAiC,MAAM,GAAG,CAAC,IAAI,EAAE,CAAC;QAE5D,IAAI,IAAI,CAAC,KAAK,EAAE,CAAC;YACb,MAAM,IAAI,KAAK,CACX,uCAAuC;gBACnC,CAAC,CAAA,MAAA,IAAI,aAAJ,IAAI,uBAAJ,IAAI,CAAE,KAAK,0CAAE,OAAO,KAAI,eAAe,CAAC,CAChD,CAAC;QACN,CAAC;QAED,MAAM,MAAM,GAAG,IAAI,CAAC,MAAM,IAAI,EAAE,CAAC;QACjC,MAAM,MAAM,GAAG,IAAI,CAAC,MAAM,IAAI,EAAE,CAAC;QAEjC,MAAM,eAAe,GAAG,CAAC,GAAG,MAAM,EAAE,GAAG,MAAM,CAAC,CAAC;QAE/C,OAAO,eAAe,CAAC;IAC3B,CAAC;IAAC,OAAO,KAAK,EAAE,CAAC;QACb,MAAM,IAAI,KAAK,CAAC,uCAAuC,GAAG,KAAK,CAAC,CAAC;IACrE,CAAC;AACL,CAAC,CAAA,CAAC;AApCW,QAAA,kCAAkC,sCAoC7C"}
1
+ {"version":3,"file":"fetchFeatureServiceLayersAndTables.js","sourceRoot":"","sources":["../../../src/services/feature-service/fetchFeatureServiceLayersAndTables.ts"],"names":[],"mappings":";;;;;;;;;;;;AACA,sEAAmE;AAOnE,+DAAgE;AAEhE;;;;;;;;;;;GAWG;AACI,MAAM,kCAAkC,GAAG,6BAInB,EAAE,oEAH7B,IAAW,EACX,KAAa,EACb,WAAW,GAAG,KAAK;IAEnB,IAAI,CAAC;QACD,OAAO,MAAM,wCAAwC,CACjD,IAAI,EACJ,KAAK,EACL,WAAW,CACd,CAAC;IACN,CAAC;IAAC,OAAO,KAAU,EAAE,CAAC;QAClB,0DAA0D;QAC1D,IACI,KAAK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AAM,CAAC,MAAM,CAAC,OAAO,EAAE,KAAK,CAAC,CAAC;IAClC,CAAC;IAED,IAAI,WAAW,EAAE,CAAC;QACd,MAAM,CAAC,MAAM,CAAC,gBAAgB,EAAE,IAAI,IAAI,EAAE,CAAC,OAAO,EAAE,CAAC,QAAQ,EAAE,CAAC,CAAC;IACrE,CAAC;IAED,MAAM,GAAG,GAAG,MAAM,KAAK,CAAC,GAAG,GAAG,WAAW,MAAM,CAAC,QAAQ,EAAE,EAAE,CAAC,CAAC;IAC9D,MAAM,IAAI,GAAiC,MAAM,GAAG,CAAC,IAAI,EAAE,CAAC;IAE5D,IAAI,IAAI,CAAC,KAAK,EAAE,CAAC;QACb,MAAM,IAAI,KAAK,CACX,IAAI,CAAC,KAAK,CAAC,OAAO,IAAI,uCAAuC,CAChE,CAAC;IACN,CAAC;IAED,MAAM,MAAM,GAAG,IAAI,CAAC,MAAM,IAAI,EAAE,CAAC;IACjC,MAAM,MAAM,GAAG,IAAI,CAAC,MAAM,IAAI,EAAE,CAAC;IAEjC,MAAM,eAAe,GAAG,CAAC,GAAG,MAAM,EAAE,GAAG,MAAM,CAAC,CAAC;IAE/C,OAAO,eAAe,CAAC;AAC3B,CAAC,CAAA,CAAC"}
@@ -0,0 +1,16 @@
1
+ import { FeatureServiceJSON, IItem } from '../../types';
2
+ /**
3
+ * Fetches the root JSON of a feature service. This resource provides basic information about the feature service,
4
+ * including the feature layers and tables that it contains, the service description, and so on.
5
+ *
6
+ * If an 'Invalid token' error is encountered, it retries the request without the token.
7
+ *
8
+ * @param item - The item representing the feature service.
9
+ * @param token - The token for authentication.
10
+ * @param bypassCache - Whether to bypass the cache (default is false). If true, a query timestamp is added to the request to bypass any cached responses.
11
+ * @returns {FeatureServiceJSON} A promise that resolves to a FeatureServiceJSON object.
12
+ * @throws An error if the item is not a feature service or if the URL is not found.
13
+ *
14
+ * @see https://developers.arcgis.com/rest/services-reference/enterprise/feature-service/
15
+ */
16
+ export declare const fetchFeatureServiceRootJSON: (item: IItem, token: string, bypassCache?: boolean) => Promise<FeatureServiceJSON>;
@@ -0,0 +1,84 @@
1
+ "use strict";
2
+ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
3
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
4
+ return new (P || (P = Promise))(function (resolve, reject) {
5
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
6
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
7
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
8
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
9
+ });
10
+ };
11
+ Object.defineProperty(exports, "__esModule", { value: true });
12
+ exports.fetchFeatureServiceRootJSON = void 0;
13
+ const isFeatureService_1 = require("../../lib/util/isFeatureService");
14
+ const getFeatureServerURL_1 = require("./getFeatureServerURL");
15
+ /**
16
+ * Fetches the root JSON of a feature service. This resource provides basic information about the feature service,
17
+ * including the feature layers and tables that it contains, the service description, and so on.
18
+ *
19
+ * If an 'Invalid token' error is encountered, it retries the request without the token.
20
+ *
21
+ * @param item - The item representing the feature service.
22
+ * @param token - The token for authentication.
23
+ * @param bypassCache - Whether to bypass the cache (default is false). If true, a query timestamp is added to the request to bypass any cached responses.
24
+ * @returns {FeatureServiceJSON} A promise that resolves to a FeatureServiceJSON object.
25
+ * @throws An error if the item is not a feature service or if the URL is not found.
26
+ *
27
+ * @see https://developers.arcgis.com/rest/services-reference/enterprise/feature-service/
28
+ */
29
+ const fetchFeatureServiceRootJSON = (item_1, token_1, ...args_1) => __awaiter(void 0, [item_1, token_1, ...args_1], void 0, function* (item, token, bypassCache = false) {
30
+ try {
31
+ return yield fetchFeatureServiceRootHelper(item, token, bypassCache);
32
+ }
33
+ catch (error) {
34
+ // Check for 'Invalid token' error and retry without token
35
+ if (error instanceof Error &&
36
+ error.message &&
37
+ error.message.toLowerCase().includes('invalid token')) {
38
+ try {
39
+ console.warn('Invalid token error detected while fetching feature service root JSON. Retrying without token...');
40
+ return yield fetchFeatureServiceRootHelper(item, undefined, bypassCache);
41
+ }
42
+ catch (retryError) {
43
+ console.error('Error fetching feature service root JSON retry:', retryError);
44
+ throw retryError;
45
+ }
46
+ }
47
+ console.error('Error fetching feature service layers and tables:', error);
48
+ throw error; // rethrow the error for the caller to handle
49
+ }
50
+ });
51
+ exports.fetchFeatureServiceRootJSON = fetchFeatureServiceRootJSON;
52
+ const fetchFeatureServiceRootHelper = (item_1, token_1, ...args_1) => __awaiter(void 0, [item_1, token_1, ...args_1], void 0, function* (item, token, bypassCache = false) {
53
+ if (!item) {
54
+ throw new Error('Item is required');
55
+ }
56
+ if ((0, isFeatureService_1.isFeatureService)(item) === false) {
57
+ throw new Error('Item is not a feature service');
58
+ }
59
+ if (!item.url) {
60
+ throw new Error('URL of the feature service is not found');
61
+ }
62
+ // if (!token) {
63
+ // throw new Error('Token is required to access admin endpoint');
64
+ // }
65
+ // get the feature server URL
66
+ const url = (0, getFeatureServerURL_1.getFeatureServerRootURL)(item.url);
67
+ const params = new URLSearchParams({
68
+ f: 'json',
69
+ // token,
70
+ });
71
+ if (token) {
72
+ params.append('token', token);
73
+ }
74
+ if (bypassCache) {
75
+ params.append('queryTimestamp', new Date().getTime().toString());
76
+ }
77
+ const res = yield fetch(`${url}?${params.toString()}`);
78
+ const data = yield res.json();
79
+ if (data.error) {
80
+ throw new Error(data.error.message || 'Error fetching feature service admin JSON');
81
+ }
82
+ return data;
83
+ });
84
+ //# sourceMappingURL=fetchFeatureServiceRootJSON.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"fetchFeatureServiceRootJSON.js","sourceRoot":"","sources":["../../../src/services/feature-service/fetchFeatureServiceRootJSON.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,sEAAmE;AAEnE,+DAAgE;AAEhE;;;;;;;;;;;;;GAaG;AACI,MAAM,2BAA2B,GAAG,6BAIZ,EAAE,oEAH7B,IAAW,EACX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I;IAEJ,6BAA6B;IAC7B,MAAM,GAAG,GAAG,IAAA,6CAAuB,EAAC,IAAI,CAAC,GAAG,CAAC,CAAC;IAE9C,MAAM,MAAM,GAAG,IAAI,eAAe,CAAC;QAC/B,CAAC,EAAE,MAAM;QACT,SAAS;KACZ,CAAC,CAAC;IAEH,IAAI,KAAK,EAAE,CAAC;QACR,MAAM,CAAC,MAAM,CAAC,OAAO,EAAE,KAAK,CAAC,CAAC;IAClC,CAAC;IAED,IAAI,WAAW,EAAE,CAAC;QACd,MAAM,CAAC,MAAM,CAAC,gBAAgB,EAAE,IAAI,IAAI,EAAE,CAAC,OAAO,EAAE,CAAC,QAAQ,EAAE,CAAC,CAAC;IACrE,CAAC;IAED,MAAM,GAAG,GAAG,MAAM,KAAK,CAAC,GAAG,GAAG,IAAI,MAAM,CAAC,QAAQ,EAAE,EAAE,CAAC,CAAC;IACvD,MAAM,IAAI,GAAG,MAAM,GAAG,CAAC,IAAI,EAAE,CAAC;IAE9B,IAAI,IAAI,CAAC,KAAK,EAAE,CAAC;QACb,MAAM,IAAI,KAAK,CACX,IAAI,CAAC,KAAK,CAAC,OAAO,IAAI,2CAA2C,CACpE,CAAC;IACN,CAAC;IAED,OAAO,IAA0B,CAAC;AACtC,CAAC,CAAA,CAAC"}
@@ -0,0 +1,12 @@
1
+ /**
2
+ * Returns the URL of the FeatureServer endpoint for a given item URL.
3
+ *
4
+ * - If the input URL is empty or falsy, returns an empty string.
5
+ * - If the URL already ends with '/FeatureServer', returns it as is.
6
+ * - If the URL ends with a trailing slash, removes it.
7
+ * - If the URL ends with a layer or table index (e.g., '/0'), removes the index.
8
+ *
9
+ * @param itemUrl - The URL of the item to process.
10
+ * @returns The normalized FeatureServer URL.
11
+ */
12
+ export declare const getFeatureServerRootURL: (itemUrl: string, amdinEndPoint?: boolean) => string;
@@ -0,0 +1,37 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.getFeatureServerRootURL = void 0;
4
+ const getFeatureServerAdminRootURL = (itemUrl) => {
5
+ if (!itemUrl) {
6
+ return '';
7
+ }
8
+ itemUrl = itemUrl.replace(/\/rest\/services/i, '/rest/admin/services');
9
+ return itemUrl;
10
+ };
11
+ /**
12
+ * Returns the URL of the FeatureServer endpoint for a given item URL.
13
+ *
14
+ * - If the input URL is empty or falsy, returns an empty string.
15
+ * - If the URL already ends with '/FeatureServer', returns it as is.
16
+ * - If the URL ends with a trailing slash, removes it.
17
+ * - If the URL ends with a layer or table index (e.g., '/0'), removes the index.
18
+ *
19
+ * @param itemUrl - The URL of the item to process.
20
+ * @returns The normalized FeatureServer URL.
21
+ */
22
+ const getFeatureServerRootURL = (itemUrl, amdinEndPoint = false) => {
23
+ if (!itemUrl) {
24
+ return '';
25
+ }
26
+ if (itemUrl.endsWith('/FeatureServer')) {
27
+ return amdinEndPoint ? getFeatureServerAdminRootURL(itemUrl) : itemUrl; // Return as is if it already ends with /FeatureServer
28
+ }
29
+ if (itemUrl.endsWith('/')) {
30
+ itemUrl = itemUrl.slice(0, -1); // Remove trailing slash
31
+ }
32
+ // /\/\d+$/ matches a forward slash (/) followed by one or more digits (\d+) at the end of the string ($).
33
+ itemUrl = itemUrl.replace(/\/\d+$/, '');
34
+ return amdinEndPoint ? getFeatureServerAdminRootURL(itemUrl) : itemUrl;
35
+ };
36
+ exports.getFeatureServerRootURL = getFeatureServerRootURL;
37
+ //# sourceMappingURL=getFeatureServerURL.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"getFeatureServerURL.js","sourceRoot":"","sources":["../../../src/services/feature-service/getFeatureServerURL.ts"],"names":[],"mappings":";;;AAAA,MAAM,4BAA4B,GAAG,CAAC,OAAe,EAAU,EAAE;IAC7D,IAAI,CAAC,OAAO,EAAE,CAAC;QACX,OAAO,EAAE,CAAC;IACd,CAAC;IAED,OAAO,GAAG,OAAO,CAAC,OAAO,CAAC,mBAAmB,EAAE,sBAAsB,CAAC,CAAC;IAEvE,OAAO,OAAO,CAAC;AACnB,CAAC,CAAC;AAEF;;;;;;;;;;GAUG;AACI,MAAM,uBAAuB,GAAG,CACnC,OAAe,EACf,aAAa,GAAG,KAAK,EACf,EAAE;IACR,IAAI,CAAC,OAAO,EAAE,CAAC;QACX,OAAO,EAAE,CAAC;IACd,CAAC;IAED,IAAI,OAAO,CAAC,QAAQ,CAAC,gBAAgB,CAAC,EAAE,CAAC;QACrC,OAAO,aAAa,CAAC,CAAC,CAAC,4BAA4B,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC,sDAAsD;IAClI,CAAC;IAED,IAAI,OAAO,CAAC,QAAQ,CAAC,GAAG,CAAC,EAAE,CAAC;QACxB,OAAO,GAAG,OAAO,CAAC,KAAK,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC,CAAC,wBAAwB;IAC5D,CAAC;IAED,0GAA0G;IAC1G,OAAO,GAAG,OAAO,CAAC,OAAO,CAAC,QAAQ,EAAE,EAAE,CAAC,CAAC;IAExC,OAAO,aAAa,CAAC,CAAC,CAAC,4BAA4B,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC,OAAO,CAAC;AAC3E,CAAC,CAAC;AApBW,QAAA,uBAAuB,2BAoBlC"}