@esri/arcgis-rest-developer-credentials 2.1.1-alpha.1 → 4.9.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.
Files changed (74) hide show
  1. package/dist/bundled/developer-credentials.esm.js +12 -12
  2. package/dist/bundled/developer-credentials.esm.js.map +1 -1
  3. package/dist/bundled/developer-credentials.esm.min.js +4 -4
  4. package/dist/bundled/developer-credentials.esm.min.js.map +1 -1
  5. package/dist/bundled/developer-credentials.umd.js +731 -733
  6. package/dist/bundled/developer-credentials.umd.js.map +1 -1
  7. package/dist/bundled/developer-credentials.umd.min.js +4 -4
  8. package/dist/bundled/developer-credentials.umd.min.js.map +1 -1
  9. package/dist/cjs/createApiKey.js +2 -3
  10. package/dist/cjs/createApiKey.js.map +1 -1
  11. package/dist/cjs/createOAuthApp.js +2 -3
  12. package/dist/cjs/createOAuthApp.js.map +1 -1
  13. package/dist/cjs/getApiKey.js +2 -3
  14. package/dist/cjs/getApiKey.js.map +1 -1
  15. package/dist/cjs/getOAuthApp.js +2 -3
  16. package/dist/cjs/getOAuthApp.js.map +1 -1
  17. package/dist/cjs/index.js +15 -15
  18. package/dist/cjs/index.js.map +1 -1
  19. package/dist/cjs/invalidateApiKey.js +1 -2
  20. package/dist/cjs/invalidateApiKey.js.map +1 -1
  21. package/dist/cjs/shared/generateApiKeyToken.js +1 -2
  22. package/dist/cjs/shared/generateApiKeyToken.js.map +1 -1
  23. package/dist/cjs/shared/getRegisteredAppInfo.js +2 -3
  24. package/dist/cjs/shared/getRegisteredAppInfo.js.map +1 -1
  25. package/dist/cjs/shared/helpers.js +11 -11
  26. package/dist/cjs/shared/helpers.js.map +1 -1
  27. package/dist/cjs/shared/registerApp.js +2 -3
  28. package/dist/cjs/shared/registerApp.js.map +1 -1
  29. package/dist/cjs/shared/types/apiKeyType.js.map +1 -1
  30. package/dist/cjs/shared/types/appType.js.map +1 -1
  31. package/dist/cjs/shared/types/oAuthType.js.map +1 -1
  32. package/dist/cjs/shared/unregisterApp.js +2 -3
  33. package/dist/cjs/shared/unregisterApp.js.map +1 -1
  34. package/dist/cjs/updateApiKey.js +2 -3
  35. package/dist/cjs/updateApiKey.js.map +1 -1
  36. package/dist/cjs/updateOAuthApp.js +2 -3
  37. package/dist/cjs/updateOAuthApp.js.map +1 -1
  38. package/dist/esm/createApiKey.d.ts +1 -1
  39. package/dist/esm/createApiKey.js +1 -1
  40. package/dist/esm/createApiKey.js.map +1 -1
  41. package/dist/esm/createOAuthApp.d.ts +1 -1
  42. package/dist/esm/createOAuthApp.js +1 -1
  43. package/dist/esm/createOAuthApp.js.map +1 -1
  44. package/dist/esm/getApiKey.d.ts +1 -1
  45. package/dist/esm/getApiKey.js +1 -1
  46. package/dist/esm/getApiKey.js.map +1 -1
  47. package/dist/esm/getOAuthApp.d.ts +1 -1
  48. package/dist/esm/getOAuthApp.js +1 -1
  49. package/dist/esm/getOAuthApp.js.map +1 -1
  50. package/dist/esm/shared/enum/privileges.d.ts +1 -1
  51. package/dist/esm/shared/getRegisteredAppInfo.d.ts +1 -1
  52. package/dist/esm/shared/getRegisteredAppInfo.js +1 -1
  53. package/dist/esm/shared/getRegisteredAppInfo.js.map +1 -1
  54. package/dist/esm/shared/helpers.d.ts +1 -1
  55. package/dist/esm/shared/helpers.js.map +1 -1
  56. package/dist/esm/shared/registerApp.d.ts +1 -1
  57. package/dist/esm/shared/registerApp.js +1 -1
  58. package/dist/esm/shared/registerApp.js.map +1 -1
  59. package/dist/esm/shared/types/apiKeyType.d.ts +4 -4
  60. package/dist/esm/shared/types/apiKeyType.js.map +1 -1
  61. package/dist/esm/shared/types/appType.d.ts +4 -4
  62. package/dist/esm/shared/types/appType.js.map +1 -1
  63. package/dist/esm/shared/types/oAuthType.d.ts +4 -4
  64. package/dist/esm/shared/types/oAuthType.js.map +1 -1
  65. package/dist/esm/shared/unregisterApp.d.ts +1 -1
  66. package/dist/esm/shared/unregisterApp.js +1 -1
  67. package/dist/esm/shared/unregisterApp.js.map +1 -1
  68. package/dist/esm/updateApiKey.d.ts +1 -1
  69. package/dist/esm/updateApiKey.js +1 -1
  70. package/dist/esm/updateApiKey.js.map +1 -1
  71. package/dist/esm/updateOAuthApp.d.ts +1 -1
  72. package/dist/esm/updateOAuthApp.js +1 -1
  73. package/dist/esm/updateOAuthApp.js.map +1 -1
  74. package/package.json +5 -5
@@ -1 +1 @@
1
- {"version":3,"file":"appType.js","sourceRoot":"","sources":["../../../../src/shared/types/appType.ts"],"names":[],"mappings":"","sourcesContent":["import {\n IRequestOptions,\n IAuthenticationManager\n} from \"@esri/arcgis-rest-request\";\nimport { UnixTime } from \"@esri/arcgis-rest-portal\";\nimport { Privileges } from \"../enum/privileges.js\";\n\n/**\n * Accepted app types.\n */\nexport type AppType = \"apikey\" | \"browser\" | \"native\" | \"server\" | \"multiple\";\n\n/**\n * Options to register an app.\n */\nexport interface IRegisterAppOptions extends Omit<IRequestOptions, \"params\"> {\n /**\n * itemId that the newly registered app will be based on.\n */\n itemId: string;\n /**\n * App types. For more info, refer to {@linkcode AppType}.\n */\n appType: AppType;\n /**\n * Redirect URIs set for this app.\n */\n redirect_uris: string[];\n /**\n * Http Referrers set for this app.\n */\n httpReferrers: string[];\n /**\n * Privilege lists. For more info, refer to {@linkcode Privileges}.\n */\n privileges: Privileges;\n /**\n * {@linkcode IAuthenticationManager} authentication.\n */\n authentication: IAuthenticationManager;\n}\n\n/**\n * Options to retrieve an app.\n */\nexport interface IGetAppInfoOptions extends Omit<IRequestOptions, \"params\"> {\n /**\n * {@linkcode IAuthenticationManager} authentication.\n */\n authentication: IAuthenticationManager;\n /**\n * itemId of which app to be retrieved.\n */\n itemId: string;\n}\n\n/**\n * Raw response of app related endpoints calls.\n */\nexport interface IRegisteredAppResponse {\n itemId: string;\n /**\n * Only to be present if appType is apikey\n */\n apiKey?: string;\n appType: AppType;\n client_id: string;\n client_secret: string;\n httpReferrers: string[];\n redirect_uris: string[];\n privileges: string[];\n registered: UnixTime;\n modified: UnixTime;\n apnsProdCert: any;\n apnsSandboxCert: any;\n gcmApiKey: any;\n isBeta: boolean;\n customAppLoginShowTriage: boolean;\n isPersonalAPIToken: boolean;\n apiToken1Active: boolean;\n apiToken2Active: boolean;\n}\n\n/**\n * Return value of {@linkcode registerApp} and {@linkcode getRegisteredAppInfo} representing an app entity.\n */\nexport interface IApp\n extends Omit<\n IRegisteredAppResponse,\n | \"registered\"\n | \"modified\"\n | \"apnsProdCert\"\n | \"apnsSandboxCert\"\n | \"gcmApiKey\"\n | \"isBeta\"\n | \"customAppLoginShowTriage\"\n > {\n registered: Date;\n modified: Date;\n}\n\n/**\n * Options to unregister an app.\n */\nexport interface IUnregisterAppOptions extends Omit<IRequestOptions, \"params\"> {\n /**\n * {@linkcode IAuthenticationManager} authentication.\n */\n authentication: IAuthenticationManager;\n /**\n * itemId of which app to be unregistered.\n */\n itemId: string;\n}\n\n/**\n * Response of app un-registration.\n */\nexport interface IUnregisterAppResponse {\n success: true | false;\n /**\n * itemId of which app has been unregistered.\n */\n itemId: string;\n}\n"]}
1
+ {"version":3,"file":"appType.js","sourceRoot":"","sources":["../../../../src/shared/types/appType.ts"],"names":[],"mappings":"","sourcesContent":["import {\n IRequestOptions,\n IAuthenticationManager\n} from \"@esri/arcgis-rest-request\";\nimport { UnixTime } from \"@esri/arcgis-rest-portal\";\nimport { Privileges } from \"../enum/privileges.js\";\n\n/**\n * Accepted app types.\n */\nexport type AppType = \"apikey\" | \"browser\" | \"native\" | \"server\" | \"multiple\";\n\n/**\n * Options to register an app.\n */\nexport interface IRegisterAppOptions extends Omit<IRequestOptions, \"params\"> {\n /**\n * itemId that the newly registered app will be based on.\n */\n itemId: string;\n /**\n * App types. For more info, refer to {@linkcode AppType}.\n */\n appType: AppType;\n /**\n * Redirect URIs set for this app.\n */\n redirect_uris: string[];\n /**\n * Http Referrers set for this app.\n */\n httpReferrers: string[];\n /**\n * Privilege lists. For more info, refer to {@linkcode Privileges}.\n */\n privileges: Privileges;\n /**\n * {@linkcode @esri/arcgis-rest-request!IAuthenticationManager} authentication.\n */\n authentication: IAuthenticationManager;\n}\n\n/**\n * Options to retrieve an app.\n */\nexport interface IGetAppInfoOptions extends Omit<IRequestOptions, \"params\"> {\n /**\n * {@linkcode @esri/arcgis-rest-request!IAuthenticationManager} authentication.\n */\n authentication: IAuthenticationManager;\n /**\n * itemId of which app to be retrieved.\n */\n itemId: string;\n}\n\n/**\n * Raw response of app related endpoints calls.\n */\nexport interface IRegisteredAppResponse {\n itemId: string;\n /**\n * Only to be present if appType is apikey\n */\n apiKey?: string;\n appType: AppType;\n client_id: string;\n client_secret: string;\n httpReferrers: string[];\n redirect_uris: string[];\n privileges: string[];\n registered: UnixTime;\n modified: UnixTime;\n apnsProdCert: any;\n apnsSandboxCert: any;\n gcmApiKey: any;\n isBeta: boolean;\n customAppLoginShowTriage: boolean;\n isPersonalAPIToken: boolean;\n apiToken1Active: boolean;\n apiToken2Active: boolean;\n}\n\n/**\n * Return value of {@linkcode registerApp} and {@linkcode getRegisteredAppInfo} representing an app entity.\n */\nexport interface IApp\n extends Omit<\n IRegisteredAppResponse,\n | \"registered\"\n | \"modified\"\n | \"apnsProdCert\"\n | \"apnsSandboxCert\"\n | \"gcmApiKey\"\n | \"isBeta\"\n | \"customAppLoginShowTriage\"\n > {\n registered: Date;\n modified: Date;\n}\n\n/**\n * Options to unregister an app.\n */\nexport interface IUnregisterAppOptions extends Omit<IRequestOptions, \"params\"> {\n /**\n * {@linkcode @esri/arcgis-rest-request!IAuthenticationManager} authentication.\n */\n authentication: IAuthenticationManager;\n /**\n * itemId of which app to be unregistered.\n */\n itemId: string;\n}\n\n/**\n * Response of app un-registration.\n */\nexport interface IUnregisterAppResponse {\n success: true | false;\n /**\n * itemId of which app has been unregistered.\n */\n itemId: string;\n}\n"]}
@@ -9,7 +9,7 @@ export interface ICreateOAuthAppOption extends Omit<IRequestOptions, "params"> {
9
9
  */
10
10
  redirect_uris?: string[];
11
11
  /**
12
- * {@linkcode IAuthenticationManager} authentication.
12
+ * {@linkcode @esri/arcgis-rest-request!IAuthenticationManager} authentication.
13
13
  */
14
14
  authentication: IAuthenticationManager;
15
15
  title: string;
@@ -31,7 +31,7 @@ export interface ICreateOAuthAppOption extends Omit<IRequestOptions, "params"> {
31
31
  */
32
32
  export interface IGetOAuthAppOptions extends Omit<IRequestOptions, "params"> {
33
33
  /**
34
- * {@linkcode IAuthenticationManager} authentication.
34
+ * {@linkcode @esri/arcgis-rest-request!IAuthenticationManager} authentication.
35
35
  */
36
36
  authentication: IAuthenticationManager;
37
37
  /**
@@ -44,7 +44,7 @@ export interface IGetOAuthAppOptions extends Omit<IRequestOptions, "params"> {
44
44
  */
45
45
  export interface IUpdateOAuthOptions extends Omit<IRequestOptions, "params"> {
46
46
  /**
47
- * {@linkcode IAuthenticationManager} authentication.
47
+ * {@linkcode @esri/arcgis-rest-request!IAuthenticationManager} authentication.
48
48
  */
49
49
  authentication: IAuthenticationManager;
50
50
  /**
@@ -81,7 +81,7 @@ export interface IOAuthApp extends IOAuthAppInfo {
81
81
  */
82
82
  export interface IDeleteOAuthAppOption extends Omit<IRequestOptions, "params"> {
83
83
  /**
84
- * {@linkcode IAuthenticationManager} authentication.
84
+ * {@linkcode @esri/arcgis-rest-request!IAuthenticationManager} authentication.
85
85
  */
86
86
  authentication: IAuthenticationManager;
87
87
  /**
@@ -1 +1 @@
1
- {"version":3,"file":"oAuthType.js","sourceRoot":"","sources":["../../../../src/shared/types/oAuthType.ts"],"names":[],"mappings":"","sourcesContent":["import { IItem } from \"@esri/arcgis-rest-portal\";\nimport {\n IAuthenticationManager,\n IRequestOptions,\n ISpatialReference\n} from \"@esri/arcgis-rest-request\";\n\n/**\n * Options to register an OAuth2.0 app.\n */\nexport interface ICreateOAuthAppOption extends Omit<IRequestOptions, \"params\"> {\n /**\n * Redirect URIs set for this OAuth2.0 app.\n */\n redirect_uris?: string[];\n /**\n * {@linkcode IAuthenticationManager} authentication.\n */\n authentication: IAuthenticationManager;\n title: string;\n owner?: string;\n typeKeywords?: string[];\n description?: string;\n snippet?: string;\n documentation?: string;\n extent?: number[][];\n categories?: string[];\n spatialReference?: ISpatialReference;\n culture?: string;\n properties?: any;\n url?: string;\n tags?: string[];\n}\n\n/**\n * Options to retrieve an OAuth2.0 app.\n */\nexport interface IGetOAuthAppOptions extends Omit<IRequestOptions, \"params\"> {\n /**\n * {@linkcode IAuthenticationManager} authentication.\n */\n authentication: IAuthenticationManager;\n /**\n * itemId of which OAuth2.0 app to be retrieved.\n */\n itemId: string;\n}\n\n/**\n * Options to update an OAuth2.0 app.\n */\nexport interface IUpdateOAuthOptions extends Omit<IRequestOptions, \"params\"> {\n /**\n * {@linkcode IAuthenticationManager} authentication.\n */\n authentication: IAuthenticationManager;\n /**\n * itemId of which OAuth2.0 app to be updated.\n */\n itemId: string;\n /**\n * Override previous `redirect_uris` if this value is provided.\n */\n redirect_uris?: string[];\n}\n\n/**\n * Represent only the OAuth2.0 app related properties from {@linkcode IApp}.\n */\nexport interface IOAuthAppInfo {\n itemId: string;\n client_id: string;\n client_secret: string;\n redirect_uris: string[];\n registered: Date;\n modified: Date;\n}\n\n/**\n * Return value of {@linkcode createOAuthApp}, {@linkcode getOAuthApp}, {@linkcode updateOAuthApp} representing an OAuth2.0 app entity.\n */\nexport interface IOAuthApp extends IOAuthAppInfo {\n /**\n * Represent item info attached to this OAuth2.0 app.\n */\n item: IItem;\n}\n\n/**\n * Options to delete an OAuth2.0 app.\n */\nexport interface IDeleteOAuthAppOption extends Omit<IRequestOptions, \"params\"> {\n /**\n * {@linkcode IAuthenticationManager} authentication.\n */\n authentication: IAuthenticationManager;\n /**\n * itemId of which OAuth2.0 app to be removed.\n */\n itemId: string;\n}\n\n/**\n * Response of OAuth2.0 app deletion.\n */\nexport interface IDeleteOAuthAppResponse {\n /**\n * itemId of which OAuth2.0 app has been removed.\n */\n itemId: string;\n success: boolean;\n}\n"]}
1
+ {"version":3,"file":"oAuthType.js","sourceRoot":"","sources":["../../../../src/shared/types/oAuthType.ts"],"names":[],"mappings":"","sourcesContent":["import { IItem } from \"@esri/arcgis-rest-portal\";\nimport {\n IAuthenticationManager,\n IRequestOptions,\n ISpatialReference\n} from \"@esri/arcgis-rest-request\";\n\n/**\n * Options to register an OAuth2.0 app.\n */\nexport interface ICreateOAuthAppOption extends Omit<IRequestOptions, \"params\"> {\n /**\n * Redirect URIs set for this OAuth2.0 app.\n */\n redirect_uris?: string[];\n /**\n * {@linkcode @esri/arcgis-rest-request!IAuthenticationManager} authentication.\n */\n authentication: IAuthenticationManager;\n title: string;\n owner?: string;\n typeKeywords?: string[];\n description?: string;\n snippet?: string;\n documentation?: string;\n extent?: number[][];\n categories?: string[];\n spatialReference?: ISpatialReference;\n culture?: string;\n properties?: any;\n url?: string;\n tags?: string[];\n}\n\n/**\n * Options to retrieve an OAuth2.0 app.\n */\nexport interface IGetOAuthAppOptions extends Omit<IRequestOptions, \"params\"> {\n /**\n * {@linkcode @esri/arcgis-rest-request!IAuthenticationManager} authentication.\n */\n authentication: IAuthenticationManager;\n /**\n * itemId of which OAuth2.0 app to be retrieved.\n */\n itemId: string;\n}\n\n/**\n * Options to update an OAuth2.0 app.\n */\nexport interface IUpdateOAuthOptions extends Omit<IRequestOptions, \"params\"> {\n /**\n * {@linkcode @esri/arcgis-rest-request!IAuthenticationManager} authentication.\n */\n authentication: IAuthenticationManager;\n /**\n * itemId of which OAuth2.0 app to be updated.\n */\n itemId: string;\n /**\n * Override previous `redirect_uris` if this value is provided.\n */\n redirect_uris?: string[];\n}\n\n/**\n * Represent only the OAuth2.0 app related properties from {@linkcode IApp}.\n */\nexport interface IOAuthAppInfo {\n itemId: string;\n client_id: string;\n client_secret: string;\n redirect_uris: string[];\n registered: Date;\n modified: Date;\n}\n\n/**\n * Return value of {@linkcode createOAuthApp}, {@linkcode getOAuthApp}, {@linkcode updateOAuthApp} representing an OAuth2.0 app entity.\n */\nexport interface IOAuthApp extends IOAuthAppInfo {\n /**\n * Represent item info attached to this OAuth2.0 app.\n */\n item: IItem;\n}\n\n/**\n * Options to delete an OAuth2.0 app.\n */\nexport interface IDeleteOAuthAppOption extends Omit<IRequestOptions, \"params\"> {\n /**\n * {@linkcode @esri/arcgis-rest-request!IAuthenticationManager} authentication.\n */\n authentication: IAuthenticationManager;\n /**\n * itemId of which OAuth2.0 app to be removed.\n */\n itemId: string;\n}\n\n/**\n * Response of OAuth2.0 app deletion.\n */\nexport interface IDeleteOAuthAppResponse {\n /**\n * itemId of which OAuth2.0 app has been removed.\n */\n itemId: string;\n success: boolean;\n}\n"]}
@@ -21,7 +21,7 @@ import { IUnregisterAppOptions, IUnregisterAppResponse } from "./types/appType.j
21
21
  * });
22
22
  * ```
23
23
  *
24
- * @param requestOptions - Options for {@linkcode unregisterApp | unregisterApp()}, including `itemId` of which app to be un-registered and an {@linkcode ArcGISIdentityManager} authentication session.
24
+ * @param requestOptions - Options for {@linkcode unregisterApp | unregisterApp()}, including `itemId` of which app to be un-registered and an {@linkcode @esri/arcgis-rest-request!ArcGISIdentityManager} authentication session.
25
25
  * @returns A Promise that will resolve to an {@linkcode IUnregisterAppResponse} object representing un-registration status.
26
26
  */
27
27
  export declare function unregisterApp(requestOptions: IUnregisterAppOptions): Promise<IUnregisterAppResponse>;
@@ -24,7 +24,7 @@ import { request } from "@esri/arcgis-rest-request";
24
24
  * });
25
25
  * ```
26
26
  *
27
- * @param requestOptions - Options for {@linkcode unregisterApp | unregisterApp()}, including `itemId` of which app to be un-registered and an {@linkcode ArcGISIdentityManager} authentication session.
27
+ * @param requestOptions - Options for {@linkcode unregisterApp | unregisterApp()}, including `itemId` of which app to be un-registered and an {@linkcode @esri/arcgis-rest-request!ArcGISIdentityManager} authentication session.
28
28
  * @returns A Promise that will resolve to an {@linkcode IUnregisterAppResponse} object representing un-registration status.
29
29
  */
30
30
  export async function unregisterApp(requestOptions) {
@@ -1 +1 @@
1
- {"version":3,"file":"unregisterApp.js","sourceRoot":"","sources":["../../../src/shared/unregisterApp.ts"],"names":[],"mappings":"AAKA,OAAO,EAAE,yBAAyB,EAAE,MAAM,cAAc,CAAC;AACzD,OAAO,EAAE,oBAAoB,EAAE,MAAM,2BAA2B,CAAC;AACjE,OAAO,EAAE,YAAY,EAAE,MAAM,0BAA0B,CAAC;AACxD,OAAO,EAAE,OAAO,EAAE,MAAM,2BAA2B,CAAC;AAEpD;;;;;;;;;;;;;;;;;;;;;;;;GAwBG;AACH,MAAM,CAAC,KAAK,UAAU,aAAa,CACjC,cAAqC;IAErC,cAAc,CAAC,UAAU,GAAG,MAAM,CAAC;IAEnC,UAAU;IACV,MAAM,kBAAkB,GAAG,yBAAyB,CAAC,cAAc,CAAC,CAAC;IACrE,MAAM,YAAY,mCACb,kBAAkB,KACrB,cAAc,EAAE,cAAc,CAAC,cAAc,EAC7C,MAAM,EAAE,cAAc,CAAC,MAAM,GAC9B,CAAC;IAEF,MAAM,WAAW,GAAG,MAAM,oBAAoB,CAAC,YAAY,CAAC,CAAC;IAE7D,MAAM,QAAQ,GAAG,WAAW,CAAC,SAAS,CAAC;IAEvC,MAAM,GAAG,GACP,YAAY,CAAC,cAAc,CAAC,GAAG,gBAAgB,QAAQ,aAAa,CAAC;IAEvE,MAAM,qBAAqB,GAA2B,MAAM,OAAO,CAAC,GAAG,kCAClE,kBAAkB,KACrB,cAAc,EAAE,cAAc,CAAC,cAAc,EAC7C,MAAM,EAAE,EAAE,CAAC,EAAE,MAAM,EAAE,IACrB,CAAC;IACH,OAAO,qBAAqB,CAAC;AAC/B,CAAC","sourcesContent":["import {\n IGetAppInfoOptions,\n IUnregisterAppOptions,\n IUnregisterAppResponse\n} from \"./types/appType.js\";\nimport { extractBaseRequestOptions } from \"./helpers.js\";\nimport { getRegisteredAppInfo } from \"./getRegisteredAppInfo.js\";\nimport { getPortalUrl } from \"@esri/arcgis-rest-portal\";\nimport { request } from \"@esri/arcgis-rest-request\";\n\n/**\n * Used to unregister the app with given `itemId`. See the [REST Documentation](https://developers.arcgis.com/rest/users-groups-and-items/unregister-app.htm) for more information.\n *\n * ```js\n * import { unregisterApp, IUnregisterAppResponse } 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 * unregisterApp({\n * itemId: \"xyz_itemId\",\n * authentication: authSession\n * }).then((unregisteredApp: IUnregisterAppResponse) => {\n * // => {itemId: \"xyz_itemId\", success: true}\n * }).catch(e => {\n * // => an exception object\n * });\n * ```\n *\n * @param requestOptions - Options for {@linkcode unregisterApp | unregisterApp()}, including `itemId` of which app to be un-registered and an {@linkcode ArcGISIdentityManager} authentication session.\n * @returns A Promise that will resolve to an {@linkcode IUnregisterAppResponse} object representing un-registration status.\n */\nexport async function unregisterApp(\n requestOptions: IUnregisterAppOptions\n): Promise<IUnregisterAppResponse> {\n requestOptions.httpMethod = \"POST\";\n\n // get app\n const baseRequestOptions = extractBaseRequestOptions(requestOptions);\n const getAppOption: IGetAppInfoOptions = {\n ...baseRequestOptions,\n authentication: requestOptions.authentication,\n itemId: requestOptions.itemId\n };\n\n const appResponse = await getRegisteredAppInfo(getAppOption);\n\n const clientId = appResponse.client_id;\n\n const url =\n getPortalUrl(requestOptions) + `/oauth2/apps/${clientId}/unregister`;\n\n const unregisterAppResponse: IUnregisterAppResponse = await request(url, {\n ...baseRequestOptions,\n authentication: requestOptions.authentication,\n params: { f: \"json\" }\n });\n return unregisterAppResponse;\n}\n"]}
1
+ {"version":3,"file":"unregisterApp.js","sourceRoot":"","sources":["../../../src/shared/unregisterApp.ts"],"names":[],"mappings":"AAKA,OAAO,EAAE,yBAAyB,EAAE,MAAM,cAAc,CAAC;AACzD,OAAO,EAAE,oBAAoB,EAAE,MAAM,2BAA2B,CAAC;AACjE,OAAO,EAAE,YAAY,EAAE,MAAM,0BAA0B,CAAC;AACxD,OAAO,EAAE,OAAO,EAAE,MAAM,2BAA2B,CAAC;AAEpD;;;;;;;;;;;;;;;;;;;;;;;;GAwBG;AACH,MAAM,CAAC,KAAK,UAAU,aAAa,CACjC,cAAqC;IAErC,cAAc,CAAC,UAAU,GAAG,MAAM,CAAC;IAEnC,UAAU;IACV,MAAM,kBAAkB,GAAG,yBAAyB,CAAC,cAAc,CAAC,CAAC;IACrE,MAAM,YAAY,mCACb,kBAAkB,KACrB,cAAc,EAAE,cAAc,CAAC,cAAc,EAC7C,MAAM,EAAE,cAAc,CAAC,MAAM,GAC9B,CAAC;IAEF,MAAM,WAAW,GAAG,MAAM,oBAAoB,CAAC,YAAY,CAAC,CAAC;IAE7D,MAAM,QAAQ,GAAG,WAAW,CAAC,SAAS,CAAC;IAEvC,MAAM,GAAG,GACP,YAAY,CAAC,cAAc,CAAC,GAAG,gBAAgB,QAAQ,aAAa,CAAC;IAEvE,MAAM,qBAAqB,GAA2B,MAAM,OAAO,CAAC,GAAG,kCAClE,kBAAkB,KACrB,cAAc,EAAE,cAAc,CAAC,cAAc,EAC7C,MAAM,EAAE,EAAE,CAAC,EAAE,MAAM,EAAE,IACrB,CAAC;IACH,OAAO,qBAAqB,CAAC;AAC/B,CAAC","sourcesContent":["import {\n IGetAppInfoOptions,\n IUnregisterAppOptions,\n IUnregisterAppResponse\n} from \"./types/appType.js\";\nimport { extractBaseRequestOptions } from \"./helpers.js\";\nimport { getRegisteredAppInfo } from \"./getRegisteredAppInfo.js\";\nimport { getPortalUrl } from \"@esri/arcgis-rest-portal\";\nimport { request } from \"@esri/arcgis-rest-request\";\n\n/**\n * Used to unregister the app with given `itemId`. See the [REST Documentation](https://developers.arcgis.com/rest/users-groups-and-items/unregister-app.htm) for more information.\n *\n * ```js\n * import { unregisterApp, IUnregisterAppResponse } 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 * unregisterApp({\n * itemId: \"xyz_itemId\",\n * authentication: authSession\n * }).then((unregisteredApp: IUnregisterAppResponse) => {\n * // => {itemId: \"xyz_itemId\", success: true}\n * }).catch(e => {\n * // => an exception object\n * });\n * ```\n *\n * @param requestOptions - Options for {@linkcode unregisterApp | unregisterApp()}, including `itemId` of which app to be un-registered and an {@linkcode @esri/arcgis-rest-request!ArcGISIdentityManager} authentication session.\n * @returns A Promise that will resolve to an {@linkcode IUnregisterAppResponse} object representing un-registration status.\n */\nexport async function unregisterApp(\n requestOptions: IUnregisterAppOptions\n): Promise<IUnregisterAppResponse> {\n requestOptions.httpMethod = \"POST\";\n\n // get app\n const baseRequestOptions = extractBaseRequestOptions(requestOptions);\n const getAppOption: IGetAppInfoOptions = {\n ...baseRequestOptions,\n authentication: requestOptions.authentication,\n itemId: requestOptions.itemId\n };\n\n const appResponse = await getRegisteredAppInfo(getAppOption);\n\n const clientId = appResponse.client_id;\n\n const url =\n getPortalUrl(requestOptions) + `/oauth2/apps/${clientId}/unregister`;\n\n const unregisterAppResponse: IUnregisterAppResponse = await request(url, {\n ...baseRequestOptions,\n authentication: requestOptions.authentication,\n params: { f: \"json\" }\n });\n return unregisterAppResponse;\n}\n"]}
@@ -33,7 +33,7 @@ import { IApiKeyResponse, IUpdateApiKeyOptions } from "./shared/types/apiKeyType
33
33
  * });
34
34
  * ```
35
35
  *
36
- * @param requestOptions - Options for {@linkcode updateApiKey | updateApiKey()}, including `itemId` of which API key to be operated on, optional new `privileges`, optional new `httpReferrers` and an {@linkcode ArcGISIdentityManager} authentication session.
36
+ * @param requestOptions - Options for {@linkcode updateApiKey | updateApiKey()}, including `itemId` of which API key to be operated on, optional new `privileges`, optional new `httpReferrers` and an {@linkcode @esri/arcgis-rest-request!ArcGISIdentityManager} authentication session.
37
37
  * @returns A Promise that will resolve to an {@linkcode IApiKeyResponse} object representing updated API key.
38
38
  */
39
39
  export declare function updateApiKey(requestOptions: IUpdateApiKeyOptions): Promise<IApiKeyResponse>;
@@ -38,7 +38,7 @@ import { appendCustomParams, request } from "@esri/arcgis-rest-request";
38
38
  * });
39
39
  * ```
40
40
  *
41
- * @param requestOptions - Options for {@linkcode updateApiKey | updateApiKey()}, including `itemId` of which API key to be operated on, optional new `privileges`, optional new `httpReferrers` and an {@linkcode ArcGISIdentityManager} authentication session.
41
+ * @param requestOptions - Options for {@linkcode updateApiKey | updateApiKey()}, including `itemId` of which API key to be operated on, optional new `privileges`, optional new `httpReferrers` and an {@linkcode @esri/arcgis-rest-request!ArcGISIdentityManager} authentication session.
42
42
  * @returns A Promise that will resolve to an {@linkcode IApiKeyResponse} object representing updated API key.
43
43
  */
44
44
  export async function updateApiKey(requestOptions) {
@@ -1 +1 @@
1
- {"version":3,"file":"updateApiKey.js","sourceRoot":"","sources":["../../src/updateApiKey.ts"],"names":[],"mappings":"AAAA;gBACgB;AAMhB,OAAO,EAAE,oBAAoB,EAAE,MAAM,kCAAkC,CAAC;AACxE,OAAO,EACL,qBAAqB,EACrB,yBAAyB,EACzB,eAAe,EAEf,oBAAoB,EACpB,sBAAsB,EACtB,yBAAyB,EAC1B,MAAM,qBAAqB,CAAC;AAC7B,OAAO,EAAE,OAAO,EAAE,YAAY,EAAE,UAAU,EAAE,MAAM,0BAA0B,CAAC;AAC7E,OAAO,EAAE,kBAAkB,EAAE,OAAO,EAAE,MAAM,2BAA2B,CAAC;AAOxE;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAoCG;AACH,MAAM,CAAC,KAAK,UAAU,YAAY,CAChC,cAAoC;IAEpC,cAAc,CAAC,UAAU,GAAG,MAAM,CAAC;IACnC,MAAM,kBAAkB,GAAG,yBAAyB,CAAC,cAAc,CAAC,CAAC,CAAC,mCAAmC;IAEzG;;OAEG;IACH,IACE,cAAc,CAAC,uBAAuB;QACtC,cAAc,CAAC,uBAAuB,EACtC;QACA,MAAM,YAAY,GAAG,yBAAyB,CAAC,cAAc,CAAC,CAAC;QAC/D,MAAM,UAAU,iCACX,kBAAkB,KACrB,IAAI,kBACF,EAAE,EAAE,cAAc,CAAC,MAAM,IACtB,YAAY,GAEjB,cAAc,EAAE,cAAc,CAAC,cAAc,IAC7C,CAAC;KACJ;IAED;;OAEG;IACH,IAAI,cAAc,CAAC,UAAU,IAAI,cAAc,CAAC,aAAa,EAAE;QAC7D,MAAM,YAAY,mCACb,kBAAkB,KACrB,cAAc,EAAE,cAAc,CAAC,cAAc,EAC7C,MAAM,EAAE,cAAc,CAAC,MAAM,GAC9B,CAAC;QACF,MAAM,WAAW,GAAG,MAAM,oBAAoB,CAAC,YAAY,CAAC,CAAC;QAC7D,MAAM,QAAQ,GAAG,WAAW,CAAC,SAAS,CAAC;QACvC,MAAM,OAAO,GAAG,kBAAkB,iCAC3B,WAAW,GAAK,cAAc,GAAI,2CAA2C;QAClF,CAAC,YAAY,EAAE,eAAe,CAAC,CAAC,4CAA4C;SAC7E,CAAC;QACF,OAAO,CAAC,MAAM,CAAC,CAAC,GAAG,MAAM,CAAC;QAE1B,mHAAmH;QACnH,eAAe,CAAC,OAAO,CAAC,CAAC;QAEzB,MAAM,GAAG,GAAG,YAAY,CAAC,OAAO,CAAC,GAAG,gBAAgB,QAAQ,SAAS,CAAC;QAEtE,gGAAgG;QAChG,MAAM,cAAc,GAA2B,MAAM,OAAO,CAAC,GAAG,kCAC3D,OAAO,KACV,cAAc,EAAE,cAAc,CAAC,cAAc,IAC7C,CAAC;KACJ;IAED;;OAEG;IACH,MAAM,eAAe,GAAG,MAAM,OAAO,CAAC,cAAc,CAAC,MAAM,kCACtD,kBAAkB,KACrB,cAAc,EAAE,cAAc,CAAC,cAAc,EAC7C,MAAM,EAAE,EAAE,CAAC,EAAE,MAAM,EAAE,IACrB,CAAC;IAEH;;OAEG;IACH,MAAM,eAAe,GAAG,MAAM,oBAAoB,CAChD,cAAc,CAAC,MAAM,EACrB,sBAAsB,CACpB,cAAc,CAAC,cAAc,EAC7B,cAAc,CAAC,cAAc,CAC9B,kCAEI,kBAAkB,KACrB,cAAc,EAAE,cAAc,CAAC,cAAc,IAEhD,CAAC;IAEF;;OAEG;IACH,MAAM,4BAA4B,GAAG,MAAM,oBAAoB,iCAC1D,kBAAkB,KACrB,MAAM,EAAE,cAAc,CAAC,MAAM,EAC7B,cAAc,EAAE,cAAc,CAAC,cAAc,IAC7C,CAAC;IAEH,qDACK,eAAe,GACf,qBAAqB,CAAC,4BAA4B,CAAC,KACtD,IAAI,EAAE,eAAe,IACrB;AACJ,CAAC","sourcesContent":["/* Copyright (c) 2023 Environmental Systems Research Institute, Inc.\n * Apache-2.0 */\n\nimport {\n IApiKeyResponse,\n IUpdateApiKeyOptions\n} from \"./shared/types/apiKeyType.js\";\nimport { getRegisteredAppInfo } from \"./shared/getRegisteredAppInfo.js\";\nimport {\n appToApiKeyProperties,\n extractBaseRequestOptions,\n stringifyArrays,\n registeredAppResponseToApp,\n generateApiKeyTokens,\n generateOptionsToSlots,\n buildExpirationDateParams\n} from \"./shared/helpers.js\";\nimport { getItem, getPortalUrl, updateItem } from \"@esri/arcgis-rest-portal\";\nimport { appendCustomParams, request } from \"@esri/arcgis-rest-request\";\nimport {\n IApp,\n IGetAppInfoOptions,\n IRegisteredAppResponse\n} from \"./shared/types/appType.js\";\n\n/**\n * Used to update an API key.\n *\n * Notes about `privileges` and `httpReferrers` options:\n * 1. Provided option will override corresponding old option.\n * 2. Unprovided option will not trigger corresponding option updates.\n *\n * ```js\n * import { updateApiKey, IApiKeyResponse } 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 * const threeDaysFromToday = new Date();\n * threeDaysFromToday.setDate(threeDaysFromToday.getDate() + 3);\n * threeDaysFromToday.setHours(23, 59, 59, 999);\n *\n * updateApiKey({\n * itemId: \"xyz_itemId\",\n * privileges: [\"premium:user:geocode:temporary\"],\n * httpReferrers: [], // httpReferrers will be set to be empty\n * authentication: authSession\n * generateToken1: true, // optional,generate a new token\n * apiToken1ExpirationDate: threeDaysFromToday // optional, update expiration date\n * }).then((updatedAPIKey: IApiKeyResponse) => {\n * // => {accessToken1: \"xyz_key\", item: {tags: [\"xyz_tag1\", \"xyz_tag2\"], ...}, ...}\n * }).catch(e => {\n * // => an exception object\n * });\n * ```\n *\n * @param requestOptions - Options for {@linkcode updateApiKey | updateApiKey()}, including `itemId` of which API key to be operated on, optional new `privileges`, optional new `httpReferrers` and an {@linkcode ArcGISIdentityManager} authentication session.\n * @returns A Promise that will resolve to an {@linkcode IApiKeyResponse} object representing updated API key.\n */\nexport async function updateApiKey(\n requestOptions: IUpdateApiKeyOptions\n): Promise<IApiKeyResponse> {\n requestOptions.httpMethod = \"POST\";\n const baseRequestOptions = extractBaseRequestOptions(requestOptions); // get base requestOptions snapshot\n\n /**\n * step 1: update expiration dates if provided. Build the object up to avoid overwriting any existing properties.\n */\n if (\n requestOptions.apiToken1ExpirationDate ||\n requestOptions.apiToken2ExpirationDate\n ) {\n const updateParams = buildExpirationDateParams(requestOptions);\n await updateItem({\n ...baseRequestOptions,\n item: {\n id: requestOptions.itemId,\n ...updateParams\n },\n authentication: requestOptions.authentication\n });\n }\n\n /**\n * step 2: update privileges and httpReferrers if provided. Build the object up to avoid overwriting any existing properties.\n */\n if (requestOptions.privileges || requestOptions.httpReferrers) {\n const getAppOption: IGetAppInfoOptions = {\n ...baseRequestOptions,\n authentication: requestOptions.authentication,\n itemId: requestOptions.itemId\n };\n const appResponse = await getRegisteredAppInfo(getAppOption);\n const clientId = appResponse.client_id;\n const options = appendCustomParams(\n { ...appResponse, ...requestOptions }, // object with the custom params to look in\n [\"privileges\", \"httpReferrers\"] // keys you want copied to the params object\n );\n options.params.f = \"json\";\n\n // encode special params value (e.g. array type...) in advance in order to make encodeQueryString() works correctly\n stringifyArrays(options);\n\n const url = getPortalUrl(options) + `/oauth2/apps/${clientId}/update`;\n\n // Raw response from `/oauth2/apps/${clientId}/update`, apiKey not included because key is same.\n const updateResponse: IRegisteredAppResponse = await request(url, {\n ...options,\n authentication: requestOptions.authentication\n });\n }\n\n /**\n * step 3: get the updated item info to return to the user.\n */\n const updatedItemInfo = await getItem(requestOptions.itemId, {\n ...baseRequestOptions,\n authentication: requestOptions.authentication,\n params: { f: \"json\" }\n });\n\n /**\n * step 4: generate tokens if requested\n */\n const generatedTokens = await generateApiKeyTokens(\n requestOptions.itemId,\n generateOptionsToSlots(\n requestOptions.generateToken1,\n requestOptions.generateToken2\n ),\n {\n ...baseRequestOptions,\n authentication: requestOptions.authentication\n }\n );\n\n /**\n * step 5: get updated registered app info\n */\n const updatedRegisteredAppResponse = await getRegisteredAppInfo({\n ...baseRequestOptions,\n itemId: requestOptions.itemId,\n authentication: requestOptions.authentication\n });\n\n return {\n ...generatedTokens,\n ...appToApiKeyProperties(updatedRegisteredAppResponse),\n item: updatedItemInfo\n };\n}\n"]}
1
+ {"version":3,"file":"updateApiKey.js","sourceRoot":"","sources":["../../src/updateApiKey.ts"],"names":[],"mappings":"AAAA;gBACgB;AAMhB,OAAO,EAAE,oBAAoB,EAAE,MAAM,kCAAkC,CAAC;AACxE,OAAO,EACL,qBAAqB,EACrB,yBAAyB,EACzB,eAAe,EAEf,oBAAoB,EACpB,sBAAsB,EACtB,yBAAyB,EAC1B,MAAM,qBAAqB,CAAC;AAC7B,OAAO,EAAE,OAAO,EAAE,YAAY,EAAE,UAAU,EAAE,MAAM,0BAA0B,CAAC;AAC7E,OAAO,EAAE,kBAAkB,EAAE,OAAO,EAAE,MAAM,2BAA2B,CAAC;AAOxE;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAoCG;AACH,MAAM,CAAC,KAAK,UAAU,YAAY,CAChC,cAAoC;IAEpC,cAAc,CAAC,UAAU,GAAG,MAAM,CAAC;IACnC,MAAM,kBAAkB,GAAG,yBAAyB,CAAC,cAAc,CAAC,CAAC,CAAC,mCAAmC;IAEzG;;OAEG;IACH,IACE,cAAc,CAAC,uBAAuB;QACtC,cAAc,CAAC,uBAAuB,EACtC,CAAC;QACD,MAAM,YAAY,GAAG,yBAAyB,CAAC,cAAc,CAAC,CAAC;QAC/D,MAAM,UAAU,iCACX,kBAAkB,KACrB,IAAI,kBACF,EAAE,EAAE,cAAc,CAAC,MAAM,IACtB,YAAY,GAEjB,cAAc,EAAE,cAAc,CAAC,cAAc,IAC7C,CAAC;IACL,CAAC;IAED;;OAEG;IACH,IAAI,cAAc,CAAC,UAAU,IAAI,cAAc,CAAC,aAAa,EAAE,CAAC;QAC9D,MAAM,YAAY,mCACb,kBAAkB,KACrB,cAAc,EAAE,cAAc,CAAC,cAAc,EAC7C,MAAM,EAAE,cAAc,CAAC,MAAM,GAC9B,CAAC;QACF,MAAM,WAAW,GAAG,MAAM,oBAAoB,CAAC,YAAY,CAAC,CAAC;QAC7D,MAAM,QAAQ,GAAG,WAAW,CAAC,SAAS,CAAC;QACvC,MAAM,OAAO,GAAG,kBAAkB,iCAC3B,WAAW,GAAK,cAAc,GAAI,2CAA2C;QAClF,CAAC,YAAY,EAAE,eAAe,CAAC,CAAC,4CAA4C;SAC7E,CAAC;QACF,OAAO,CAAC,MAAM,CAAC,CAAC,GAAG,MAAM,CAAC;QAE1B,mHAAmH;QACnH,eAAe,CAAC,OAAO,CAAC,CAAC;QAEzB,MAAM,GAAG,GAAG,YAAY,CAAC,OAAO,CAAC,GAAG,gBAAgB,QAAQ,SAAS,CAAC;QAEtE,gGAAgG;QAChG,MAAM,cAAc,GAA2B,MAAM,OAAO,CAAC,GAAG,kCAC3D,OAAO,KACV,cAAc,EAAE,cAAc,CAAC,cAAc,IAC7C,CAAC;IACL,CAAC;IAED;;OAEG;IACH,MAAM,eAAe,GAAG,MAAM,OAAO,CAAC,cAAc,CAAC,MAAM,kCACtD,kBAAkB,KACrB,cAAc,EAAE,cAAc,CAAC,cAAc,EAC7C,MAAM,EAAE,EAAE,CAAC,EAAE,MAAM,EAAE,IACrB,CAAC;IAEH;;OAEG;IACH,MAAM,eAAe,GAAG,MAAM,oBAAoB,CAChD,cAAc,CAAC,MAAM,EACrB,sBAAsB,CACpB,cAAc,CAAC,cAAc,EAC7B,cAAc,CAAC,cAAc,CAC9B,kCAEI,kBAAkB,KACrB,cAAc,EAAE,cAAc,CAAC,cAAc,IAEhD,CAAC;IAEF;;OAEG;IACH,MAAM,4BAA4B,GAAG,MAAM,oBAAoB,iCAC1D,kBAAkB,KACrB,MAAM,EAAE,cAAc,CAAC,MAAM,EAC7B,cAAc,EAAE,cAAc,CAAC,cAAc,IAC7C,CAAC;IAEH,qDACK,eAAe,GACf,qBAAqB,CAAC,4BAA4B,CAAC,KACtD,IAAI,EAAE,eAAe,IACrB;AACJ,CAAC","sourcesContent":["/* Copyright (c) 2023 Environmental Systems Research Institute, Inc.\n * Apache-2.0 */\n\nimport {\n IApiKeyResponse,\n IUpdateApiKeyOptions\n} from \"./shared/types/apiKeyType.js\";\nimport { getRegisteredAppInfo } from \"./shared/getRegisteredAppInfo.js\";\nimport {\n appToApiKeyProperties,\n extractBaseRequestOptions,\n stringifyArrays,\n registeredAppResponseToApp,\n generateApiKeyTokens,\n generateOptionsToSlots,\n buildExpirationDateParams\n} from \"./shared/helpers.js\";\nimport { getItem, getPortalUrl, updateItem } from \"@esri/arcgis-rest-portal\";\nimport { appendCustomParams, request } from \"@esri/arcgis-rest-request\";\nimport {\n IApp,\n IGetAppInfoOptions,\n IRegisteredAppResponse\n} from \"./shared/types/appType.js\";\n\n/**\n * Used to update an API key.\n *\n * Notes about `privileges` and `httpReferrers` options:\n * 1. Provided option will override corresponding old option.\n * 2. Unprovided option will not trigger corresponding option updates.\n *\n * ```js\n * import { updateApiKey, IApiKeyResponse } 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 * const threeDaysFromToday = new Date();\n * threeDaysFromToday.setDate(threeDaysFromToday.getDate() + 3);\n * threeDaysFromToday.setHours(23, 59, 59, 999);\n *\n * updateApiKey({\n * itemId: \"xyz_itemId\",\n * privileges: [\"premium:user:geocode:temporary\"],\n * httpReferrers: [], // httpReferrers will be set to be empty\n * authentication: authSession\n * generateToken1: true, // optional,generate a new token\n * apiToken1ExpirationDate: threeDaysFromToday // optional, update expiration date\n * }).then((updatedAPIKey: IApiKeyResponse) => {\n * // => {accessToken1: \"xyz_key\", item: {tags: [\"xyz_tag1\", \"xyz_tag2\"], ...}, ...}\n * }).catch(e => {\n * // => an exception object\n * });\n * ```\n *\n * @param requestOptions - Options for {@linkcode updateApiKey | updateApiKey()}, including `itemId` of which API key to be operated on, optional new `privileges`, optional new `httpReferrers` and an {@linkcode @esri/arcgis-rest-request!ArcGISIdentityManager} authentication session.\n * @returns A Promise that will resolve to an {@linkcode IApiKeyResponse} object representing updated API key.\n */\nexport async function updateApiKey(\n requestOptions: IUpdateApiKeyOptions\n): Promise<IApiKeyResponse> {\n requestOptions.httpMethod = \"POST\";\n const baseRequestOptions = extractBaseRequestOptions(requestOptions); // get base requestOptions snapshot\n\n /**\n * step 1: update expiration dates if provided. Build the object up to avoid overwriting any existing properties.\n */\n if (\n requestOptions.apiToken1ExpirationDate ||\n requestOptions.apiToken2ExpirationDate\n ) {\n const updateParams = buildExpirationDateParams(requestOptions);\n await updateItem({\n ...baseRequestOptions,\n item: {\n id: requestOptions.itemId,\n ...updateParams\n },\n authentication: requestOptions.authentication\n });\n }\n\n /**\n * step 2: update privileges and httpReferrers if provided. Build the object up to avoid overwriting any existing properties.\n */\n if (requestOptions.privileges || requestOptions.httpReferrers) {\n const getAppOption: IGetAppInfoOptions = {\n ...baseRequestOptions,\n authentication: requestOptions.authentication,\n itemId: requestOptions.itemId\n };\n const appResponse = await getRegisteredAppInfo(getAppOption);\n const clientId = appResponse.client_id;\n const options = appendCustomParams(\n { ...appResponse, ...requestOptions }, // object with the custom params to look in\n [\"privileges\", \"httpReferrers\"] // keys you want copied to the params object\n );\n options.params.f = \"json\";\n\n // encode special params value (e.g. array type...) in advance in order to make encodeQueryString() works correctly\n stringifyArrays(options);\n\n const url = getPortalUrl(options) + `/oauth2/apps/${clientId}/update`;\n\n // Raw response from `/oauth2/apps/${clientId}/update`, apiKey not included because key is same.\n const updateResponse: IRegisteredAppResponse = await request(url, {\n ...options,\n authentication: requestOptions.authentication\n });\n }\n\n /**\n * step 3: get the updated item info to return to the user.\n */\n const updatedItemInfo = await getItem(requestOptions.itemId, {\n ...baseRequestOptions,\n authentication: requestOptions.authentication,\n params: { f: \"json\" }\n });\n\n /**\n * step 4: generate tokens if requested\n */\n const generatedTokens = await generateApiKeyTokens(\n requestOptions.itemId,\n generateOptionsToSlots(\n requestOptions.generateToken1,\n requestOptions.generateToken2\n ),\n {\n ...baseRequestOptions,\n authentication: requestOptions.authentication\n }\n );\n\n /**\n * step 5: get updated registered app info\n */\n const updatedRegisteredAppResponse = await getRegisteredAppInfo({\n ...baseRequestOptions,\n itemId: requestOptions.itemId,\n authentication: requestOptions.authentication\n });\n\n return {\n ...generatedTokens,\n ...appToApiKeyProperties(updatedRegisteredAppResponse),\n item: updatedItemInfo\n };\n}\n"]}
@@ -26,7 +26,7 @@ import { IOAuthApp, IUpdateOAuthOptions } from "./shared/types/oAuthType.js";
26
26
  * });
27
27
  * ```
28
28
  *
29
- * @param requestOptions - Options for {@linkcode updateOAuthApp | updateOAuthApp()}, including `itemId` of which OAuth app to be operated on, optional new `redirect_uris` and an {@linkcode ArcGISIdentityManager} authentication session.
29
+ * @param requestOptions - Options for {@linkcode updateOAuthApp | updateOAuthApp()}, including `itemId` of which OAuth app to be operated on, optional new `redirect_uris` and an {@linkcode @esri/arcgis-rest-request!ArcGISIdentityManager} authentication session.
30
30
  * @returns A Promise that will resolve to an {@linkcode IOAuthApp} object representing updated OAuth app.
31
31
  */
32
32
  export declare function updateOAuthApp(requestOptions: IUpdateOAuthOptions): Promise<IOAuthApp>;
@@ -31,7 +31,7 @@ import { getRegisteredAppInfo } from "./shared/getRegisteredAppInfo.js";
31
31
  * });
32
32
  * ```
33
33
  *
34
- * @param requestOptions - Options for {@linkcode updateOAuthApp | updateOAuthApp()}, including `itemId` of which OAuth app to be operated on, optional new `redirect_uris` and an {@linkcode ArcGISIdentityManager} authentication session.
34
+ * @param requestOptions - Options for {@linkcode updateOAuthApp | updateOAuthApp()}, including `itemId` of which OAuth app to be operated on, optional new `redirect_uris` and an {@linkcode @esri/arcgis-rest-request!ArcGISIdentityManager} authentication session.
35
35
  * @returns A Promise that will resolve to an {@linkcode IOAuthApp} object representing updated OAuth app.
36
36
  */
37
37
  export async function updateOAuthApp(requestOptions) {
@@ -1 +1 @@
1
- {"version":3,"file":"updateOAuthApp.js","sourceRoot":"","sources":["../../src/updateOAuthApp.ts"],"names":[],"mappings":"AAAA;gBACgB;AAEhB,OAAO,EACL,yBAAyB,EACzB,eAAe,EACf,0BAA0B,EAC1B,uBAAuB,EACxB,MAAM,qBAAqB,CAAC;AAC7B,OAAO,EAAE,OAAO,EAAE,YAAY,EAAE,MAAM,0BAA0B,CAAC;AACjE,OAAO,EAAE,kBAAkB,EAAE,OAAO,EAAE,MAAM,2BAA2B,CAAC;AAOxE,OAAO,EAAE,oBAAoB,EAAE,MAAM,kCAAkC,CAAC;AAExE;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA6BG;AACH,MAAM,CAAC,KAAK,UAAU,cAAc,CAClC,cAAmC;IAEnC,cAAc,CAAC,UAAU,GAAG,MAAM,CAAC;IAEnC,UAAU;IACV,MAAM,kBAAkB,GAAG,yBAAyB,CAAC,cAAc,CAAC,CAAC,CAAC,mCAAmC;IACzG,MAAM,YAAY,mCACb,kBAAkB,KACrB,cAAc,EAAE,cAAc,CAAC,cAAc,EAC7C,MAAM,EAAE,cAAc,CAAC,MAAM,GAC9B,CAAC;IAEF,MAAM,WAAW,GAAG,MAAM,oBAAoB,CAAC,YAAY,CAAC,CAAC;IAE7D,IAAI,WAAW,CAAC,OAAO,KAAK,QAAQ,EAAE;QACpC,MAAM,IAAI,KAAK,CAAC,+BAA+B,CAAC,CAAC;KAClD;IAED,MAAM,QAAQ,GAAG,WAAW,CAAC,SAAS,CAAC;IACvC,MAAM,OAAO,GAAG,kBAAkB,iCAAM,WAAW,GAAK,cAAc,GAAI;QACxE,eAAe;KAChB,CAAC,CAAC;IACH,OAAO,CAAC,MAAM,CAAC,CAAC,GAAG,MAAM,CAAC;IAC1B,OAAO,CAAC,MAAM,CAAC,OAAO,GAAG,UAAU,CAAC;IAEpC,mHAAmH;IACnH,eAAe,CAAC,OAAO,CAAC,CAAC;IAEzB,MAAM,GAAG,GAAG,YAAY,CAAC,OAAO,CAAC,GAAG,gBAAgB,QAAQ,SAAS,CAAC;IAEtE,uDAAuD;IACvD,MAAM,cAAc,GAA2B,MAAM,OAAO,CAAC,GAAG,kCAC3D,OAAO,KACV,cAAc,EAAE,cAAc,CAAC,cAAc,IAC7C,CAAC;IAEH,MAAM,GAAG,GAAS,0BAA0B,CAAC,cAAc,CAAC,CAAC;IAE7D,MAAM,QAAQ,GAAG,MAAM,OAAO,CAAC,cAAc,CAAC,MAAM,kCAC/C,kBAAkB,KACrB,cAAc,EAAE,cAAc,CAAC,cAAc,EAC7C,MAAM,EAAE,EAAE,CAAC,EAAE,MAAM,EAAE,IACrB,CAAC;IAEH,uCACK,uBAAuB,CAAC,GAAG,CAAC,KAC/B,IAAI,EAAE,QAAQ,IACd;AACJ,CAAC","sourcesContent":["/* Copyright (c) 2023 Environmental Systems Research Institute, Inc.\n * Apache-2.0 */\n\nimport {\n extractBaseRequestOptions,\n stringifyArrays,\n registeredAppResponseToApp,\n appToOAuthAppProperties\n} from \"./shared/helpers.js\";\nimport { getItem, getPortalUrl } from \"@esri/arcgis-rest-portal\";\nimport { appendCustomParams, request } from \"@esri/arcgis-rest-request\";\nimport {\n IApp,\n IGetAppInfoOptions,\n IRegisteredAppResponse\n} from \"./shared/types/appType.js\";\nimport { IOAuthApp, IUpdateOAuthOptions } from \"./shared/types/oAuthType.js\";\nimport { getRegisteredAppInfo } from \"./shared/getRegisteredAppInfo.js\";\n\n/**\n * Used to update an OAuth2.0 app.\n *\n * Notes about `redirect_uris` options:\n * 1. Provided option will override corresponding old option.\n * 2. Unprovided option will not trigger corresponding option updates.\n *\n * ```js\n * import { updateOAuthApp, IOAuthApp } 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 * updateOAuthApp({\n * itemId: \"xyz_itemId\",\n * authentication: authSession\n * }).then((updatedOAuthApp: IOAuthApp) => {\n * // => This OAuth app will be not be updated because its redirect_uris is not provided.\n * // => {redirect_uris: [\"http://localhost:3000/\"], item: {tags: [\"xyz_tag1\", \"xyz_tag2\"], ...}, ...}\n * }).catch(e => {\n * // => an exception object\n * });\n * ```\n *\n * @param requestOptions - Options for {@linkcode updateOAuthApp | updateOAuthApp()}, including `itemId` of which OAuth app to be operated on, optional new `redirect_uris` and an {@linkcode ArcGISIdentityManager} authentication session.\n * @returns A Promise that will resolve to an {@linkcode IOAuthApp} object representing updated OAuth app.\n */\nexport async function updateOAuthApp(\n requestOptions: IUpdateOAuthOptions\n): Promise<IOAuthApp> {\n requestOptions.httpMethod = \"POST\";\n\n // get app\n const baseRequestOptions = extractBaseRequestOptions(requestOptions); // get base requestOptions snapshot\n const getAppOption: IGetAppInfoOptions = {\n ...baseRequestOptions,\n authentication: requestOptions.authentication,\n itemId: requestOptions.itemId\n };\n\n const appResponse = await getRegisteredAppInfo(getAppOption);\n\n if (appResponse.appType === \"apikey\") {\n throw new Error(\"Item is not an OAuth 2.0 app.\");\n }\n\n const clientId = appResponse.client_id;\n const options = appendCustomParams({ ...appResponse, ...requestOptions }, [\n \"redirect_uris\"\n ]);\n options.params.f = \"json\";\n options.params.appType = \"multiple\";\n\n // encode special params value (e.g. array type...) in advance in order to make encodeQueryString() works correctly\n stringifyArrays(options);\n\n const url = getPortalUrl(options) + `/oauth2/apps/${clientId}/update`;\n\n // Raw response from `/oauth2/apps/${clientId}/update`.\n const updateResponse: IRegisteredAppResponse = await request(url, {\n ...options,\n authentication: requestOptions.authentication\n });\n\n const app: IApp = registeredAppResponseToApp(updateResponse);\n\n const itemInfo = await getItem(requestOptions.itemId, {\n ...baseRequestOptions,\n authentication: requestOptions.authentication,\n params: { f: \"json\" }\n });\n\n return {\n ...appToOAuthAppProperties(app),\n item: itemInfo\n };\n}\n"]}
1
+ {"version":3,"file":"updateOAuthApp.js","sourceRoot":"","sources":["../../src/updateOAuthApp.ts"],"names":[],"mappings":"AAAA;gBACgB;AAEhB,OAAO,EACL,yBAAyB,EACzB,eAAe,EACf,0BAA0B,EAC1B,uBAAuB,EACxB,MAAM,qBAAqB,CAAC;AAC7B,OAAO,EAAE,OAAO,EAAE,YAAY,EAAE,MAAM,0BAA0B,CAAC;AACjE,OAAO,EAAE,kBAAkB,EAAE,OAAO,EAAE,MAAM,2BAA2B,CAAC;AAOxE,OAAO,EAAE,oBAAoB,EAAE,MAAM,kCAAkC,CAAC;AAExE;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA6BG;AACH,MAAM,CAAC,KAAK,UAAU,cAAc,CAClC,cAAmC;IAEnC,cAAc,CAAC,UAAU,GAAG,MAAM,CAAC;IAEnC,UAAU;IACV,MAAM,kBAAkB,GAAG,yBAAyB,CAAC,cAAc,CAAC,CAAC,CAAC,mCAAmC;IACzG,MAAM,YAAY,mCACb,kBAAkB,KACrB,cAAc,EAAE,cAAc,CAAC,cAAc,EAC7C,MAAM,EAAE,cAAc,CAAC,MAAM,GAC9B,CAAC;IAEF,MAAM,WAAW,GAAG,MAAM,oBAAoB,CAAC,YAAY,CAAC,CAAC;IAE7D,IAAI,WAAW,CAAC,OAAO,KAAK,QAAQ,EAAE,CAAC;QACrC,MAAM,IAAI,KAAK,CAAC,+BAA+B,CAAC,CAAC;IACnD,CAAC;IAED,MAAM,QAAQ,GAAG,WAAW,CAAC,SAAS,CAAC;IACvC,MAAM,OAAO,GAAG,kBAAkB,iCAAM,WAAW,GAAK,cAAc,GAAI;QACxE,eAAe;KAChB,CAAC,CAAC;IACH,OAAO,CAAC,MAAM,CAAC,CAAC,GAAG,MAAM,CAAC;IAC1B,OAAO,CAAC,MAAM,CAAC,OAAO,GAAG,UAAU,CAAC;IAEpC,mHAAmH;IACnH,eAAe,CAAC,OAAO,CAAC,CAAC;IAEzB,MAAM,GAAG,GAAG,YAAY,CAAC,OAAO,CAAC,GAAG,gBAAgB,QAAQ,SAAS,CAAC;IAEtE,uDAAuD;IACvD,MAAM,cAAc,GAA2B,MAAM,OAAO,CAAC,GAAG,kCAC3D,OAAO,KACV,cAAc,EAAE,cAAc,CAAC,cAAc,IAC7C,CAAC;IAEH,MAAM,GAAG,GAAS,0BAA0B,CAAC,cAAc,CAAC,CAAC;IAE7D,MAAM,QAAQ,GAAG,MAAM,OAAO,CAAC,cAAc,CAAC,MAAM,kCAC/C,kBAAkB,KACrB,cAAc,EAAE,cAAc,CAAC,cAAc,EAC7C,MAAM,EAAE,EAAE,CAAC,EAAE,MAAM,EAAE,IACrB,CAAC;IAEH,uCACK,uBAAuB,CAAC,GAAG,CAAC,KAC/B,IAAI,EAAE,QAAQ,IACd;AACJ,CAAC","sourcesContent":["/* Copyright (c) 2023 Environmental Systems Research Institute, Inc.\n * Apache-2.0 */\n\nimport {\n extractBaseRequestOptions,\n stringifyArrays,\n registeredAppResponseToApp,\n appToOAuthAppProperties\n} from \"./shared/helpers.js\";\nimport { getItem, getPortalUrl } from \"@esri/arcgis-rest-portal\";\nimport { appendCustomParams, request } from \"@esri/arcgis-rest-request\";\nimport {\n IApp,\n IGetAppInfoOptions,\n IRegisteredAppResponse\n} from \"./shared/types/appType.js\";\nimport { IOAuthApp, IUpdateOAuthOptions } from \"./shared/types/oAuthType.js\";\nimport { getRegisteredAppInfo } from \"./shared/getRegisteredAppInfo.js\";\n\n/**\n * Used to update an OAuth2.0 app.\n *\n * Notes about `redirect_uris` options:\n * 1. Provided option will override corresponding old option.\n * 2. Unprovided option will not trigger corresponding option updates.\n *\n * ```js\n * import { updateOAuthApp, IOAuthApp } 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 * updateOAuthApp({\n * itemId: \"xyz_itemId\",\n * authentication: authSession\n * }).then((updatedOAuthApp: IOAuthApp) => {\n * // => This OAuth app will be not be updated because its redirect_uris is not provided.\n * // => {redirect_uris: [\"http://localhost:3000/\"], item: {tags: [\"xyz_tag1\", \"xyz_tag2\"], ...}, ...}\n * }).catch(e => {\n * // => an exception object\n * });\n * ```\n *\n * @param requestOptions - Options for {@linkcode updateOAuthApp | updateOAuthApp()}, including `itemId` of which OAuth app to be operated on, optional new `redirect_uris` and an {@linkcode @esri/arcgis-rest-request!ArcGISIdentityManager} authentication session.\n * @returns A Promise that will resolve to an {@linkcode IOAuthApp} object representing updated OAuth app.\n */\nexport async function updateOAuthApp(\n requestOptions: IUpdateOAuthOptions\n): Promise<IOAuthApp> {\n requestOptions.httpMethod = \"POST\";\n\n // get app\n const baseRequestOptions = extractBaseRequestOptions(requestOptions); // get base requestOptions snapshot\n const getAppOption: IGetAppInfoOptions = {\n ...baseRequestOptions,\n authentication: requestOptions.authentication,\n itemId: requestOptions.itemId\n };\n\n const appResponse = await getRegisteredAppInfo(getAppOption);\n\n if (appResponse.appType === \"apikey\") {\n throw new Error(\"Item is not an OAuth 2.0 app.\");\n }\n\n const clientId = appResponse.client_id;\n const options = appendCustomParams({ ...appResponse, ...requestOptions }, [\n \"redirect_uris\"\n ]);\n options.params.f = \"json\";\n options.params.appType = \"multiple\";\n\n // encode special params value (e.g. array type...) in advance in order to make encodeQueryString() works correctly\n stringifyArrays(options);\n\n const url = getPortalUrl(options) + `/oauth2/apps/${clientId}/update`;\n\n // Raw response from `/oauth2/apps/${clientId}/update`.\n const updateResponse: IRegisteredAppResponse = await request(url, {\n ...options,\n authentication: requestOptions.authentication\n });\n\n const app: IApp = registeredAppResponseToApp(updateResponse);\n\n const itemInfo = await getItem(requestOptions.itemId, {\n ...baseRequestOptions,\n authentication: requestOptions.authentication,\n params: { f: \"json\" }\n });\n\n return {\n ...appToOAuthAppProperties(app),\n item: itemInfo\n };\n}\n"]}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@esri/arcgis-rest-developer-credentials",
3
- "version": "2.1.1-alpha.1",
3
+ "version": "4.9.0",
4
4
  "description": "Developer Credentials for @esri/arcgis-rest-js",
5
5
  "license": "Apache-2.0",
6
6
  "keywords": [
@@ -43,12 +43,12 @@
43
43
  "node": ">=12.20.0"
44
44
  },
45
45
  "dependencies": {
46
- "@esri/arcgis-rest-portal": "4.6.2-alpha.1",
47
- "@esri/arcgis-rest-request": "4.5.1-alpha.1"
46
+ "@esri/arcgis-rest-portal": "^4.9.0",
47
+ "@esri/arcgis-rest-request": "^4.9.0"
48
48
  },
49
49
  "devDependencies": {
50
- "@esri/arcgis-rest-portal": "4.6.2-alpha.1",
51
- "@esri/arcgis-rest-request": "4.5.1-alpha.1"
50
+ "@esri/arcgis-rest-portal": "^4.9.0",
51
+ "@esri/arcgis-rest-request": "^4.9.0"
52
52
  },
53
53
  "contributors": [
54
54
  "Patrick Arlt <parlt@esri.com> (http://patrickarlt.com/)",