@vannizhang/living-atlas-content-validator 1.5.19-beta.14 → 1.5.19-beta.15

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.
@@ -1 +1 @@
1
- {"lastCompiledTime":1749668808831}
1
+ {"lastCompiledTime":1749674712270}
@@ -1,2 +1,14 @@
1
1
  import { FeatureLayerJSON, IItem } from '../../types';
2
- export declare const fetchFeatureServiceLayersAndTables: (item: IItem, token: string) => Promise<FeatureLayerJSON[]>;
2
+ /**
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.
13
+ */
14
+ export declare const fetchFeatureServiceLayersAndTables: (item: IItem, token: string, bypassCache?: boolean) => Promise<FeatureLayerJSON[]>;
@@ -12,9 +12,21 @@ Object.defineProperty(exports, "__esModule", { value: true });
12
12
  exports.fetchFeatureServiceLayersAndTables = void 0;
13
13
  const isFeatureService_1 = require("../../lib/util/isFeatureService");
14
14
  const getFeatureServerURL_1 = require("./getFeatureServerURL");
15
- const fetchFeatureServiceLayersAndTables = (item, token) => __awaiter(void 0, void 0, void 0, function* () {
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) {
16
28
  try {
17
- return yield fetchFeatureServiceLayersAndTablesHelper(item, token);
29
+ return yield fetchFeatureServiceLayersAndTablesHelper(item, token, bypassCache);
18
30
  }
19
31
  catch (error) {
20
32
  // Check for 'Invalid token' error and retry without token
@@ -23,7 +35,7 @@ const fetchFeatureServiceLayersAndTables = (item, token) => __awaiter(void 0, vo
23
35
  error.message.toLowerCase().includes('invalid token')) {
24
36
  try {
25
37
  console.warn('Invalid token error detected while fetching feature service layers. Retrying without token...');
26
- return yield fetchFeatureServiceLayersAndTablesHelper(item, undefined);
38
+ return yield fetchFeatureServiceLayersAndTablesHelper(item, undefined, bypassCache);
27
39
  }
28
40
  catch (retryError) {
29
41
  console.error('Error fetching feature service layers and tables after retry:', retryError);
@@ -39,10 +51,11 @@ exports.fetchFeatureServiceLayersAndTables = fetchFeatureServiceLayersAndTables;
39
51
  * Fetches the layers of a feature service from the ArcGIS REST API.
40
52
  * @param item - The item representing the feature service.
41
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.
42
55
  * @returns A promise that resolves to an array of FeatureLayerJSON objects.
43
56
  * @throws An error if the item is not a feature service or if the URL is not found.
44
57
  */
45
- const fetchFeatureServiceLayersAndTablesHelper = (item, token) => __awaiter(void 0, void 0, void 0, function* () {
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) {
46
59
  if (!item) {
47
60
  throw new Error('Item is required');
48
61
  }
@@ -60,6 +73,9 @@ const fetchFeatureServiceLayersAndTablesHelper = (item, token) => __awaiter(void
60
73
  if (token) {
61
74
  params.append('token', token);
62
75
  }
76
+ if (bypassCache) {
77
+ params.append('queryTimestamp', new Date().getTime().toString());
78
+ }
63
79
  const res = yield fetch(`${url}/layers?${params.toString()}`);
64
80
  const data = yield res.json();
65
81
  if (data.error) {
@@ -1 +1 @@
1
- {"version":3,"file":"fetchFeatureServiceLayersAndTables.js","sourceRoot":"","sources":["../../../src/services/feature-service/fetchFeatureServiceLayersAndTables.ts"],"names":[],"mappings":";;;;;;;;;;;;AACA,sEAAmE;AAOnE,+DAAgE;AAEzD,MAAM,kCAAkC,GAAG,CAC9C,IAAW,EACX,KAAa,EACc,EAAE;IAC7B,IAAI,CAAC;QACD,OAAO,MAAM,wCAAwC,CAAC,IAAI,EAAE,KAAK,CAAC,CAAC;IACvE,CAAC;IAAC,OAAO,KAAU,EAAE,CAAC;QAClB,0DAA0D;QAC1D,IACI,KAAK,YAAY,KAAK;YACtB,KAAK,CAAC,OAAO;YACb,KAAK,CAAC,OAAO,CAAC,WAAW,EAAE,CAAC,QAAQ,CAAC,eAAe,CAAC,EACvD,CAAC;YACC,IAAI,CAAC;gBACD,OAAO,CAAC,IAAI,CACR,+FAA+F,CAClG,CAAC;gBACF,OAAO,MAAM,wCAAwC,CACjD,IAAI,EACJ,SAAS,CACZ,CAAC;YACN,CAAC;YAAC,OAAO,UAAU,EAAE,CAAC;gBAClB,OAAO,CAAC,KAAK,CACT,+DAA+D,EAC/D,UAAU,CACb,CAAC;gBACF,MAAM,UAAU,CAAC;YACrB,CAAC;QACL,CAAC;QACD,OAAO,CAAC,KAAK,CACT,mDAAmD,EACnD,KAAK,CACR,CAAC;QACF,MAAM,KAAK,CAAC,CAAC,6CAA6C;IAC9D,CAAC;AACL,CAAC,CAAA,CAAC;AAnCW,QAAA,kCAAkC,sCAmC7C;AAEF;;;;;;GAMG;AACH,MAAM,wCAAwC,GAAG,CAC7C,IAAW,EACX,KAAc,EACa,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,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;KACZ,CAAC,CAAC;IAEH,IAAI,KAAK,EAAE,CAAC;QACR,MAAM,CAAC,MAAM,CAAC,OAAO,EAAE,KAAK,CAAC,CAAC;IAClC,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"}
1
+ {"version":3,"file":"fetchFeatureServiceLayersAndTables.js","sourceRoot":"","sources":["../../../src/services/feature-service/fetchFeatureServiceLayersAndTables.ts"],"names":[],"mappings":";;;;;;;;;;;;AACA,sEAAmE;AAOnE,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,CAAC;QACZ,MAAM,IAAI,KAAK,CAAC,yCAAyC,CAAC,CAAC;IAC/D,CAAC;IAED,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;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,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"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@vannizhang/living-atlas-content-validator",
3
- "version": "1.5.19-beta.14",
3
+ "version": "1.5.19-beta.15",
4
4
  "description": "Validation and Scoring rules for curating content in the ArcGIS Living Atlas",
5
5
  "repository": {
6
6
  "type": "git",