-
Notifications
You must be signed in to change notification settings - Fork 119
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix(arcgis-rest-request): Added Params Preprocessor for GP Mutilvalue…
… Inputs (#1027) * added processed params to ISubmitJobOption * removed processedParams in ISubmitJobOptions * modified job test * added a test for processedParamsFunc * broke out processJobParams to another file Co-authored-by: Marcy Silverman <marcysilverman@Marcys-MBP.lan> Co-authored-by: Marcy Silverman <marcysilverman@esri-o8rw1tsmvv.esri.com>
- Loading branch information
1 parent
06750e0
commit cf75cd6
Showing
4 changed files
with
68 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
13 changes: 13 additions & 0 deletions
13
packages/arcgis-rest-request/src/utils/process-job-params.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
/** | ||
* Processes arrays to JSON strings for Geoprocessing services. See “GPMultiValue” in {@link https://developers.arcgis.com/rest/services-reference/enterprise/gp-data-types.htm} | ||
*/ | ||
export function processJobParams(params: any) { | ||
const processedParams = Object.keys(params).reduce((newParams: any, key) => { | ||
const value = params[key] | ||
const type = value.constructor.name; | ||
newParams[key] = type === "Array" ? JSON.stringify(value) : value; | ||
return newParams; | ||
}, {}); | ||
|
||
return processedParams | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters