@esri/arcgis-rest-developer-credentials 1.1.0 → 2.1.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/dist/bundled/developer-credentials.esm.js +254 -182
- package/dist/bundled/developer-credentials.esm.js.map +1 -1
- package/dist/bundled/developer-credentials.esm.min.js +3 -3
- package/dist/bundled/developer-credentials.esm.min.js.map +1 -1
- package/dist/bundled/developer-credentials.umd.js +257 -182
- package/dist/bundled/developer-credentials.umd.js.map +1 -1
- package/dist/bundled/developer-credentials.umd.min.js +3 -3
- package/dist/bundled/developer-credentials.umd.min.js.map +1 -1
- package/dist/cjs/createApiKey.js +37 -12
- package/dist/cjs/createApiKey.js.map +1 -1
- package/dist/cjs/index.js +1 -2
- package/dist/cjs/index.js.map +1 -1
- package/dist/cjs/invalidateApiKey.js +46 -0
- package/dist/cjs/invalidateApiKey.js.map +1 -0
- package/dist/cjs/shared/enum/privileges.js +0 -27
- package/dist/cjs/shared/enum/privileges.js.map +1 -1
- package/dist/cjs/shared/generateApiKeyToken.js +27 -0
- package/dist/cjs/shared/generateApiKeyToken.js.map +1 -0
- package/dist/cjs/shared/helpers.js +94 -16
- package/dist/cjs/shared/helpers.js.map +1 -1
- package/dist/cjs/shared/registerApp.js +1 -5
- package/dist/cjs/shared/registerApp.js.map +1 -1
- package/dist/cjs/shared/types/apiKeyType.js.map +1 -1
- package/dist/cjs/shared/types/appType.js.map +1 -1
- package/dist/cjs/updateApiKey.js +45 -26
- package/dist/cjs/updateApiKey.js.map +1 -1
- package/dist/esm/createApiKey.d.ts +9 -3
- package/dist/esm/createApiKey.js +39 -14
- package/dist/esm/createApiKey.js.map +1 -1
- package/dist/esm/index.d.ts +1 -2
- package/dist/esm/index.js +1 -2
- package/dist/esm/index.js.map +1 -1
- package/dist/esm/invalidateApiKey.d.ts +18 -0
- package/dist/esm/invalidateApiKey.js +42 -0
- package/dist/esm/invalidateApiKey.js.map +1 -0
- package/dist/esm/shared/enum/privileges.d.ts +2 -23
- package/dist/esm/shared/enum/privileges.js +1 -26
- package/dist/esm/shared/enum/privileges.js.map +1 -1
- package/dist/esm/shared/generateApiKeyToken.d.ts +11 -0
- package/dist/esm/shared/generateApiKeyToken.js +23 -0
- package/dist/esm/shared/generateApiKeyToken.js.map +1 -0
- package/dist/esm/shared/helpers.d.ts +42 -7
- package/dist/esm/shared/helpers.js +88 -14
- package/dist/esm/shared/helpers.js.map +1 -1
- package/dist/esm/shared/registerApp.d.ts +1 -1
- package/dist/esm/shared/registerApp.js +2 -6
- package/dist/esm/shared/registerApp.js.map +1 -1
- package/dist/esm/shared/types/apiKeyType.d.ts +54 -5
- package/dist/esm/shared/types/apiKeyType.js.map +1 -1
- package/dist/esm/shared/types/appType.d.ts +7 -3
- package/dist/esm/shared/types/appType.js.map +1 -1
- package/dist/esm/updateApiKey.d.ts +8 -2
- package/dist/esm/updateApiKey.js +47 -28
- package/dist/esm/updateApiKey.js.map +1 -1
- package/package.json +1 -1
- package/dist/cjs/deleteApiKey.js +0 -43
- package/dist/cjs/deleteApiKey.js.map +0 -1
- package/dist/cjs/deleteOAuthApp.js +0 -43
- package/dist/cjs/deleteOAuthApp.js.map +0 -1
- package/dist/esm/deleteApiKey.d.ts +0 -27
- package/dist/esm/deleteApiKey.js +0 -39
- package/dist/esm/deleteApiKey.js.map +0 -1
- package/dist/esm/deleteOAuthApp.d.ts +0 -27
- package/dist/esm/deleteOAuthApp.js +0 -39
- package/dist/esm/deleteOAuthApp.js.map +0 -1
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"deleteApiKey.js","sourceRoot":"","sources":["../../src/deleteApiKey.ts"],"names":[],"mappings":";AAAA;gBACgB;;;AAEhB,iEAAsD;AAEtD,oDAAgE;AAKhE,iDAA2C;AAE3C;;;;;;;;;;;;;;;;;;;;;;;;GAwBG;AACI,KAAK,UAAU,YAAY,CAChC,cAAmC;IAEnC,cAAc,CAAC,UAAU,GAAG,MAAM,CAAC;IAEnC,MAAM,kBAAkB,GAAG,IAAA,sCAAyB,EAAC,cAAc,CAAC,CAAC;IAErE,mDAAmD;IACnD,MAAM,IAAA,wBAAS,kCACV,kBAAkB,KACrB,MAAM,EAAE,cAAc,CAAC,MAAM,EAC7B,cAAc,EAAE,cAAc,CAAC,cAAc,IAC7C,CAAC;IAEH,MAAM,kBAAkB,GAA0B,MAAM,IAAA,+BAAU,kCAC7D,kBAAkB,KACrB,EAAE,EAAE,cAAc,CAAC,MAAM,EACzB,cAAc,EAAE,cAAc,CAAC,cAAc,EAC7C,MAAM,EAAE,EAAE,CAAC,EAAE,MAAM,EAAE,IACrB,CAAC;IAEH,OAAO,kBAAkB,CAAC;AAC5B,CAAC;AAtBD,oCAsBC","sourcesContent":["/* Copyright (c) 2023 Environmental Systems Research Institute, Inc.\n * Apache-2.0 */\n\nimport { removeItem } from \"@esri/arcgis-rest-portal\";\n\nimport { extractBaseRequestOptions } from \"./shared/helpers.js\";\nimport {\n IDeleteApiKeyOption,\n IDeleteApiKeyResponse\n} from \"./shared/types/apiKeyType.js\";\nimport { getApiKey } from \"./getApiKey.js\";\n\n/**\n * Used to delete the API Key with given `itemId`.\n *\n * ```js\n * import { deleteApiKey, IDeleteApiKeyResponse } from '@esri/arcgis-rest-developer-credentials';\n * import { ArcGISIdentityManager } from \"@esri/arcgis-rest-request\";\n *\n * const authSession: ArcGISIdentityManager = await ArcGISIdentityManager.signIn({\n * username: \"xyz_usrName\",\n * password: \"xyz_pw\"\n * });\n *\n * deleteApiKey({\n * itemId: \"xyz_itemId\",\n * authentication: authSession\n * }).then((deletedApiKey: IDeleteApiKeyResponse) => {\n * // => {itemId: \"xyz_itemId\", success: true}\n * }).catch(e => {\n * // => an exception object\n * });\n * ```\n *\n * @param requestOptions - Options for {@linkcode deleteApiKey | deleteApiKey()}, including `itemId` of which API key to be deleted and an {@linkcode ArcGISIdentityManager} authentication session.\n * @returns A Promise that will resolve to an {@linkcode IDeleteApiKeyResponse} object representing deletion status.\n */\nexport async function deleteApiKey(\n requestOptions: IDeleteApiKeyOption\n): Promise<IDeleteApiKeyResponse> {\n requestOptions.httpMethod = \"POST\";\n\n const baseRequestOptions = extractBaseRequestOptions(requestOptions);\n\n // validate provided itemId associates with API Key\n await getApiKey({\n ...baseRequestOptions,\n itemId: requestOptions.itemId,\n authentication: requestOptions.authentication\n });\n\n const removeItemResponse: IDeleteApiKeyResponse = await removeItem({\n ...baseRequestOptions,\n id: requestOptions.itemId,\n authentication: requestOptions.authentication,\n params: { f: \"json\" }\n });\n\n return removeItemResponse;\n}\n"]}
|
|
@@ -1,43 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
/* Copyright (c) 2023 Environmental Systems Research Institute, Inc.
|
|
3
|
-
* Apache-2.0 */
|
|
4
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
5
|
-
exports.deleteOAuthApp = void 0;
|
|
6
|
-
const arcgis_rest_portal_1 = require("@esri/arcgis-rest-portal");
|
|
7
|
-
const helpers_js_1 = require("./shared/helpers.js");
|
|
8
|
-
const getOAuthApp_js_1 = require("./getOAuthApp.js");
|
|
9
|
-
/**
|
|
10
|
-
* Used to delete the OAuth2.0 app with given `itemId`.
|
|
11
|
-
*
|
|
12
|
-
* ```js
|
|
13
|
-
* import { deleteOAuthApp, IDeleteOAuthAppResponse } from '@esri/arcgis-rest-developer-credentials';
|
|
14
|
-
* import { ArcGISIdentityManager } from "@esri/arcgis-rest-request";
|
|
15
|
-
*
|
|
16
|
-
* const authSession: ArcGISIdentityManager = await ArcGISIdentityManager.signIn({
|
|
17
|
-
* username: "xyz_usrName",
|
|
18
|
-
* password: "xyz_pw"
|
|
19
|
-
* });
|
|
20
|
-
*
|
|
21
|
-
* deleteOAuthApp({
|
|
22
|
-
* itemId: "xyz_itemId",
|
|
23
|
-
* authentication: authSession
|
|
24
|
-
* }).then((deletedOAuthApp: IDeleteOAuthAppResponse) => {
|
|
25
|
-
* // => {itemId: "xyz_itemId", success: true}
|
|
26
|
-
* }).catch(e => {
|
|
27
|
-
* // => an exception object
|
|
28
|
-
* });
|
|
29
|
-
* ```
|
|
30
|
-
*
|
|
31
|
-
* @param requestOptions - Options for {@linkcode deleteOAuthApp | deleteOAuthApp()}, including `itemId` of which OAuth app to be deleted and an {@linkcode ArcGISIdentityManager} authentication session.
|
|
32
|
-
* @returns A Promise that will resolve to an {@linkcode IDeleteOAuthAppResponse} object representing deletion status.
|
|
33
|
-
*/
|
|
34
|
-
async function deleteOAuthApp(requestOptions) {
|
|
35
|
-
requestOptions.httpMethod = "POST";
|
|
36
|
-
const baseRequestOptions = (0, helpers_js_1.extractBaseRequestOptions)(requestOptions);
|
|
37
|
-
// validate provided itemId associates with OAuth app
|
|
38
|
-
await (0, getOAuthApp_js_1.getOAuthApp)(Object.assign(Object.assign({}, baseRequestOptions), { itemId: requestOptions.itemId, authentication: requestOptions.authentication }));
|
|
39
|
-
const removeItemResponse = await (0, arcgis_rest_portal_1.removeItem)(Object.assign(Object.assign({}, baseRequestOptions), { id: requestOptions.itemId, authentication: requestOptions.authentication, params: { f: "json" } }));
|
|
40
|
-
return removeItemResponse;
|
|
41
|
-
}
|
|
42
|
-
exports.deleteOAuthApp = deleteOAuthApp;
|
|
43
|
-
//# sourceMappingURL=deleteOAuthApp.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"deleteOAuthApp.js","sourceRoot":"","sources":["../../src/deleteOAuthApp.ts"],"names":[],"mappings":";AAAA;gBACgB;;;AAEhB,iEAAsD;AAEtD,oDAAgE;AAKhE,qDAA+C;AAE/C;;;;;;;;;;;;;;;;;;;;;;;;GAwBG;AACI,KAAK,UAAU,cAAc,CAClC,cAAqC;IAErC,cAAc,CAAC,UAAU,GAAG,MAAM,CAAC;IAEnC,MAAM,kBAAkB,GAAG,IAAA,sCAAyB,EAAC,cAAc,CAAC,CAAC;IAErE,qDAAqD;IACrD,MAAM,IAAA,4BAAW,kCACZ,kBAAkB,KACrB,MAAM,EAAE,cAAc,CAAC,MAAM,EAC7B,cAAc,EAAE,cAAc,CAAC,cAAc,IAC7C,CAAC;IAEH,MAAM,kBAAkB,GAA4B,MAAM,IAAA,+BAAU,kCAC/D,kBAAkB,KACrB,EAAE,EAAE,cAAc,CAAC,MAAM,EACzB,cAAc,EAAE,cAAc,CAAC,cAAc,EAC7C,MAAM,EAAE,EAAE,CAAC,EAAE,MAAM,EAAE,IACrB,CAAC;IAEH,OAAO,kBAAkB,CAAC;AAC5B,CAAC;AAtBD,wCAsBC","sourcesContent":["/* Copyright (c) 2023 Environmental Systems Research Institute, Inc.\n * Apache-2.0 */\n\nimport { removeItem } from \"@esri/arcgis-rest-portal\";\n\nimport { extractBaseRequestOptions } from \"./shared/helpers.js\";\nimport {\n IDeleteOAuthAppOption,\n IDeleteOAuthAppResponse\n} from \"./shared/types/oAuthType.js\";\nimport { getOAuthApp } from \"./getOAuthApp.js\";\n\n/**\n * Used to delete the OAuth2.0 app with given `itemId`.\n *\n * ```js\n * import { deleteOAuthApp, IDeleteOAuthAppResponse } from '@esri/arcgis-rest-developer-credentials';\n * import { ArcGISIdentityManager } from \"@esri/arcgis-rest-request\";\n *\n * const authSession: ArcGISIdentityManager = await ArcGISIdentityManager.signIn({\n * username: \"xyz_usrName\",\n * password: \"xyz_pw\"\n * });\n *\n * deleteOAuthApp({\n * itemId: \"xyz_itemId\",\n * authentication: authSession\n * }).then((deletedOAuthApp: IDeleteOAuthAppResponse) => {\n * // => {itemId: \"xyz_itemId\", success: true}\n * }).catch(e => {\n * // => an exception object\n * });\n * ```\n *\n * @param requestOptions - Options for {@linkcode deleteOAuthApp | deleteOAuthApp()}, including `itemId` of which OAuth app to be deleted and an {@linkcode ArcGISIdentityManager} authentication session.\n * @returns A Promise that will resolve to an {@linkcode IDeleteOAuthAppResponse} object representing deletion status.\n */\nexport async function deleteOAuthApp(\n requestOptions: IDeleteOAuthAppOption\n): Promise<IDeleteOAuthAppResponse> {\n requestOptions.httpMethod = \"POST\";\n\n const baseRequestOptions = extractBaseRequestOptions(requestOptions);\n\n // validate provided itemId associates with OAuth app\n await getOAuthApp({\n ...baseRequestOptions,\n itemId: requestOptions.itemId,\n authentication: requestOptions.authentication\n });\n\n const removeItemResponse: IDeleteOAuthAppResponse = await removeItem({\n ...baseRequestOptions,\n id: requestOptions.itemId,\n authentication: requestOptions.authentication,\n params: { f: \"json\" }\n });\n\n return removeItemResponse;\n}\n"]}
|
|
@@ -1,27 +0,0 @@
|
|
|
1
|
-
import { IDeleteApiKeyOption, IDeleteApiKeyResponse } from "./shared/types/apiKeyType.js";
|
|
2
|
-
/**
|
|
3
|
-
* Used to delete the API Key with given `itemId`.
|
|
4
|
-
*
|
|
5
|
-
* ```js
|
|
6
|
-
* import { deleteApiKey, IDeleteApiKeyResponse } from '@esri/arcgis-rest-developer-credentials';
|
|
7
|
-
* import { ArcGISIdentityManager } from "@esri/arcgis-rest-request";
|
|
8
|
-
*
|
|
9
|
-
* const authSession: ArcGISIdentityManager = await ArcGISIdentityManager.signIn({
|
|
10
|
-
* username: "xyz_usrName",
|
|
11
|
-
* password: "xyz_pw"
|
|
12
|
-
* });
|
|
13
|
-
*
|
|
14
|
-
* deleteApiKey({
|
|
15
|
-
* itemId: "xyz_itemId",
|
|
16
|
-
* authentication: authSession
|
|
17
|
-
* }).then((deletedApiKey: IDeleteApiKeyResponse) => {
|
|
18
|
-
* // => {itemId: "xyz_itemId", success: true}
|
|
19
|
-
* }).catch(e => {
|
|
20
|
-
* // => an exception object
|
|
21
|
-
* });
|
|
22
|
-
* ```
|
|
23
|
-
*
|
|
24
|
-
* @param requestOptions - Options for {@linkcode deleteApiKey | deleteApiKey()}, including `itemId` of which API key to be deleted and an {@linkcode ArcGISIdentityManager} authentication session.
|
|
25
|
-
* @returns A Promise that will resolve to an {@linkcode IDeleteApiKeyResponse} object representing deletion status.
|
|
26
|
-
*/
|
|
27
|
-
export declare function deleteApiKey(requestOptions: IDeleteApiKeyOption): Promise<IDeleteApiKeyResponse>;
|
package/dist/esm/deleteApiKey.js
DELETED
|
@@ -1,39 +0,0 @@
|
|
|
1
|
-
/* Copyright (c) 2023 Environmental Systems Research Institute, Inc.
|
|
2
|
-
* Apache-2.0 */
|
|
3
|
-
import { removeItem } from "@esri/arcgis-rest-portal";
|
|
4
|
-
import { extractBaseRequestOptions } from "./shared/helpers.js";
|
|
5
|
-
import { getApiKey } from "./getApiKey.js";
|
|
6
|
-
/**
|
|
7
|
-
* Used to delete the API Key with given `itemId`.
|
|
8
|
-
*
|
|
9
|
-
* ```js
|
|
10
|
-
* import { deleteApiKey, IDeleteApiKeyResponse } from '@esri/arcgis-rest-developer-credentials';
|
|
11
|
-
* import { ArcGISIdentityManager } from "@esri/arcgis-rest-request";
|
|
12
|
-
*
|
|
13
|
-
* const authSession: ArcGISIdentityManager = await ArcGISIdentityManager.signIn({
|
|
14
|
-
* username: "xyz_usrName",
|
|
15
|
-
* password: "xyz_pw"
|
|
16
|
-
* });
|
|
17
|
-
*
|
|
18
|
-
* deleteApiKey({
|
|
19
|
-
* itemId: "xyz_itemId",
|
|
20
|
-
* authentication: authSession
|
|
21
|
-
* }).then((deletedApiKey: IDeleteApiKeyResponse) => {
|
|
22
|
-
* // => {itemId: "xyz_itemId", success: true}
|
|
23
|
-
* }).catch(e => {
|
|
24
|
-
* // => an exception object
|
|
25
|
-
* });
|
|
26
|
-
* ```
|
|
27
|
-
*
|
|
28
|
-
* @param requestOptions - Options for {@linkcode deleteApiKey | deleteApiKey()}, including `itemId` of which API key to be deleted and an {@linkcode ArcGISIdentityManager} authentication session.
|
|
29
|
-
* @returns A Promise that will resolve to an {@linkcode IDeleteApiKeyResponse} object representing deletion status.
|
|
30
|
-
*/
|
|
31
|
-
export async function deleteApiKey(requestOptions) {
|
|
32
|
-
requestOptions.httpMethod = "POST";
|
|
33
|
-
const baseRequestOptions = extractBaseRequestOptions(requestOptions);
|
|
34
|
-
// validate provided itemId associates with API Key
|
|
35
|
-
await getApiKey(Object.assign(Object.assign({}, baseRequestOptions), { itemId: requestOptions.itemId, authentication: requestOptions.authentication }));
|
|
36
|
-
const removeItemResponse = await removeItem(Object.assign(Object.assign({}, baseRequestOptions), { id: requestOptions.itemId, authentication: requestOptions.authentication, params: { f: "json" } }));
|
|
37
|
-
return removeItemResponse;
|
|
38
|
-
}
|
|
39
|
-
//# sourceMappingURL=deleteApiKey.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"deleteApiKey.js","sourceRoot":"","sources":["../../src/deleteApiKey.ts"],"names":[],"mappings":"AAAA;gBACgB;AAEhB,OAAO,EAAE,UAAU,EAAE,MAAM,0BAA0B,CAAC;AAEtD,OAAO,EAAE,yBAAyB,EAAE,MAAM,qBAAqB,CAAC;AAKhE,OAAO,EAAE,SAAS,EAAE,MAAM,gBAAgB,CAAC;AAE3C;;;;;;;;;;;;;;;;;;;;;;;;GAwBG;AACH,MAAM,CAAC,KAAK,UAAU,YAAY,CAChC,cAAmC;IAEnC,cAAc,CAAC,UAAU,GAAG,MAAM,CAAC;IAEnC,MAAM,kBAAkB,GAAG,yBAAyB,CAAC,cAAc,CAAC,CAAC;IAErE,mDAAmD;IACnD,MAAM,SAAS,iCACV,kBAAkB,KACrB,MAAM,EAAE,cAAc,CAAC,MAAM,EAC7B,cAAc,EAAE,cAAc,CAAC,cAAc,IAC7C,CAAC;IAEH,MAAM,kBAAkB,GAA0B,MAAM,UAAU,iCAC7D,kBAAkB,KACrB,EAAE,EAAE,cAAc,CAAC,MAAM,EACzB,cAAc,EAAE,cAAc,CAAC,cAAc,EAC7C,MAAM,EAAE,EAAE,CAAC,EAAE,MAAM,EAAE,IACrB,CAAC;IAEH,OAAO,kBAAkB,CAAC;AAC5B,CAAC","sourcesContent":["/* Copyright (c) 2023 Environmental Systems Research Institute, Inc.\n * Apache-2.0 */\n\nimport { removeItem } from \"@esri/arcgis-rest-portal\";\n\nimport { extractBaseRequestOptions } from \"./shared/helpers.js\";\nimport {\n IDeleteApiKeyOption,\n IDeleteApiKeyResponse\n} from \"./shared/types/apiKeyType.js\";\nimport { getApiKey } from \"./getApiKey.js\";\n\n/**\n * Used to delete the API Key with given `itemId`.\n *\n * ```js\n * import { deleteApiKey, IDeleteApiKeyResponse } from '@esri/arcgis-rest-developer-credentials';\n * import { ArcGISIdentityManager } from \"@esri/arcgis-rest-request\";\n *\n * const authSession: ArcGISIdentityManager = await ArcGISIdentityManager.signIn({\n * username: \"xyz_usrName\",\n * password: \"xyz_pw\"\n * });\n *\n * deleteApiKey({\n * itemId: \"xyz_itemId\",\n * authentication: authSession\n * }).then((deletedApiKey: IDeleteApiKeyResponse) => {\n * // => {itemId: \"xyz_itemId\", success: true}\n * }).catch(e => {\n * // => an exception object\n * });\n * ```\n *\n * @param requestOptions - Options for {@linkcode deleteApiKey | deleteApiKey()}, including `itemId` of which API key to be deleted and an {@linkcode ArcGISIdentityManager} authentication session.\n * @returns A Promise that will resolve to an {@linkcode IDeleteApiKeyResponse} object representing deletion status.\n */\nexport async function deleteApiKey(\n requestOptions: IDeleteApiKeyOption\n): Promise<IDeleteApiKeyResponse> {\n requestOptions.httpMethod = \"POST\";\n\n const baseRequestOptions = extractBaseRequestOptions(requestOptions);\n\n // validate provided itemId associates with API Key\n await getApiKey({\n ...baseRequestOptions,\n itemId: requestOptions.itemId,\n authentication: requestOptions.authentication\n });\n\n const removeItemResponse: IDeleteApiKeyResponse = await removeItem({\n ...baseRequestOptions,\n id: requestOptions.itemId,\n authentication: requestOptions.authentication,\n params: { f: \"json\" }\n });\n\n return removeItemResponse;\n}\n"]}
|
|
@@ -1,27 +0,0 @@
|
|
|
1
|
-
import { IDeleteOAuthAppOption, IDeleteOAuthAppResponse } from "./shared/types/oAuthType.js";
|
|
2
|
-
/**
|
|
3
|
-
* Used to delete the OAuth2.0 app with given `itemId`.
|
|
4
|
-
*
|
|
5
|
-
* ```js
|
|
6
|
-
* import { deleteOAuthApp, IDeleteOAuthAppResponse } from '@esri/arcgis-rest-developer-credentials';
|
|
7
|
-
* import { ArcGISIdentityManager } from "@esri/arcgis-rest-request";
|
|
8
|
-
*
|
|
9
|
-
* const authSession: ArcGISIdentityManager = await ArcGISIdentityManager.signIn({
|
|
10
|
-
* username: "xyz_usrName",
|
|
11
|
-
* password: "xyz_pw"
|
|
12
|
-
* });
|
|
13
|
-
*
|
|
14
|
-
* deleteOAuthApp({
|
|
15
|
-
* itemId: "xyz_itemId",
|
|
16
|
-
* authentication: authSession
|
|
17
|
-
* }).then((deletedOAuthApp: IDeleteOAuthAppResponse) => {
|
|
18
|
-
* // => {itemId: "xyz_itemId", success: true}
|
|
19
|
-
* }).catch(e => {
|
|
20
|
-
* // => an exception object
|
|
21
|
-
* });
|
|
22
|
-
* ```
|
|
23
|
-
*
|
|
24
|
-
* @param requestOptions - Options for {@linkcode deleteOAuthApp | deleteOAuthApp()}, including `itemId` of which OAuth app to be deleted and an {@linkcode ArcGISIdentityManager} authentication session.
|
|
25
|
-
* @returns A Promise that will resolve to an {@linkcode IDeleteOAuthAppResponse} object representing deletion status.
|
|
26
|
-
*/
|
|
27
|
-
export declare function deleteOAuthApp(requestOptions: IDeleteOAuthAppOption): Promise<IDeleteOAuthAppResponse>;
|
|
@@ -1,39 +0,0 @@
|
|
|
1
|
-
/* Copyright (c) 2023 Environmental Systems Research Institute, Inc.
|
|
2
|
-
* Apache-2.0 */
|
|
3
|
-
import { removeItem } from "@esri/arcgis-rest-portal";
|
|
4
|
-
import { extractBaseRequestOptions } from "./shared/helpers.js";
|
|
5
|
-
import { getOAuthApp } from "./getOAuthApp.js";
|
|
6
|
-
/**
|
|
7
|
-
* Used to delete the OAuth2.0 app with given `itemId`.
|
|
8
|
-
*
|
|
9
|
-
* ```js
|
|
10
|
-
* import { deleteOAuthApp, IDeleteOAuthAppResponse } from '@esri/arcgis-rest-developer-credentials';
|
|
11
|
-
* import { ArcGISIdentityManager } from "@esri/arcgis-rest-request";
|
|
12
|
-
*
|
|
13
|
-
* const authSession: ArcGISIdentityManager = await ArcGISIdentityManager.signIn({
|
|
14
|
-
* username: "xyz_usrName",
|
|
15
|
-
* password: "xyz_pw"
|
|
16
|
-
* });
|
|
17
|
-
*
|
|
18
|
-
* deleteOAuthApp({
|
|
19
|
-
* itemId: "xyz_itemId",
|
|
20
|
-
* authentication: authSession
|
|
21
|
-
* }).then((deletedOAuthApp: IDeleteOAuthAppResponse) => {
|
|
22
|
-
* // => {itemId: "xyz_itemId", success: true}
|
|
23
|
-
* }).catch(e => {
|
|
24
|
-
* // => an exception object
|
|
25
|
-
* });
|
|
26
|
-
* ```
|
|
27
|
-
*
|
|
28
|
-
* @param requestOptions - Options for {@linkcode deleteOAuthApp | deleteOAuthApp()}, including `itemId` of which OAuth app to be deleted and an {@linkcode ArcGISIdentityManager} authentication session.
|
|
29
|
-
* @returns A Promise that will resolve to an {@linkcode IDeleteOAuthAppResponse} object representing deletion status.
|
|
30
|
-
*/
|
|
31
|
-
export async function deleteOAuthApp(requestOptions) {
|
|
32
|
-
requestOptions.httpMethod = "POST";
|
|
33
|
-
const baseRequestOptions = extractBaseRequestOptions(requestOptions);
|
|
34
|
-
// validate provided itemId associates with OAuth app
|
|
35
|
-
await getOAuthApp(Object.assign(Object.assign({}, baseRequestOptions), { itemId: requestOptions.itemId, authentication: requestOptions.authentication }));
|
|
36
|
-
const removeItemResponse = await removeItem(Object.assign(Object.assign({}, baseRequestOptions), { id: requestOptions.itemId, authentication: requestOptions.authentication, params: { f: "json" } }));
|
|
37
|
-
return removeItemResponse;
|
|
38
|
-
}
|
|
39
|
-
//# sourceMappingURL=deleteOAuthApp.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"deleteOAuthApp.js","sourceRoot":"","sources":["../../src/deleteOAuthApp.ts"],"names":[],"mappings":"AAAA;gBACgB;AAEhB,OAAO,EAAE,UAAU,EAAE,MAAM,0BAA0B,CAAC;AAEtD,OAAO,EAAE,yBAAyB,EAAE,MAAM,qBAAqB,CAAC;AAKhE,OAAO,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAC;AAE/C;;;;;;;;;;;;;;;;;;;;;;;;GAwBG;AACH,MAAM,CAAC,KAAK,UAAU,cAAc,CAClC,cAAqC;IAErC,cAAc,CAAC,UAAU,GAAG,MAAM,CAAC;IAEnC,MAAM,kBAAkB,GAAG,yBAAyB,CAAC,cAAc,CAAC,CAAC;IAErE,qDAAqD;IACrD,MAAM,WAAW,iCACZ,kBAAkB,KACrB,MAAM,EAAE,cAAc,CAAC,MAAM,EAC7B,cAAc,EAAE,cAAc,CAAC,cAAc,IAC7C,CAAC;IAEH,MAAM,kBAAkB,GAA4B,MAAM,UAAU,iCAC/D,kBAAkB,KACrB,EAAE,EAAE,cAAc,CAAC,MAAM,EACzB,cAAc,EAAE,cAAc,CAAC,cAAc,EAC7C,MAAM,EAAE,EAAE,CAAC,EAAE,MAAM,EAAE,IACrB,CAAC;IAEH,OAAO,kBAAkB,CAAC;AAC5B,CAAC","sourcesContent":["/* Copyright (c) 2023 Environmental Systems Research Institute, Inc.\n * Apache-2.0 */\n\nimport { removeItem } from \"@esri/arcgis-rest-portal\";\n\nimport { extractBaseRequestOptions } from \"./shared/helpers.js\";\nimport {\n IDeleteOAuthAppOption,\n IDeleteOAuthAppResponse\n} from \"./shared/types/oAuthType.js\";\nimport { getOAuthApp } from \"./getOAuthApp.js\";\n\n/**\n * Used to delete the OAuth2.0 app with given `itemId`.\n *\n * ```js\n * import { deleteOAuthApp, IDeleteOAuthAppResponse } from '@esri/arcgis-rest-developer-credentials';\n * import { ArcGISIdentityManager } from \"@esri/arcgis-rest-request\";\n *\n * const authSession: ArcGISIdentityManager = await ArcGISIdentityManager.signIn({\n * username: \"xyz_usrName\",\n * password: \"xyz_pw\"\n * });\n *\n * deleteOAuthApp({\n * itemId: \"xyz_itemId\",\n * authentication: authSession\n * }).then((deletedOAuthApp: IDeleteOAuthAppResponse) => {\n * // => {itemId: \"xyz_itemId\", success: true}\n * }).catch(e => {\n * // => an exception object\n * });\n * ```\n *\n * @param requestOptions - Options for {@linkcode deleteOAuthApp | deleteOAuthApp()}, including `itemId` of which OAuth app to be deleted and an {@linkcode ArcGISIdentityManager} authentication session.\n * @returns A Promise that will resolve to an {@linkcode IDeleteOAuthAppResponse} object representing deletion status.\n */\nexport async function deleteOAuthApp(\n requestOptions: IDeleteOAuthAppOption\n): Promise<IDeleteOAuthAppResponse> {\n requestOptions.httpMethod = \"POST\";\n\n const baseRequestOptions = extractBaseRequestOptions(requestOptions);\n\n // validate provided itemId associates with OAuth app\n await getOAuthApp({\n ...baseRequestOptions,\n itemId: requestOptions.itemId,\n authentication: requestOptions.authentication\n });\n\n const removeItemResponse: IDeleteOAuthAppResponse = await removeItem({\n ...baseRequestOptions,\n id: requestOptions.itemId,\n authentication: requestOptions.authentication,\n params: { f: \"json\" }\n });\n\n return removeItemResponse;\n}\n"]}
|