From 1948010b1077a4ab5edea82ea46ca0a3c9cf437c Mon Sep 17 00:00:00 2001 From: Tom Wayson Date: Thu, 18 Apr 2019 06:23:57 -0700 Subject: [PATCH] refactor(feature responses): removes unneccessay feature layer response interfaces AFFECTS PACKAGES: @esri/arcgis-rest-feature-layer BREAKING CHANGE: removes IAddFeaturesResult, IAddAttachmentResponse, IDeleteFeaturesResult, IDeleteAttachmentsResponse, IGetAttachmentsResponse, IUpdateFeaturesResult, & IUpdateAttachmentResponse --- packages/arcgis-rest-feature-layer/src/add.ts | 12 +----------- .../arcgis-rest-feature-layer/src/addAttachment.ts | 12 +----------- packages/arcgis-rest-feature-layer/src/delete.ts | 12 +----------- .../src/deleteAttachments.ts | 12 +----------- .../arcgis-rest-feature-layer/src/getAttachments.ts | 12 +----------- packages/arcgis-rest-feature-layer/src/update.ts | 12 +----------- .../src/updateAttachment.ts | 12 +----------- 7 files changed, 7 insertions(+), 77 deletions(-) diff --git a/packages/arcgis-rest-feature-layer/src/add.ts b/packages/arcgis-rest-feature-layer/src/add.ts index b7a554ab36..f7aff7d194 100644 --- a/packages/arcgis-rest-feature-layer/src/add.ts +++ b/packages/arcgis-rest-feature-layer/src/add.ts @@ -27,16 +27,6 @@ export interface IAddFeaturesRequestOptions features: IFeature[]; } -/** - * Add features results. - */ -export interface IAddFeaturesResult { - /** - * Array of JSON response Object(s) for each feature added. - */ - addResults?: IEditFeatureResult[]; -} - /** * ```js * import { addFeatures } from '@esri/arcgis-rest-feature-layer'; @@ -57,7 +47,7 @@ export interface IAddFeaturesResult { */ export function addFeatures( requestOptions: IAddFeaturesRequestOptions -): Promise { +): Promise<{ addResults?: IEditFeatureResult[] }> { const url = `${cleanUrl(requestOptions.url)}/addFeatures`; // edit operations are POST only diff --git a/packages/arcgis-rest-feature-layer/src/addAttachment.ts b/packages/arcgis-rest-feature-layer/src/addAttachment.ts index f24513200e..e8d4f841c5 100644 --- a/packages/arcgis-rest-feature-layer/src/addAttachment.ts +++ b/packages/arcgis-rest-feature-layer/src/addAttachment.ts @@ -19,16 +19,6 @@ export interface IAddAttachmentOptions extends ILayerRequestOptions { attachment: File; } -/** - * `addAttachment()` request response. - */ -export interface IAddAttachmentResponse { - /** - * Standard AGS add/update/edit result Object for the attachment. - */ - addAttachmentResult: IEditFeatureResult; -} - /** * ```js * import { addAttachment } from '@esri/arcgis-rest-feature-layer'; @@ -47,7 +37,7 @@ export interface IAddAttachmentResponse { */ export function addAttachment( requestOptions: IAddAttachmentOptions -): Promise { +): Promise<{ addAttachmentResult: IEditFeatureResult }> { const options: IAddAttachmentOptions = { params: {}, ...requestOptions diff --git a/packages/arcgis-rest-feature-layer/src/delete.ts b/packages/arcgis-rest-feature-layer/src/delete.ts index 39e55471a6..f42acf0f36 100644 --- a/packages/arcgis-rest-feature-layer/src/delete.ts +++ b/packages/arcgis-rest-feature-layer/src/delete.ts @@ -27,16 +27,6 @@ export interface IDeleteFeaturesRequestOptions objectIds: number[]; } -/** - * Delete features results. - */ -export interface IDeleteFeaturesResult { - /** - * Array of JSON response Object(s) for each feature deleted. - */ - deleteResults?: IEditFeatureResult[]; -} - /** * ```js * import { deleteFeatures } from '@esri/arcgis-rest-feature-layer'; @@ -53,7 +43,7 @@ export interface IDeleteFeaturesResult { */ export function deleteFeatures( requestOptions: IDeleteFeaturesRequestOptions -): Promise { +): Promise<{ deleteResults?: IEditFeatureResult[] }> { const url = `${cleanUrl(requestOptions.url)}/deleteFeatures`; // edit operations POST only diff --git a/packages/arcgis-rest-feature-layer/src/deleteAttachments.ts b/packages/arcgis-rest-feature-layer/src/deleteAttachments.ts index e57f768a7d..e6cec4cbd6 100644 --- a/packages/arcgis-rest-feature-layer/src/deleteAttachments.ts +++ b/packages/arcgis-rest-feature-layer/src/deleteAttachments.ts @@ -19,16 +19,6 @@ export interface IDeleteAttachmentsOptions extends ILayerRequestOptions { attachmentIds: number[]; } -/** - * `updateAttachment()` request response. - */ -export interface IDeleteAttachmentsResponse { - /** - * Array of standard AGS add/update/edit result Object(s) for the attachment(s). - */ - deleteAttachmentResults: IEditFeatureResult[]; -} - /** * ```js * import { deleteAttachments } from '@esri/arcgis-rest-feature-layer'; @@ -46,7 +36,7 @@ export interface IDeleteAttachmentsResponse { */ export function deleteAttachments( requestOptions: IDeleteAttachmentsOptions -): Promise { +): Promise<{ deleteAttachmentResults: IEditFeatureResult[] }> { const options: IDeleteAttachmentsOptions = { params: {}, ...requestOptions diff --git a/packages/arcgis-rest-feature-layer/src/getAttachments.ts b/packages/arcgis-rest-feature-layer/src/getAttachments.ts index 6f975dd274..0f40666785 100644 --- a/packages/arcgis-rest-feature-layer/src/getAttachments.ts +++ b/packages/arcgis-rest-feature-layer/src/getAttachments.ts @@ -25,16 +25,6 @@ export interface IAttachmentInfo { name: string; } -/** - * `getAttachments()` request response. - */ -export interface IGetAttachmentsResponse { - /** - * Array of `attachmentInfo` Object(s) for each related attachment. Empty Array means no attachments. - */ - attachmentInfos: IAttachmentInfo[]; -} - /** * ```js * import { getAttachments } from '@esri/arcgis-rest-feature-layer'; @@ -51,7 +41,7 @@ export interface IGetAttachmentsResponse { */ export function getAttachments( requestOptions: IGetAttachmentsOptions -): Promise { +): Promise<{ attachmentInfos: IAttachmentInfo[] }> { // pass through return request( `${cleanUrl(requestOptions.url)}/${requestOptions.featureId}/attachments`, diff --git a/packages/arcgis-rest-feature-layer/src/update.ts b/packages/arcgis-rest-feature-layer/src/update.ts index fdce07f401..990f6fb7bf 100644 --- a/packages/arcgis-rest-feature-layer/src/update.ts +++ b/packages/arcgis-rest-feature-layer/src/update.ts @@ -27,16 +27,6 @@ export interface IUpdateFeaturesRequestOptions features: IFeature[]; } -/** - * Update features results. - */ -export interface IUpdateFeaturesResult { - /** - * Array of JSON response Object(s) for each feature updated. - */ - updateResults?: IEditFeatureResult[]; -} - /** * * ```js @@ -57,7 +47,7 @@ export interface IUpdateFeaturesResult { */ export function updateFeatures( requestOptions: IUpdateFeaturesRequestOptions -): Promise { +): Promise<{ updateResults?: IEditFeatureResult[] }> { const url = `${cleanUrl(requestOptions.url)}/updateFeatures`; // edit operations are POST only diff --git a/packages/arcgis-rest-feature-layer/src/updateAttachment.ts b/packages/arcgis-rest-feature-layer/src/updateAttachment.ts index d079a29488..9362c07100 100644 --- a/packages/arcgis-rest-feature-layer/src/updateAttachment.ts +++ b/packages/arcgis-rest-feature-layer/src/updateAttachment.ts @@ -23,16 +23,6 @@ export interface IUpdateAttachmentOptions extends ILayerRequestOptions { attachmentId: number; } -/** - * `updateAttachment()` request response. - */ -export interface IUpdateAttachmentResponse { - /** - * Standard AGS add/update/edit result Object for the attachment. - */ - updateAttachmentResult: IEditFeatureResult; -} - /** * * ```js @@ -52,7 +42,7 @@ export interface IUpdateAttachmentResponse { */ export function updateAttachment( requestOptions: IUpdateAttachmentOptions -): Promise { +): Promise<{ updateAttachmentResult: IEditFeatureResult }> { const options: IUpdateAttachmentOptions = { params: {}, ...requestOptions