Skip to content

Commit 9ec8158

Browse files
authored
Merge pull request #1284 from Esri/add-deprecation-messages
Add deprecation tags and warnings
2 parents b4e6120 + 052ff8e commit 9ec8158

File tree

6 files changed

+46
-48
lines changed

6 files changed

+46
-48
lines changed

.changeset/crisp-rockets-sing.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
"@esri/arcgis-rest-request": patch
3+
---
4+
5+
Added deprecation messages for upcoming request package updates

package-lock.json

Lines changed: 30 additions & 45 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

packages/arcgis-rest-request/src/request.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,13 +37,15 @@ export const NODEJS_DEFAULT_REFERER_HEADER = `@esri/arcgis-rest-js`;
3737
*
3838
* You should **never** set a default `authentication` when you are in a server side environment where you may be handling requests for many different authenticated users.
3939
*
40+
* @deprecated since v4.0.0.
4041
* @param options The default options to pass with every request. Existing default will be overwritten.
4142
* @param hideWarnings Silence warnings about setting default `authentication` in shared environments.
4243
*/
4344
export function setDefaultRequestOptions(
4445
options: IRequestOptions,
4546
hideWarnings?: boolean
4647
) {
48+
console.warn(`setDefaultRequestOptions() is deprecated. This will be removed in ArcGIS REST JS v5.0.`);
4749
if (options.authentication && !hideWarnings) {
4850
warn(
4951
"You should not set `authentication` as a default in a shared environment such as a web server which will process multiple users requests. You can call `setDefaultRequestOptions` with `true` as a second argument to disable this warning."
@@ -502,6 +504,7 @@ export function internalRequest(
502504
});
503505
}
504506
if (rawResponse) {
507+
console.warn(`rawResponse option is deprecated and will be removed in ArcGIS REST JS v5.0.`);
505508
return response;
506509
}
507510
switch (params.f) {

packages/arcgis-rest-request/src/utils/IRequestOptions.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ export interface IRequestOptions {
1818
httpMethod?: HTTPMethods;
1919
/**
2020
* Return the raw [response](https://developer.mozilla.org/en-US/docs/Web/API/Response)
21+
* @deprecated since v4.0.0.
2122
*/
2223
rawResponse?: boolean;
2324
/**
@@ -65,6 +66,7 @@ export interface IRequestOptions {
6566

6667
/**
6768
* Override the default function for making the request. This is mainly useful for testing purposes (i.e. so you can pass in a spy).
69+
* @deprecated since v4.0.0
6870
* @param requestOptions
6971
* @returns
7072
*/

packages/arcgis-rest-request/src/utils/with-options.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ import { IRequestOptions } from "../utils/IRequestOptions.js";
2222
* where: "TRL_NAME LIKE '%backbone%'"
2323
* }).then(result);
2424
* ```
25-
*
25+
* @deprecated since v4.0.0.
2626
* @param defaultOptions The options to pass into to the `func`.
2727
* @param func Any function that accepts anything extending `IRequestOptions` as its last parameter.
2828
* @returns A copy of `func` with the `defaultOptions` passed in as defaults.
@@ -34,6 +34,7 @@ export function withOptions<
3434
defaultOptions: IRequestOptions,
3535
func: T
3636
): (...funcArgs: Parameters<T>) => ReturnType<T> {
37+
console.warn(`withOptions() is deprecated. This will be removed in ArcGIS REST JS v5.0.`);
3738
return (...args: Parameters<T>): ReturnType<T> => {
3839
const options: K =
3940
typeof args[args.length - 1] === "object"

0 commit comments

Comments
 (0)