@vertigis/arcgis-rest-client 16.6.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +30 -0
- package/auth/index.d.ts +7 -0
- package/auth/index.js +1 -0
- package/auth/models/AuthResult.d.ts +9 -0
- package/auth/models/AuthResult.js +0 -0
- package/auth/models/Identity.d.ts +9 -0
- package/auth/models/Identity.js +0 -0
- package/auth/models/Principal.d.ts +11 -0
- package/auth/models/Principal.js +0 -0
- package/auth/models/PrincipalAuthChallenge.d.ts +9 -0
- package/auth/models/PrincipalAuthChallenge.js +0 -0
- package/package.json +68 -0
- package/portal/index.d.ts +59 -0
- package/portal/index.js +1 -0
- package/portal/models/AddDocumentParams.d.ts +9 -0
- package/portal/models/AddDocumentParams.js +0 -0
- package/portal/models/AddDocumentResourcesParams.d.ts +9 -0
- package/portal/models/AddDocumentResourcesParams.js +0 -0
- package/portal/models/Document.d.ts +20 -0
- package/portal/models/Document.js +0 -0
- package/portal/models/PortalAddFolderParams.d.ts +5 -0
- package/portal/models/PortalAddFolderParams.js +0 -0
- package/portal/models/PortalAddFolderResult.d.ts +5 -0
- package/portal/models/PortalAddFolderResult.js +0 -0
- package/portal/models/PortalAddItemParams.d.ts +6 -0
- package/portal/models/PortalAddItemParams.js +0 -0
- package/portal/models/PortalAddItemResourcesParams.d.ts +9 -0
- package/portal/models/PortalAddItemResourcesParams.js +0 -0
- package/portal/models/PortalAddItemResult.d.ts +6 -0
- package/portal/models/PortalAddItemResult.js +0 -0
- package/portal/models/PortalAppInfo.d.ts +7 -0
- package/portal/models/PortalAppInfo.js +0 -0
- package/portal/models/PortalCommonParams.d.ts +4 -0
- package/portal/models/PortalCommonParams.js +0 -0
- package/portal/models/PortalCredentials.d.ts +5 -0
- package/portal/models/PortalCredentials.js +0 -0
- package/portal/models/PortalDeleteItemResourcesParams.d.ts +5 -0
- package/portal/models/PortalDeleteItemResourcesParams.js +0 -0
- package/portal/models/PortalDeleteItemResult.d.ts +5 -0
- package/portal/models/PortalDeleteItemResult.js +0 -0
- package/portal/models/PortalError.d.ts +6 -0
- package/portal/models/PortalError.js +0 -0
- package/portal/models/PortalFolder.d.ts +6 -0
- package/portal/models/PortalFolder.js +0 -0
- package/portal/models/PortalGroup.d.ts +23 -0
- package/portal/models/PortalGroup.js +0 -0
- package/portal/models/PortalGroupsResponse.d.ts +6 -0
- package/portal/models/PortalGroupsResponse.js +0 -0
- package/portal/models/PortalGroupsSearchParams.d.ts +9 -0
- package/portal/models/PortalGroupsSearchParams.js +0 -0
- package/portal/models/PortalGroupsSearchResult.d.ts +10 -0
- package/portal/models/PortalGroupsSearchResult.js +0 -0
- package/portal/models/PortalItem.d.ts +40 -0
- package/portal/models/PortalItem.js +0 -0
- package/portal/models/PortalItemParams.d.ts +14 -0
- package/portal/models/PortalItemParams.js +0 -0
- package/portal/models/PortalItemProtectionResult.d.ts +3 -0
- package/portal/models/PortalItemProtectionResult.js +0 -0
- package/portal/models/PortalItemResource.d.ts +6 -0
- package/portal/models/PortalItemResource.js +0 -0
- package/portal/models/PortalItemResourcesResult.d.ts +5 -0
- package/portal/models/PortalItemResourcesResult.js +0 -0
- package/portal/models/PortalItemSharingParams.d.ts +8 -0
- package/portal/models/PortalItemSharingParams.js +0 -0
- package/portal/models/PortalItemSharingResult.d.ts +7 -0
- package/portal/models/PortalItemSharingResult.js +0 -0
- package/portal/models/PortalPagingParams.d.ts +4 -0
- package/portal/models/PortalPagingParams.js +0 -0
- package/portal/models/PortalPagingResult.d.ts +7 -0
- package/portal/models/PortalPagingResult.js +0 -0
- package/portal/models/PortalPublishFileType.d.ts +16 -0
- package/portal/models/PortalPublishFileType.js +1 -0
- package/portal/models/PortalPublishItemParams.d.ts +8 -0
- package/portal/models/PortalPublishItemParams.js +0 -0
- package/portal/models/PortalPublishItemResult.d.ts +4 -0
- package/portal/models/PortalPublishItemResult.js +0 -0
- package/portal/models/PortalPublishParams.d.ts +3 -0
- package/portal/models/PortalPublishParams.js +0 -0
- package/portal/models/PortalPublishServiceResult.d.ts +9 -0
- package/portal/models/PortalPublishServiceResult.js +0 -0
- package/portal/models/PortalPublishStatus.d.ts +7 -0
- package/portal/models/PortalPublishStatus.js +1 -0
- package/portal/models/PortalPublishStatusParams.d.ts +5 -0
- package/portal/models/PortalPublishStatusParams.js +0 -0
- package/portal/models/PortalPublishStatusResult.d.ts +7 -0
- package/portal/models/PortalPublishStatusResult.js +0 -0
- package/portal/models/PortalQueryParams.d.ts +9 -0
- package/portal/models/PortalQueryParams.js +0 -0
- package/portal/models/PortalQueryResult.d.ts +9 -0
- package/portal/models/PortalQueryResult.js +0 -0
- package/portal/models/PortalResult.d.ts +4 -0
- package/portal/models/PortalResult.js +0 -0
- package/portal/models/PortalSelf.d.ts +46 -0
- package/portal/models/PortalSelf.js +0 -0
- package/portal/models/PortalServer.d.ts +10 -0
- package/portal/models/PortalServer.js +0 -0
- package/portal/models/PortalServers.d.ts +4 -0
- package/portal/models/PortalServers.js +0 -0
- package/portal/models/PortalUpdateFolderParams.d.ts +5 -0
- package/portal/models/PortalUpdateFolderParams.js +0 -0
- package/portal/models/PortalUpdateFolderResults.d.ts +4 -0
- package/portal/models/PortalUpdateFolderResults.js +0 -0
- package/portal/models/PortalUpdateItemParams.d.ts +7 -0
- package/portal/models/PortalUpdateItemParams.js +0 -0
- package/portal/models/PortalUpdateItemResult.d.ts +5 -0
- package/portal/models/PortalUpdateItemResult.js +0 -0
- package/portal/models/PortalUser.d.ts +27 -0
- package/portal/models/PortalUser.js +0 -0
- package/portal/models/PortalUserResult.d.ts +11 -0
- package/portal/models/PortalUserResult.js +0 -0
- package/portal/models/PortalUsersParams.d.ts +15 -0
- package/portal/models/PortalUsersParams.js +0 -0
- package/portal/models/PortalUsersResult.d.ts +9 -0
- package/portal/models/PortalUsersResult.js +0 -0
- package/portal/models/ProtectPortalItemParams.d.ts +5 -0
- package/portal/models/ProtectPortalItemParams.js +0 -0
- package/portal/models/PublishItemParams.d.ts +7 -0
- package/portal/models/PublishItemParams.js +0 -0
- package/portal/models/QueryParams.d.ts +20 -0
- package/portal/models/QueryParams.js +0 -0
- package/portal/models/QueryResult.d.ts +8 -0
- package/portal/models/QueryResult.js +0 -0
- package/portal/models/RemoveDocumentResourcesParams.d.ts +5 -0
- package/portal/models/RemoveDocumentResourcesParams.js +0 -0
- package/portal/models/UpdateDocumentParams.d.ts +5 -0
- package/portal/models/UpdateDocumentParams.js +0 -0
- package/portal/models/UpdateDocumentResourcesParams.d.ts +9 -0
- package/portal/models/UpdateDocumentResourcesParams.js +0 -0
- package/portal/request.d.ts +17 -0
- package/portal/request.js +1 -0
- package/portal/utils.d.ts +21 -0
- package/portal/utils.js +1 -0
- package/server/index.d.ts +23 -0
- package/server/index.js +1 -0
- package/server/models/CatalogResponse.d.ts +6 -0
- package/server/models/CatalogResponse.js +0 -0
- package/server/models/CatalogService.d.ts +4 -0
- package/server/models/CatalogService.js +0 -0
- package/server/models/Envelope.d.ts +8 -0
- package/server/models/Envelope.js +0 -0
- package/server/models/FeatureServiceLayerResponse.d.ts +94 -0
- package/server/models/FeatureServiceLayerResponse.js +0 -0
- package/server/models/FeatureServiceLayersResponse.d.ts +5 -0
- package/server/models/FeatureServiceLayersResponse.js +0 -0
- package/server/models/FeatureServiceResponse.d.ts +74 -0
- package/server/models/FeatureServiceResponse.js +0 -0
- package/server/models/MapServiceLayerOrTableResponse.d.ts +72 -0
- package/server/models/MapServiceLayerOrTableResponse.js +0 -0
- package/server/models/MapServiceLayersResponse.d.ts +5 -0
- package/server/models/MapServiceLayersResponse.js +0 -0
- package/server/models/MapServiceResponse.d.ts +101 -0
- package/server/models/MapServiceResponse.js +1 -0
- package/server/models/SpatialReference.d.ts +4 -0
- package/server/models/SpatialReference.js +0 -0
- package/server/models/esriUnits.d.ts +16 -0
- package/server/models/esriUnits.js +1 -0
- package/utils/log.d.ts +6 -0
- package/utils/log.js +1 -0
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
declare enum PortalPublishFileType {
|
|
2
|
+
ServiceDefinition = "serviceDefinition",
|
|
3
|
+
Shapefile = "shapefile",
|
|
4
|
+
TilePackage = "tilePackage",
|
|
5
|
+
FeatureService = "featureService",
|
|
6
|
+
FeatureCollection = "featureCollection",
|
|
7
|
+
FileGeodatabase = "fileGeodatabase",
|
|
8
|
+
Geojson = "geojson",
|
|
9
|
+
Scenepackage = "scenepackage",
|
|
10
|
+
Vectortilepackage = "vectortilepackage",
|
|
11
|
+
ImageCollection = "imageCollection",
|
|
12
|
+
MapService = "mapService",
|
|
13
|
+
SqliteGeodatabase = "sqliteGeodatabase"
|
|
14
|
+
}
|
|
15
|
+
export default PortalPublishFileType;
|
|
16
|
+
export declare const FileTypesWithoutPublishParams: PortalPublishFileType[];
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
var PortalPublishFileType;!function(PortalPublishFileType){PortalPublishFileType.ServiceDefinition="serviceDefinition",PortalPublishFileType.Shapefile="shapefile",PortalPublishFileType.TilePackage="tilePackage",PortalPublishFileType.FeatureService="featureService",PortalPublishFileType.FeatureCollection="featureCollection",PortalPublishFileType.FileGeodatabase="fileGeodatabase",PortalPublishFileType.Geojson="geojson",PortalPublishFileType.Scenepackage="scenepackage",PortalPublishFileType.Vectortilepackage="vectortilepackage",PortalPublishFileType.ImageCollection="imageCollection",PortalPublishFileType.MapService="mapService",PortalPublishFileType.SqliteGeodatabase="sqliteGeodatabase"}(PortalPublishFileType||(PortalPublishFileType={}));export default PortalPublishFileType;export const FileTypesWithoutPublishParams=[PortalPublishFileType.ServiceDefinition,PortalPublishFileType.Vectortilepackage,PortalPublishFileType.TilePackage];
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import type PortalCommonParams from "./PortalCommonParams";
|
|
2
|
+
import type PortalPublishFileType from "./PortalPublishFileType";
|
|
3
|
+
import type PortalPublishParams from "./PortalPublishParams";
|
|
4
|
+
export default interface PortalPublishItemParams extends PortalCommonParams {
|
|
5
|
+
itemId: string;
|
|
6
|
+
filetype: PortalPublishFileType;
|
|
7
|
+
publishParams?: PortalPublishParams;
|
|
8
|
+
}
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
var PortalPublishStatus;!function(PortalPublishStatus){PortalPublishStatus.Partial="partial",PortalPublishStatus.Processing="processing",PortalPublishStatus.Failed="failed",PortalPublishStatus.Completed="completed"}(PortalPublishStatus||(PortalPublishStatus={}));export default PortalPublishStatus;
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
import type PortalAppInfo from "./PortalAppInfo";
|
|
2
|
+
import type PortalUser from "./PortalUser";
|
|
3
|
+
export default interface PortalSelf {
|
|
4
|
+
access?: string;
|
|
5
|
+
allowedOrigins?: string[];
|
|
6
|
+
allowedRedirectUris?: string[];
|
|
7
|
+
allSSL?: boolean;
|
|
8
|
+
analysisLayersGroupQuery?: string;
|
|
9
|
+
appInfo?: PortalAppInfo;
|
|
10
|
+
authorizedCrossOriginDomains?: string[];
|
|
11
|
+
availableCredits?: number;
|
|
12
|
+
basemapGalleryGroupQuery?: string;
|
|
13
|
+
bingKey?: string;
|
|
14
|
+
canSearchPublic?: boolean;
|
|
15
|
+
canSharePublic?: boolean;
|
|
16
|
+
created?: number;
|
|
17
|
+
culture?: string;
|
|
18
|
+
cultureFormat?: string;
|
|
19
|
+
currentVersion?: string;
|
|
20
|
+
customBaseUrl: string;
|
|
21
|
+
defaultBasemap?: string;
|
|
22
|
+
description?: string | null;
|
|
23
|
+
featuredGroups?: {
|
|
24
|
+
owner: string;
|
|
25
|
+
title: string;
|
|
26
|
+
}[];
|
|
27
|
+
httpPort: number;
|
|
28
|
+
httpsPort: number;
|
|
29
|
+
id?: string;
|
|
30
|
+
ipCntryCode?: string;
|
|
31
|
+
isPortal: boolean;
|
|
32
|
+
modified?: number;
|
|
33
|
+
name: string | null;
|
|
34
|
+
orgEmail?: string;
|
|
35
|
+
orgPhone?: string;
|
|
36
|
+
orgUrl?: string;
|
|
37
|
+
portalHostname: string;
|
|
38
|
+
portalMode: string;
|
|
39
|
+
portalName: string;
|
|
40
|
+
region?: string;
|
|
41
|
+
units?: string;
|
|
42
|
+
urlKey?: string;
|
|
43
|
+
user: PortalUser;
|
|
44
|
+
useStandardizedQuery?: boolean;
|
|
45
|
+
useVectorBasemaps?: boolean;
|
|
46
|
+
}
|
|
File without changes
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
export default interface PortalServer {
|
|
2
|
+
id: string;
|
|
3
|
+
name: string;
|
|
4
|
+
url: string;
|
|
5
|
+
isHosted: boolean;
|
|
6
|
+
adminUrl: string;
|
|
7
|
+
serverRole: "STANDALONE_SERVER" | "FEDERATED_SERVER" | "FEDERATED_SERVER_WITH_RESTRICTED_PUBLISHING" | "HOSTING_SERVER";
|
|
8
|
+
serverFunction: "RasterAnalytics" | "GeoAnalytics" | "GeoEvent" | "GISServer" | "ImageHosting" | "NotebookServer" | "";
|
|
9
|
+
serverType: "ArcGIS" | "ARCGIS_NOTEBOOK_SERVER";
|
|
10
|
+
}
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import type PortalGroup from "./PortalGroup";
|
|
2
|
+
export default interface PortalUser {
|
|
3
|
+
username: string;
|
|
4
|
+
fullName: string;
|
|
5
|
+
preferredView: string | null;
|
|
6
|
+
description: string | null;
|
|
7
|
+
email: string;
|
|
8
|
+
idpUsername: string | null;
|
|
9
|
+
favGroupId: string;
|
|
10
|
+
lastLogin: number;
|
|
11
|
+
access: string;
|
|
12
|
+
storageUsage: number;
|
|
13
|
+
storageQuota: number;
|
|
14
|
+
orgId?: string;
|
|
15
|
+
role?: string;
|
|
16
|
+
privileges?: string[];
|
|
17
|
+
disabled?: boolean;
|
|
18
|
+
units: string | null;
|
|
19
|
+
tags: string[];
|
|
20
|
+
culture: string | null;
|
|
21
|
+
region: string | null;
|
|
22
|
+
thumbnail: string | null;
|
|
23
|
+
created: number;
|
|
24
|
+
modified: number;
|
|
25
|
+
groups?: PortalGroup[];
|
|
26
|
+
provider: string;
|
|
27
|
+
}
|
|
File without changes
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import type PortalFolder from "./PortalFolder";
|
|
2
|
+
import type PortalResult from "./PortalResult";
|
|
3
|
+
export default interface PortalUserResult extends PortalResult {
|
|
4
|
+
username: string;
|
|
5
|
+
nextStart: number;
|
|
6
|
+
num: number;
|
|
7
|
+
start: number;
|
|
8
|
+
total: number;
|
|
9
|
+
currentFolder: string;
|
|
10
|
+
folders: PortalFolder[];
|
|
11
|
+
}
|
|
File without changes
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import type PortalCommonParams from "./PortalCommonParams";
|
|
2
|
+
export default interface PortalUsersParams extends PortalCommonParams {
|
|
3
|
+
start?: number;
|
|
4
|
+
num?: number;
|
|
5
|
+
sortField?: "username" | "fullname" | "created" | "lastlogin" | "mfaenabled" | "level" | "role";
|
|
6
|
+
sortOrder?: "asc" | "desc";
|
|
7
|
+
userLicenseType?: string;
|
|
8
|
+
provider?: "arcgis" | "enterprise" | "facebook" | "google";
|
|
9
|
+
role?: string;
|
|
10
|
+
fullname?: string;
|
|
11
|
+
username?: string;
|
|
12
|
+
firstname?: string;
|
|
13
|
+
lastname?: string;
|
|
14
|
+
applyFiltersIntersection?: boolean;
|
|
15
|
+
}
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import type PortalCommonParams from "./PortalCommonParams";
|
|
2
|
+
import type PortalPublishFileType from "./PortalPublishFileType";
|
|
3
|
+
export default interface PublishItemParams extends PortalCommonParams {
|
|
4
|
+
itemId: string;
|
|
5
|
+
filetype: PortalPublishFileType;
|
|
6
|
+
publishParameters: string;
|
|
7
|
+
}
|
|
File without changes
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
export default interface QueryParams {
|
|
2
|
+
ids?: string[];
|
|
3
|
+
group?: string;
|
|
4
|
+
limit?: number;
|
|
5
|
+
orgId?: string;
|
|
6
|
+
ownedByMe?: boolean;
|
|
7
|
+
owner?: string;
|
|
8
|
+
ownerFolder?: string;
|
|
9
|
+
q?: string;
|
|
10
|
+
restrictToMyOrg?: boolean;
|
|
11
|
+
start?: number;
|
|
12
|
+
sharedWithMe?: boolean;
|
|
13
|
+
sortField?: string;
|
|
14
|
+
sortOrder?: SortOrder;
|
|
15
|
+
tags?: string[];
|
|
16
|
+
title?: string;
|
|
17
|
+
typeKeywords?: string[];
|
|
18
|
+
types?: string[];
|
|
19
|
+
}
|
|
20
|
+
export type SortOrder = "asc" | "desc" | undefined;
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import type PortalCommonParams from "./PortalCommonParams";
|
|
2
|
+
export default interface UpdateDocumentResourcesParams extends PortalCommonParams {
|
|
3
|
+
access?: "private" | "inherit";
|
|
4
|
+
archive?: boolean;
|
|
5
|
+
file?: Blob;
|
|
6
|
+
fileName?: string;
|
|
7
|
+
text?: string;
|
|
8
|
+
resourcesPrefix?: string;
|
|
9
|
+
}
|
|
File without changes
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import type PortalCommonParams from "./models/PortalCommonParams";
|
|
2
|
+
import type PortalPagingParams from "./models/PortalPagingParams";
|
|
3
|
+
import type PortalPagingResult from "./models/PortalPagingResult";
|
|
4
|
+
import type Principal from "../auth/models/Principal";
|
|
5
|
+
export declare function setAllowHttpRequests(allowHttp: boolean): void;
|
|
6
|
+
export interface RequestOptions {
|
|
7
|
+
url: string;
|
|
8
|
+
principal: Principal;
|
|
9
|
+
params?: PortalCommonParams;
|
|
10
|
+
pagingParams?: PortalPagingParams;
|
|
11
|
+
usePost?: boolean;
|
|
12
|
+
fetch?: typeof window.fetch;
|
|
13
|
+
responseType?: "json" | "text" | "blob";
|
|
14
|
+
}
|
|
15
|
+
export declare function requestWithPaging<T extends PortalPagingResult = PortalPagingResult>(options: RequestOptions, limit?: number): Promise<T[]>;
|
|
16
|
+
declare function request<T>(options: RequestOptions): Promise<T>;
|
|
17
|
+
export default request;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{refresh}from"@vertigis-internal/environment/auth";import{isArcGISOnlineUrl}from"./utils";import{getToken}from"../auth";let allowHttpRequests=!1;function defaultFetch(){return fetch}export function setAllowHttpRequests(allowHttp){allowHttpRequests=allowHttp}export async function requestWithPaging(options,limit=1e3){const results=[];let total=0,start=options.pagingParams?.start??1,num=options.pagingParams?.num??100;for(;total<limit;){limit-total<num&&(num=limit-total);const response=await request({...options,pagingParams:{start:start,num:num}});if(results.push(response),"number"!=typeof response.nextStart)throw new Error(`Endpoint does not support paging: ${options.url}`);if(-1===response.nextStart)break;start=response.nextStart,total+=response.num}return results}async function request(options){const{fetch:fetch=defaultFetch(),params:params={},pagingParams:pagingParams={},principal:principal,usePost:usePost=!1,responseType:responseType="json"}=options;let url=options.url;if(url.startsWith("http:")){if(!allowHttpRequests)throw new Error(`Requests to insecure portal are not supported. Url: ${url}`);"https:"===window.location.protocol&&(url=url.replace(/^http:/i,"https:"))}const principalUrl=principal.credentials?.url,isAGOUrl=isArcGISOnlineUrl(url),isAGOPrincipalUrl=principalUrl&&isArcGISOnlineUrl(principalUrl),finalParams={...params,...pagingParams,f:"json"};if(isAGOUrl&&isAGOPrincipalUrl||principalUrl&&url.toLowerCase().startsWith(principalUrl.toLowerCase())){const updatedPrincipal=await refresh(principal);if(!updatedPrincipal)throw new Error(`Could not update principal credentials during request to ${url}`);const token=getToken(updatedPrincipal);token&&(finalParams.token=token)}const useFormData=Object.keys(finalParams).some((key=>finalParams[key]instanceof Blob||"function"==typeof Buffer&&finalParams[key]instanceof Buffer));let paramsAsQuery="";const formData=new FormData;for(const[key,value]of Object.entries(finalParams))null!=value&&(useFormData?value instanceof Blob&&value.name?formData.append(key,value,value.name):formData.append(key,value):paramsAsQuery=`${paramsAsQuery}${key}=${encodeURIComponent(value)}&`);paramsAsQuery.endsWith("&")&&(paramsAsQuery=paramsAsQuery.slice(0,-1));let finalUrl=url;const init={credentials:isArcGISOnlineUrl(finalUrl)?void 0:"include"};usePost?(init.method="POST",useFormData?init.body=formData:(init.body=paramsAsQuery,init.headers={"Content-Type":"application/x-www-form-urlencoded"})):finalUrl=`${finalUrl}?${paramsAsQuery}`;const response=await fetch(finalUrl,init);let error,result,responseCopy=response;"json"!==responseType&&(responseCopy=response.clone());try{result=await responseCopy.json(),error=result.error}catch{}if(error){const err=new Error(error.message);throw err.response=result,err}switch(responseType){case"json":return result;case"blob":return await response.blob();case"text":return await response.text();default:throw assertNever(responseType),new Error(`Unknown response type: ${responseType}`)}}function assertNever(x){}export default request;
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import type Document from "./models/Document";
|
|
2
|
+
import type PortalSelf from "./models/PortalSelf";
|
|
3
|
+
import type Principal from "../auth/models/Principal";
|
|
4
|
+
export declare function getThumbnailUrl(item: Document, principal: Principal): string | undefined;
|
|
5
|
+
export declare function getThumbnailUrlWithoutToken(item: Document, principal: Principal): string | undefined;
|
|
6
|
+
export declare function getDocumentUrl(document: Document | string, principal: Principal): string | undefined;
|
|
7
|
+
export declare function getItemId(itemIdOrUrl: string): string | undefined;
|
|
8
|
+
export declare function getPortalUrl(principal: Principal): string;
|
|
9
|
+
export declare function getPortalContentUrl(principal: Principal): string;
|
|
10
|
+
export declare function getPortalUserContentUrl(principal: Principal, username?: string, folderId?: string): string;
|
|
11
|
+
export declare function getPortalUserItemUrl(id: string, principal: Principal, username?: string): string;
|
|
12
|
+
export declare function getPortalItemUrl(id: string, principal: Principal): string;
|
|
13
|
+
export declare function getPortalItemResourcesUrl(id: string, principal: Principal): string;
|
|
14
|
+
export declare function isCurrentUserOwner(document: Document, principal: Principal): boolean;
|
|
15
|
+
export declare function canUserCreateItems(principal: Principal): boolean;
|
|
16
|
+
export declare function getHomeUrl(principal: Principal): string;
|
|
17
|
+
export declare function getFolderUrl(principal: Principal, folderId?: string): string;
|
|
18
|
+
export declare function getSearchUrl(principal: Principal, searchTerm: string, area?: "content" | "favorites" | "groups" | "organization" | "livingAtlas"): string;
|
|
19
|
+
export declare function getPortalRootUrl(portal: PortalSelf): string;
|
|
20
|
+
export declare function getPortalHostAndPath(portal: PortalSelf): string;
|
|
21
|
+
export declare function isArcGISOnlineUrl(url: string): boolean;
|
package/portal/utils.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{getToken,getUser}from"../auth/index";import{warn}from"../utils/log";export function getThumbnailUrl(item,principal){const url=getThumbnailUrlWithoutToken(item,principal);if(!url)return;const token=getToken(principal);return token?`${url}?token=${token}`:url}export function getThumbnailUrlWithoutToken(item,principal){if(principal&&item?.id&&item.thumbnail)return`${getPortalContentUrl(principal)}/items/${item.id}/info/${item.thumbnail}`}export function getDocumentUrl(document,principal){if(!document)return;const documentId="string"==typeof document?document:document.id;if(!documentId)return;const portal=principal.self;if(!portal)return;return`https://${getHost(portal)}/home/item.html?id=${documentId}`}export function getItemId(itemIdOrUrl){if(itemIdOrUrl){if(/^[0-9a-fA-F]{32}$/.test(itemIdOrUrl))return itemIdOrUrl;{const match=/\/home\/item\.html\?id=([0-9a-fA-F]{32}$)/i.exec(itemIdOrUrl);if(null!=match&&2===match.length)return match[1];warn(`The value '${itemIdOrUrl}' is not a valid item ID or URL.`)}}}export function getPortalUrl(principal){const url=principal?.credentials?.url;return url?`${url}/sharing/rest`:"https://www.arcgis.com/sharing/rest"}export function getPortalContentUrl(principal){return`${getPortalUrl(principal)}/content`}export function getPortalUserContentUrl(principal,username,folderId){const user=getUser(principal);if(!user)throw new Error("Couldn't resolve user from principal");let url=`${getPortalContentUrl(principal)}/users/${username??user.username}`;return folderId&&(url+=`/${folderId}`),url}export function getPortalUserItemUrl(id,principal,username){return`${getPortalUserContentUrl(principal,username)}/items/${id}`}export function getPortalItemUrl(id,principal){return`${getPortalContentUrl(principal)}/items/${id}`}export function getPortalItemResourcesUrl(id,principal){return`${getPortalContentUrl(principal)}/items/${id}/resources`}export function isCurrentUserOwner(document,principal){const self=principal?.self;return!!document&&(!!self?.user?.username&&self.user.username===document.owner)}export function canUserCreateItems(principal){if(principal?.self){if(!principal.self.user.privileges&&!principal.self.user.orgId)return!0;if(principal.self.user.privileges)return principal.self.user.privileges.some((privilege=>"portal:user:createItem"===privilege))}return!1}export function getHomeUrl(principal){return`${getPortalRootUrl(principal.self)}/home`}export function getFolderUrl(principal,folderId){return`${getHomeUrl(principal)}/content.html?folder=${encodeURIComponent(folderId??principal.self.user.username)}`}export function getSearchUrl(principal,searchTerm,area){return`${getHomeUrl(principal)}/content.html?searchTerm=${searchTerm}${area?`#${area}`:""}`}export function getPortalRootUrl(portal){return`https://${getHost(portal)}`}export function getPortalHostAndPath(portal){return getHost(portal)}function getHost(portal){let host=portal.portalHostname;return!portal.isPortal&&portal.customBaseUrl&&portal.customBaseUrl&&portal.urlKey&&(host=`${portal.urlKey.toLowerCase()}.${portal.customBaseUrl}`),host}export function isArcGISOnlineUrl(url){return new URL(url).hostname.endsWith("arcgis.com")}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import type CatalogResponse from "./models/CatalogResponse.js";
|
|
2
|
+
import type FeatureServiceLayerResponse from "./models/FeatureServiceLayerResponse.js";
|
|
3
|
+
import type FeatureServiceLayersResponse from "./models/FeatureServiceLayersResponse.js";
|
|
4
|
+
import type FeatureServiceResponse from "./models/FeatureServiceResponse.js";
|
|
5
|
+
import type MapServiceLayerOrTableResponse from "./models/MapServiceLayerOrTableResponse.js";
|
|
6
|
+
import type MapServiceLayersResponse from "./models/MapServiceLayersResponse.js";
|
|
7
|
+
import type MapServiceResponse from "./models/MapServiceResponse.js";
|
|
8
|
+
import type Principal from "../auth/models/Principal.js";
|
|
9
|
+
export interface RequestOptions {
|
|
10
|
+
params?: {
|
|
11
|
+
[key: string]: string | number | boolean;
|
|
12
|
+
};
|
|
13
|
+
usePost?: boolean;
|
|
14
|
+
fetch?: typeof window.fetch;
|
|
15
|
+
}
|
|
16
|
+
export declare function getCatalog(catalogUrl: string, principal: Principal, options?: RequestOptions): Promise<CatalogResponse>;
|
|
17
|
+
export declare function getFeatureService(featureServiceUrl: string, principal: Principal, options?: RequestOptions): Promise<FeatureServiceResponse>;
|
|
18
|
+
export declare function getFeatureServiceLayers(featureServiceUrl: string, principal: Principal, options?: RequestOptions): Promise<FeatureServiceLayersResponse>;
|
|
19
|
+
export declare function getFeatureServiceLayer(featureServiceLayerUrl: string, principal: Principal, options?: RequestOptions): Promise<FeatureServiceLayerResponse>;
|
|
20
|
+
export declare function getMapService(mapServiceUrl: string, principal: Principal, options?: RequestOptions): Promise<MapServiceResponse>;
|
|
21
|
+
export declare function getMapServiceLayers(mapServiceUrl: string, principal: Principal, options?: RequestOptions): Promise<MapServiceLayersResponse>;
|
|
22
|
+
export declare function getMapServiceLayerOrTable(mapServiceLayerOrTableUrl: string, principal: Principal, options?: RequestOptions): Promise<MapServiceLayerOrTableResponse>;
|
|
23
|
+
export declare function requestAs<T>(url: string, principal: Principal, options?: RequestOptions): Promise<T>;
|
package/server/index.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import request from"../portal/request.js";export async function getCatalog(catalogUrl,principal,options){return requestAs(catalogUrl,principal,options)}export async function getFeatureService(featureServiceUrl,principal,options){return requestAs(featureServiceUrl,principal,options)}export async function getFeatureServiceLayers(featureServiceUrl,principal,options){return requestAs(`${removeTrailingSlashes(featureServiceUrl)}/layers`,principal,options)}export async function getFeatureServiceLayer(featureServiceLayerUrl,principal,options){return requestAs(featureServiceLayerUrl,principal,options)}export async function getMapService(mapServiceUrl,principal,options){return requestAs(mapServiceUrl,principal,options)}export async function getMapServiceLayers(mapServiceUrl,principal,options){return requestAs(`${removeTrailingSlashes(mapServiceUrl)}/layers`,principal,options)}export async function getMapServiceLayerOrTable(mapServiceLayerOrTableUrl,principal,options){return requestAs(mapServiceLayerOrTableUrl,principal,options)}export async function requestAs(url,principal,options){return request({url:url,principal:principal,...options})}function removeTrailingSlashes(u){let url=u;for(;url.endsWith("/");)url=url.substring(0,url.length-1);return url}
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
@@ -0,0 +1,94 @@
|
|
|
1
|
+
import type Envelope from "./Envelope";
|
|
2
|
+
import type SpatialReference from "./SpatialReference";
|
|
3
|
+
export default interface FeatureServiceLayerResponse {
|
|
4
|
+
currentVersion: number;
|
|
5
|
+
id: number;
|
|
6
|
+
name: string;
|
|
7
|
+
type: "Feature Layer" | "Table";
|
|
8
|
+
parentLayer: number;
|
|
9
|
+
displayField: string;
|
|
10
|
+
description: string;
|
|
11
|
+
copyrightText: string;
|
|
12
|
+
subtypeField: string;
|
|
13
|
+
defaultSubtypeCode: number;
|
|
14
|
+
defaultVisibility: boolean;
|
|
15
|
+
editFieldsInfo: EditFieldsInfo;
|
|
16
|
+
ownershipBasedAccessControlForFeatures: {
|
|
17
|
+
allowOthersToUpdate: boolean;
|
|
18
|
+
allowOthersToDelete: boolean;
|
|
19
|
+
allowOthersToQuery: boolean;
|
|
20
|
+
};
|
|
21
|
+
syncCanReturnChanges: boolean;
|
|
22
|
+
isDataVersioned: boolean;
|
|
23
|
+
isDataArchived: boolean;
|
|
24
|
+
isDataBranchVersioned: boolean;
|
|
25
|
+
isCoGoEnabled: boolean;
|
|
26
|
+
supportsRollbackOnFailureParameter: boolean;
|
|
27
|
+
supportsStatistics: boolean;
|
|
28
|
+
supportsAdvancedQueries: boolean;
|
|
29
|
+
supportsCoordinatesQuantization: boolean;
|
|
30
|
+
geometryType: string;
|
|
31
|
+
minScale: number;
|
|
32
|
+
maxScale: number;
|
|
33
|
+
effectiveMinScale: number;
|
|
34
|
+
effectiveMaxScale: number;
|
|
35
|
+
advancedQueryCapabilities: {
|
|
36
|
+
supportsPagination: boolean;
|
|
37
|
+
supportsTrueCurve: boolean;
|
|
38
|
+
supportsQueryWithDistance: boolean;
|
|
39
|
+
supportsLod: boolean;
|
|
40
|
+
supportsReturningQueryExtent: boolean;
|
|
41
|
+
supportsStatistics: boolean;
|
|
42
|
+
supportsHavingClause: boolean;
|
|
43
|
+
supportsOrderBy: boolean;
|
|
44
|
+
supportsDistinct: boolean;
|
|
45
|
+
supportsCountDistinct: boolean;
|
|
46
|
+
supportsPaginationOnAggregatedQueries: boolean;
|
|
47
|
+
supportsQueryWithResultType: boolean;
|
|
48
|
+
supportsReturningGeometryCentroid: boolean;
|
|
49
|
+
supportsSqlExpression: boolean;
|
|
50
|
+
supportsOutFieldsSqlExpression: boolean;
|
|
51
|
+
supportsTopFeaturesQuery: boolean;
|
|
52
|
+
supportsOrderByOnlyOnLayerFields: boolean;
|
|
53
|
+
supportsQueryAttachments: boolean;
|
|
54
|
+
supportsQueryAttachmentsWithReturnUrl: boolean;
|
|
55
|
+
};
|
|
56
|
+
extent: Envelope;
|
|
57
|
+
sourceSpatialReference: SpatialReference;
|
|
58
|
+
hasM: boolean;
|
|
59
|
+
hasZ: boolean;
|
|
60
|
+
enableZDefaults: boolean;
|
|
61
|
+
zDefault: number;
|
|
62
|
+
allowGeometryUpdates: boolean;
|
|
63
|
+
hasAttachments: boolean;
|
|
64
|
+
objectIdField: string;
|
|
65
|
+
globalIdField: string;
|
|
66
|
+
typeIdField: string;
|
|
67
|
+
fields: FeatureServiceLayerField[];
|
|
68
|
+
geometryField: FeatureServiceLayerField;
|
|
69
|
+
maxRecordCount: number;
|
|
70
|
+
}
|
|
71
|
+
interface EditFieldsInfo {
|
|
72
|
+
creationDateField: string;
|
|
73
|
+
creatorField: string;
|
|
74
|
+
editDateField: string;
|
|
75
|
+
editorField: string;
|
|
76
|
+
realm: string;
|
|
77
|
+
dateFieldsTimeReference: TimeReference;
|
|
78
|
+
}
|
|
79
|
+
interface TimeReference {
|
|
80
|
+
timeZone: string;
|
|
81
|
+
respectsDaylightSaving: boolean;
|
|
82
|
+
}
|
|
83
|
+
interface FeatureServiceLayerField {
|
|
84
|
+
name: string;
|
|
85
|
+
type: string;
|
|
86
|
+
alias: string;
|
|
87
|
+
domain: unknown;
|
|
88
|
+
editable: boolean;
|
|
89
|
+
nullable: boolean;
|
|
90
|
+
length: number;
|
|
91
|
+
defaultValue: number | string;
|
|
92
|
+
modelName: string;
|
|
93
|
+
}
|
|
94
|
+
export {};
|
|
File without changes
|