@arcgis/coding-components
Version:
ArcGIS Coding Components
185 lines (184 loc) • 5.45 kB
JavaScript
/* COPYRIGHT Esri - https://js.arcgis.com/5.1/LICENSE.txt */
import p from "@arcgis/core/layers/FeatureLayer.js";
import y from "@arcgis/core/request.js";
function S(e) {
return !!e && typeof e == "object" && "declaredClass" in e && typeof e.declaredClass == "string" && e.declaredClass.startsWith("esri.layers.") && a(e) && "queryFeatures" in e && typeof e.queryFeatures == "function";
}
function f(e) {
return !!e && typeof e == "object" && "declaredClass" in e && typeof e.declaredClass == "string" && (e.declaredClass === "esri.Map" || e.declaredClass === "esri.WebMap" || e.declaredClass === "esri.WebScene");
}
function T(e) {
return !!e && typeof e == "object" && "loadAll" in e && typeof e.loadAll == "function";
}
function c(e) {
return !!e && typeof e == "object" && "portalItem" in e && e.portalItem != null;
}
function l(e) {
return !!e && typeof e == "object" && "portalItem" in e && e.portalItem != null;
}
function a(e) {
return !!e && typeof e == "object" && "fields" in e && Array.isArray(e.fields);
}
function o(e) {
return !!e && typeof e == "object" && "url" in e && typeof e.url == "string";
}
function d(e) {
return o(e) && /\/(?:featureserver|mapserver)(?:\/|$)/iu.test(e.url ?? "");
}
function u(e) {
return o(e) || a(e) || l(e);
}
function A(e) {
return u(e) && "type" in e && e.type === "voxel";
}
function h(e) {
return u(e) && "type" in e && (e.type === "imagery" || e.type === "imagery-tile");
}
function V(e) {
return o(e) || a(e) || l(e);
}
function q(e) {
return c(e) || f(e) || d(e);
}
function x(e) {
return !!e && typeof e == "object" && "declaredClass" in e && e.declaredClass === "esri.layers.support.Subtype";
}
function w(e) {
return !!e && typeof e == "object" && "declaredClass" in e && e.declaredClass === "esri.layers.support.CodedValueDomain";
}
function P(e) {
return !!e && typeof e == "object" && "declaredClass" in e && e.declaredClass === "esri.layers.support.InheritedDomain";
}
function v(e) {
return !!e && typeof e == "object" && "id" in e && typeof e.id == "string" && "definitions" in e && typeof e.definitions == "object" && !Array.isArray(e.definitions);
}
function M(e) {
return !!e && typeof e == "object" && "title" in e && typeof e.title == "string";
}
function U(e) {
return !!e && typeof e == "object" && "url" in e && typeof e.url == "string";
}
function b(e) {
return !!e && typeof e == "object" && "layerId" in e && typeof e.layerId == "number";
}
function k(e) {
return !!e && typeof e == "object" && "typeIdField" in e && "types" in e;
}
function W(e) {
return !!e && typeof e == "object" && "getFieldDomain" in e && typeof e.getFieldDomain == "function";
}
function C(e) {
return !!e && typeof e == "object" && "subtypeField" in e;
}
function E(e) {
return C(e) && "subtypes" in e;
}
function G(e) {
return !!e && typeof e == "object" && "portalItem" in e;
}
function R(e) {
return b(e) && "relationships" in e && "url" in e && Array.isArray(e.relationships) && typeof e.url == "string";
}
function g(e) {
return !!e && typeof e == "object" && "isTable" in e && typeof e.isTable == "boolean";
}
function j(e) {
if (e && typeof e == "object") {
if (g(e))
return e.isTable || "type" in e && e.type === "table";
if ("geometryType" in e)
return e.geometryType === "" || e.geometryType === "esriGeometryNull" || e.geometryType === null;
}
return !1;
}
function z(e) {
return !j(e);
}
function D(e) {
return !!e && typeof e == "object" && "load" in e && typeof e.load == "function";
}
function B(e) {
return !!e && typeof e == "object" && "type" in e && e.type === "voxel";
}
function H(e) {
return !!e && typeof e == "object" && "type" in e && typeof e.type == "string" && ["imagery", "imagery-tile"].includes(e.type);
}
function N(e) {
return !!e && typeof e == "object" && "id" in e && typeof e.id == "string" && "serviceUrl" in e && typeof e.serviceUrl == "string" && "portal" in e && !!e.portal && typeof e.portal == "object" && "url" in e.portal && typeof e.portal.url == "string";
}
function O(e) {
return !!e && "intlStrings" in e && "policy" in e;
}
function $(e) {
return e?.type === "featureSet";
}
function J(e) {
return e?.type === "dataCatalogDatastore";
}
function I(e) {
return !!e && "datasetInfo" in e;
}
function K(e) {
return !!e && e.type !== "dataCatalogDatastore" && !I(e);
}
async function Q(e) {
if (!e)
return null;
let r;
return a(e) ? r = e : r = new p(e), D(r) && await r.load(), r;
}
async function X(e) {
e += "/layers";
const r = await y(e, { responseType: "json", query: { f: "json" } }), n = e.endsWith("MapServer/layers") ? "data" : "query", s = i(r.data?.layers, n), t = i(r.data?.tables, n);
return { layers: s, tables: t };
}
function i(e, r) {
return e ? e.filter((n) => {
switch (n.type) {
case "Feature Layer":
case "Oriented Imagery Layer":
case "Catalog Layer":
case "Table":
return (n.capabilities ? n.capabilities.toLowerCase().split(",").map((t) => t.trim()) : []).includes(r);
default:
return !1;
}
}) : [];
}
export {
U as A,
b as B,
C,
W as D,
k as E,
E as F,
w as G,
x as H,
P as I,
q as a,
V as b,
A as c,
h as d,
u as e,
K as f,
O as g,
$ as h,
v as i,
I as j,
J as k,
N as l,
g as m,
R as n,
f as o,
o as p,
c as q,
T as r,
X as s,
S as t,
M as u,
Q as v,
z as w,
B as x,
H as y,
G as z
};