@globus/sdk 3.3.0 → 3.4.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/README.md +1 -1
- package/cjs/index.d.ts +1 -0
- package/cjs/index.d.ts.map +1 -1
- package/cjs/index.js +2 -1
- package/cjs/index.js.map +1 -1
- package/cjs/lib/apps/web.d.ts +1 -1
- package/cjs/lib/apps/web.d.ts.map +1 -1
- package/cjs/lib/apps/web.js +2 -2
- package/cjs/lib/apps/web.js.map +1 -1
- package/cjs/lib/core/authorization/AuthorizationManager.d.ts +61 -9
- package/cjs/lib/core/authorization/AuthorizationManager.d.ts.map +1 -1
- package/cjs/lib/core/authorization/AuthorizationManager.js +59 -23
- package/cjs/lib/core/authorization/AuthorizationManager.js.map +1 -1
- package/cjs/lib/core/authorization/RedirectTransport.d.ts +7 -6
- package/cjs/lib/core/authorization/RedirectTransport.d.ts.map +1 -1
- package/cjs/lib/core/authorization/RedirectTransport.js.map +1 -1
- package/cjs/lib/core/authorization/index.d.ts +7 -7
- package/cjs/lib/core/authorization/index.d.ts.map +1 -1
- package/cjs/lib/core/authorization/index.js +8 -31
- package/cjs/lib/core/authorization/index.js.map +1 -1
- package/cjs/lib/core/errors.d.ts +6 -0
- package/cjs/lib/core/errors.d.ts.map +1 -1
- package/cjs/lib/core/errors.js +6 -0
- package/cjs/lib/core/errors.js.map +1 -1
- package/cjs/lib/core/global.d.ts +1 -0
- package/cjs/lib/core/global.d.ts.map +1 -1
- package/cjs/lib/core/info/index.d.ts +23 -0
- package/cjs/lib/core/info/index.d.ts.map +1 -0
- package/cjs/lib/core/info/index.js +45 -0
- package/cjs/lib/core/info/index.js.map +1 -0
- package/cjs/lib/core/info/private.d.ts +26 -0
- package/cjs/lib/core/info/private.d.ts.map +1 -0
- package/cjs/lib/core/info/private.js +48 -0
- package/cjs/lib/core/info/private.js.map +1 -0
- package/cjs/lib/core/info/version.d.ts +2 -0
- package/cjs/lib/core/info/version.d.ts.map +1 -0
- package/cjs/lib/core/info/version.js +7 -0
- package/cjs/lib/core/info/version.js.map +1 -0
- package/cjs/lib/services/globus-connect-server/client.d.ts +30 -0
- package/cjs/lib/services/globus-connect-server/client.d.ts.map +1 -1
- package/cjs/lib/services/globus-connect-server/client.js +6 -0
- package/cjs/lib/services/globus-connect-server/client.js.map +1 -1
- package/cjs/lib/services/globus-connect-server/index.d.ts +1 -0
- package/cjs/lib/services/globus-connect-server/index.d.ts.map +1 -1
- package/cjs/lib/services/globus-connect-server/index.js +2 -1
- package/cjs/lib/services/globus-connect-server/index.js.map +1 -1
- package/cjs/lib/services/globus-connect-server/service/https.d.ts +41 -0
- package/cjs/lib/services/globus-connect-server/service/https.d.ts.map +1 -0
- package/cjs/lib/services/globus-connect-server/service/https.js +38 -0
- package/cjs/lib/services/globus-connect-server/service/https.js.map +1 -0
- package/cjs/lib/services/shared.d.ts +11 -2
- package/cjs/lib/services/shared.d.ts.map +1 -1
- package/cjs/lib/services/shared.js +23 -7
- package/cjs/lib/services/shared.js.map +1 -1
- package/cjs/lib/services/types.d.ts +2 -0
- package/cjs/lib/services/types.d.ts.map +1 -1
- package/esm/index.d.ts +1 -0
- package/esm/index.d.ts.map +1 -1
- package/esm/index.js +1 -0
- package/esm/index.js.map +1 -1
- package/esm/lib/apps/web.d.ts +1 -1
- package/esm/lib/apps/web.d.ts.map +1 -1
- package/esm/lib/apps/web.js +1 -1
- package/esm/lib/apps/web.js.map +1 -1
- package/esm/lib/core/authorization/AuthorizationManager.d.ts +61 -9
- package/esm/lib/core/authorization/AuthorizationManager.d.ts.map +1 -1
- package/esm/lib/core/authorization/AuthorizationManager.js +60 -24
- package/esm/lib/core/authorization/AuthorizationManager.js.map +1 -1
- package/esm/lib/core/authorization/RedirectTransport.d.ts +7 -6
- package/esm/lib/core/authorization/RedirectTransport.d.ts.map +1 -1
- package/esm/lib/core/authorization/RedirectTransport.js.map +1 -1
- package/esm/lib/core/authorization/index.d.ts +7 -7
- package/esm/lib/core/authorization/index.d.ts.map +1 -1
- package/esm/lib/core/authorization/index.js +7 -7
- package/esm/lib/core/authorization/index.js.map +1 -1
- package/esm/lib/core/errors.d.ts +6 -0
- package/esm/lib/core/errors.d.ts.map +1 -1
- package/esm/lib/core/errors.js +6 -0
- package/esm/lib/core/errors.js.map +1 -1
- package/esm/lib/core/global.d.ts +1 -0
- package/esm/lib/core/global.d.ts.map +1 -1
- package/esm/lib/core/info/index.d.ts +23 -0
- package/esm/lib/core/info/index.d.ts.map +1 -0
- package/esm/lib/core/info/index.js +39 -0
- package/esm/lib/core/info/index.js.map +1 -0
- package/esm/lib/core/info/private.d.ts +26 -0
- package/esm/lib/core/info/private.d.ts.map +1 -0
- package/esm/lib/core/info/private.js +41 -0
- package/esm/lib/core/info/private.js.map +1 -0
- package/esm/lib/core/info/version.d.ts +2 -0
- package/esm/lib/core/info/version.d.ts.map +1 -0
- package/esm/lib/core/info/version.js +4 -0
- package/esm/lib/core/info/version.js.map +1 -0
- package/esm/lib/services/globus-connect-server/client.d.ts +30 -0
- package/esm/lib/services/globus-connect-server/client.d.ts.map +1 -1
- package/esm/lib/services/globus-connect-server/client.js +6 -0
- package/esm/lib/services/globus-connect-server/client.js.map +1 -1
- package/esm/lib/services/globus-connect-server/index.d.ts +1 -0
- package/esm/lib/services/globus-connect-server/index.d.ts.map +1 -1
- package/esm/lib/services/globus-connect-server/index.js +1 -0
- package/esm/lib/services/globus-connect-server/index.js.map +1 -1
- package/esm/lib/services/globus-connect-server/service/https.d.ts +41 -0
- package/esm/lib/services/globus-connect-server/service/https.d.ts.map +1 -0
- package/esm/lib/services/globus-connect-server/service/https.js +35 -0
- package/esm/lib/services/globus-connect-server/service/https.js.map +1 -0
- package/esm/lib/services/shared.d.ts +11 -2
- package/esm/lib/services/shared.d.ts.map +1 -1
- package/esm/lib/services/shared.js +23 -7
- package/esm/lib/services/shared.js.map +1 -1
- package/esm/lib/services/types.d.ts +2 -0
- package/esm/lib/services/types.d.ts.map +1 -1
- package/package.json +1 -1
- package/umd/globus.production.js +1 -1
- package/cjs/lib/core/authorization/tokens.d.ts +0 -8
- package/cjs/lib/core/authorization/tokens.d.ts.map +0 -1
- package/cjs/lib/core/authorization/tokens.js +0 -24
- package/cjs/lib/core/authorization/tokens.js.map +0 -1
- package/esm/lib/core/authorization/tokens.d.ts +0 -8
- package/esm/lib/core/authorization/tokens.d.ts.map +0 -1
- package/esm/lib/core/authorization/tokens.js +0 -20
- package/esm/lib/core/authorization/tokens.js.map +0 -1
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type IConfig from 'js-pkce/dist/IConfig';
|
|
2
2
|
import { Event } from './Event.js';
|
|
3
|
-
import { GetTokenOptions } from './RedirectTransport.js';
|
|
3
|
+
import { RedirectTransportOptions, GetTokenOptions } from './RedirectTransport.js';
|
|
4
4
|
import { TokenLookup } from './TokenLookup.js';
|
|
5
5
|
import { AuthorizationRequirementsError, ConsentRequiredError } from '../errors.js';
|
|
6
6
|
import type { JwtUserInfo, Token, TokenResponse, TokenWithRefresh } from '../../services/auth/types.js';
|
|
@@ -20,7 +20,35 @@ export type AuthorizationManagerConfiguration = {
|
|
|
20
20
|
defaultScopes?: string | false;
|
|
21
21
|
};
|
|
22
22
|
/**
|
|
23
|
-
*
|
|
23
|
+
* Provides management of Globus authorization context for your application.
|
|
24
|
+
* - Handles the OAuth protcol flow (via PKCE)
|
|
25
|
+
* - Token lifecycle management
|
|
26
|
+
* - Common errors (e.g., `ConsentRequired`, `authorization_requirements`)
|
|
27
|
+
*
|
|
28
|
+
* Once you configure your instance, you can determine the authenticated state using `manager.authenticated`.
|
|
29
|
+
*
|
|
30
|
+
* To prompt a user to authenticate, call `manager.login()` on user interaction – this will initiate the OAuth protocol flow with your configured client and scopes, resulting in an initial redirect to Globus Auth.
|
|
31
|
+
*
|
|
32
|
+
* Once the user authenticates with Globus Auth, they will be redirected to your application using the configured `redirect` URL. On this URL, you will need to call `manager.handleCodeRedirect` (using a manager instance configured in the same manner that initiated the `manager.login()` call) to complete the PKCE flow, exchanging the provided code for a valid token, or tokens.
|
|
33
|
+
*
|
|
34
|
+
* All tokens managed by the `AuthorizationManager` instance can be found on `manager.token`.
|
|
35
|
+
*
|
|
36
|
+
* ### Registering your Globus Application
|
|
37
|
+
*
|
|
38
|
+
* The `AuthorizationManager` expects your Globus Application to be registered as an OAuth public client.
|
|
39
|
+
* In this Globus Web Application, this option is referenced as "_Register a thick client or script that will be installed and run by users on their devices_".
|
|
40
|
+
*
|
|
41
|
+
* @example <caption>Creating an AuthorizationManager instance.</caption>
|
|
42
|
+
* import { authorization } from "globus/sdk";
|
|
43
|
+
*
|
|
44
|
+
* const manager = authorization.create({
|
|
45
|
+
* // Your registered Globus Application client ID.
|
|
46
|
+
* client_id: '...',
|
|
47
|
+
* // The redirect URL for your application; Where you will call `manager.handleCodeRedirect()`
|
|
48
|
+
* redirect: 'https://example.com/callback',
|
|
49
|
+
* // Known scopes required by your application.
|
|
50
|
+
* scopes: 'urn:globus:auth:scope:transfer.api.globus.org:all',
|
|
51
|
+
* });
|
|
24
52
|
*/
|
|
25
53
|
export declare class AuthorizationManager {
|
|
26
54
|
#private;
|
|
@@ -80,7 +108,13 @@ export declare class AuthorizationManager {
|
|
|
80
108
|
* @param token The well-formed token with a `refresh_token` attribute.
|
|
81
109
|
*/
|
|
82
110
|
refreshToken(token: TokenWithRefresh): Promise<void>;
|
|
111
|
+
/**
|
|
112
|
+
* Whether or not the instance has a reference to a Globus Auth token.
|
|
113
|
+
*/
|
|
83
114
|
hasGlobusAuthToken(): boolean;
|
|
115
|
+
/**
|
|
116
|
+
* Retrieve the Globus Auth token managed by the instance.
|
|
117
|
+
*/
|
|
84
118
|
getGlobusAuthToken(): any;
|
|
85
119
|
/**
|
|
86
120
|
* Reset the authenticated state and clear all tokens from storage.
|
|
@@ -90,29 +124,47 @@ export declare class AuthorizationManager {
|
|
|
90
124
|
/**
|
|
91
125
|
* Initiate the login process by redirecting to the Globus Auth login page.
|
|
92
126
|
*/
|
|
93
|
-
login(
|
|
127
|
+
login(options?: {
|
|
128
|
+
additionalParams: {};
|
|
129
|
+
}): void;
|
|
130
|
+
/**
|
|
131
|
+
* This method will attempt to complete the PKCE protocol flow.
|
|
132
|
+
*/
|
|
94
133
|
handleCodeRedirect(options?: {
|
|
95
134
|
shouldReplace: GetTokenOptions['shouldReplace'];
|
|
135
|
+
additionalParams?: RedirectTransportOptions['params'];
|
|
96
136
|
}): Promise<void>;
|
|
97
137
|
/**
|
|
98
138
|
* Handle an error response from a Globus service in the context of this `AuthorizationManager`.
|
|
99
139
|
* This method will introspect the response and attempt to handle any errors that should result
|
|
100
140
|
* in some additional Globus Auth interaction.
|
|
101
|
-
* @param response
|
|
102
|
-
* @param
|
|
141
|
+
* @param response The error response from a Globus service.
|
|
142
|
+
* @param {object|boolean} options Options for handling the error response. If a boolean is provided, this will be treated as the `options.execute` value.
|
|
143
|
+
* @param options.execute Whether to execute the handler immediately.
|
|
144
|
+
* @param options.additionalParms Additional query parameters to be included with the transport generated URL.
|
|
103
145
|
*/
|
|
104
|
-
handleErrorResponse(response: Record<string, unknown>,
|
|
105
|
-
|
|
146
|
+
handleErrorResponse(response: Record<string, unknown>, options?: {
|
|
147
|
+
execute?: true;
|
|
148
|
+
additionalParams?: RedirectTransportOptions['params'];
|
|
149
|
+
} | true): void;
|
|
150
|
+
handleErrorResponse(response: Record<string, unknown>, options?: {
|
|
151
|
+
execute?: false;
|
|
152
|
+
additionalParams?: RedirectTransportOptions['params'];
|
|
153
|
+
} | false): () => void;
|
|
106
154
|
/**
|
|
107
155
|
* Process a well-formed Authorization Requirements error response from a Globus service
|
|
108
156
|
* and redirect the user to the Globus Auth login page with the necessary parameters.
|
|
109
157
|
*/
|
|
110
|
-
handleAuthorizationRequirementsError(response: AuthorizationRequirementsError
|
|
158
|
+
handleAuthorizationRequirementsError(response: AuthorizationRequirementsError, options?: {
|
|
159
|
+
additionalParams?: RedirectTransportOptions['params'];
|
|
160
|
+
}): void;
|
|
111
161
|
/**
|
|
112
162
|
* Process a well-formed `ConsentRequired` error response from a Globus service
|
|
113
163
|
* and redirect the user to the Globus Auth login page with the necessary parameters.
|
|
114
164
|
*/
|
|
115
|
-
handleConsentRequiredError(response: ConsentRequiredError
|
|
165
|
+
handleConsentRequiredError(response: ConsentRequiredError, options?: {
|
|
166
|
+
additionalParams?: RedirectTransportOptions['params'];
|
|
167
|
+
}): void;
|
|
116
168
|
/**
|
|
117
169
|
* Add a Globus Auth token response to storage, if `other_tokens` are present they are also added.
|
|
118
170
|
* This method is mostly used internally by the `AuthorizationManager`, but can be used by downstream
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"AuthorizationManager.d.ts","sourceRoot":"","sources":["../../../../../src/lib/core/authorization/AuthorizationManager.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"AuthorizationManager.d.ts","sourceRoot":"","sources":["../../../../../src/lib/core/authorization/AuthorizationManager.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,OAAO,MAAM,sBAAsB,CAAC;AAahD,OAAO,EAAE,KAAK,EAAE,MAAM,YAAY,CAAC;AACnC,OAAO,EACL,wBAAwB,EACxB,eAAe,EAEhB,MAAM,wBAAwB,CAAC;AAChC,OAAO,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAC;AAE/C,OAAO,EAGL,8BAA8B,EAC9B,oBAAoB,EACrB,MAAM,cAAc,CAAC;AAEtB,OAAO,KAAK,EACV,WAAW,EACX,KAAK,EACL,aAAa,EACb,gBAAgB,EACjB,MAAM,8BAA8B,CAAC;AAEtC,MAAM,MAAM,iCAAiC,GAAG;IAC9C,MAAM,EAAE,OAAO,CAAC,WAAW,CAAC,CAAC;IAC7B,MAAM,CAAC,EAAE,OAAO,CAAC,kBAAkB,CAAC,CAAC;IACrC,QAAQ,EAAE,OAAO,CAAC,cAAc,CAAC,CAAC;IAClC;;;OAGG;IACH,gBAAgB,CAAC,EAAE,OAAO,CAAC;IAC3B;;;OAGG;IACH,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gB,CAAC,EAAE,wBAAwB,CAAC,QAAQ,CAAC,CAAA;KAAE,GAAG,KAAK,GAC3F,MAAM,IAAI;IA4Cb;;;OAGG;IACH,oCAAoC,CAClC,QAAQ,EAAE,8BAA8B,EACxC,OAAO,CAAC,EAAE;QAAE,gBAAgB,CAAC,EAAE,wBAAwB,CAAC,QAAQ,CAAC,CAAA;KAAE;IAiBrE;;;OAGG;IACH,0BAA0B,CACxB,QAAQ,EAAE,oBAAoB,EAC9B,OAAO,CAAC,EAAE;QAAE,gBAAgB,CAAC,EAAE,wBAAwB,CAAC,QAAQ,CAAC,CAAA;KAAE;IAWrE;;;;OAIG;IACH,gBAAgB,UAAW,KAAK,GAAG,aAAa,UAM9C;IAEF;;;;OAIG;IACG,MAAM;CAoBb"}
|
|
@@ -19,24 +19,52 @@ var __classPrivateFieldSet = (this && this.__classPrivateFieldSet) || function (
|
|
|
19
19
|
return (kind === "a" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value)), value;
|
|
20
20
|
};
|
|
21
21
|
var _AuthorizationManager_instances, _AuthorizationManager_transport, _AuthorizationManager_authenticated, _AuthorizationManager_silentRefreshTokens, _AuthorizationManager_checkAuthorizationState, _AuthorizationManager_bootstrapFromStorageState, _AuthorizationManager_emitAuthenticatedState, _AuthorizationManager_withOfflineAccess, _AuthorizationManager_buildTransport, _AuthorizationManager_revokeToken;
|
|
22
|
-
/**
|
|
23
|
-
* @module Authorization
|
|
24
|
-
* @group Core
|
|
25
|
-
*/
|
|
26
22
|
import { jwtDecode } from 'jwt-decode';
|
|
27
23
|
import { getAuthorizationEndpoint, getTokenEndpoint, isGlobusAuthTokenResponse, isRefreshToken, oauth2, } from '../../services/auth/index.js';
|
|
28
24
|
import { createStorage, getStorage } from '../storage/index.js';
|
|
29
25
|
import { log } from '../logger.js';
|
|
30
26
|
import { Event } from './Event.js';
|
|
31
|
-
import { RedirectTransport } from './RedirectTransport.js';
|
|
27
|
+
import { RedirectTransport, } from './RedirectTransport.js';
|
|
32
28
|
import { TokenLookup } from './TokenLookup.js';
|
|
33
29
|
import { isConsentRequiredError, isAuthorizationRequirementsError, } from '../errors.js';
|
|
34
30
|
const DEFAULT_CONFIGURATION = {
|
|
35
31
|
useRefreshTokens: false,
|
|
36
32
|
defaultScopes: 'openid profile email',
|
|
37
33
|
};
|
|
34
|
+
const DEFAULT_HANDLE_ERROR_OPTIONS = {
|
|
35
|
+
execute: true,
|
|
36
|
+
additionalParams: undefined,
|
|
37
|
+
};
|
|
38
38
|
/**
|
|
39
|
-
*
|
|
39
|
+
* Provides management of Globus authorization context for your application.
|
|
40
|
+
* - Handles the OAuth protcol flow (via PKCE)
|
|
41
|
+
* - Token lifecycle management
|
|
42
|
+
* - Common errors (e.g., `ConsentRequired`, `authorization_requirements`)
|
|
43
|
+
*
|
|
44
|
+
* Once you configure your instance, you can determine the authenticated state using `manager.authenticated`.
|
|
45
|
+
*
|
|
46
|
+
* To prompt a user to authenticate, call `manager.login()` on user interaction – this will initiate the OAuth protocol flow with your configured client and scopes, resulting in an initial redirect to Globus Auth.
|
|
47
|
+
*
|
|
48
|
+
* Once the user authenticates with Globus Auth, they will be redirected to your application using the configured `redirect` URL. On this URL, you will need to call `manager.handleCodeRedirect` (using a manager instance configured in the same manner that initiated the `manager.login()` call) to complete the PKCE flow, exchanging the provided code for a valid token, or tokens.
|
|
49
|
+
*
|
|
50
|
+
* All tokens managed by the `AuthorizationManager` instance can be found on `manager.token`.
|
|
51
|
+
*
|
|
52
|
+
* ### Registering your Globus Application
|
|
53
|
+
*
|
|
54
|
+
* The `AuthorizationManager` expects your Globus Application to be registered as an OAuth public client.
|
|
55
|
+
* In this Globus Web Application, this option is referenced as "_Register a thick client or script that will be installed and run by users on their devices_".
|
|
56
|
+
*
|
|
57
|
+
* @example <caption>Creating an AuthorizationManager instance.</caption>
|
|
58
|
+
* import { authorization } from "globus/sdk";
|
|
59
|
+
*
|
|
60
|
+
* const manager = authorization.create({
|
|
61
|
+
* // Your registered Globus Application client ID.
|
|
62
|
+
* client_id: '...',
|
|
63
|
+
* // The redirect URL for your application; Where you will call `manager.handleCodeRedirect()`
|
|
64
|
+
* redirect: 'https://example.com/callback',
|
|
65
|
+
* // Known scopes required by your application.
|
|
66
|
+
* scopes: 'urn:globus:auth:scope:transfer.api.globus.org:all',
|
|
67
|
+
* });
|
|
40
68
|
*/
|
|
41
69
|
export class AuthorizationManager {
|
|
42
70
|
/**
|
|
@@ -163,9 +191,15 @@ export class AuthorizationManager {
|
|
|
163
191
|
}
|
|
164
192
|
});
|
|
165
193
|
}
|
|
194
|
+
/**
|
|
195
|
+
* Whether or not the instance has a reference to a Globus Auth token.
|
|
196
|
+
*/
|
|
166
197
|
hasGlobusAuthToken() {
|
|
167
198
|
return this.getGlobusAuthToken() !== null;
|
|
168
199
|
}
|
|
200
|
+
/**
|
|
201
|
+
* Retrieve the Globus Auth token managed by the instance.
|
|
202
|
+
*/
|
|
169
203
|
getGlobusAuthToken() {
|
|
170
204
|
const entry = getStorage().get(`${this.storageKeyPrefix}auth.globus.org`);
|
|
171
205
|
return entry ? JSON.parse(entry) : null;
|
|
@@ -187,19 +221,22 @@ export class AuthorizationManager {
|
|
|
187
221
|
/**
|
|
188
222
|
* Initiate the login process by redirecting to the Globus Auth login page.
|
|
189
223
|
*/
|
|
190
|
-
login() {
|
|
224
|
+
login(options = { additionalParams: {} }) {
|
|
191
225
|
log('debug', 'AuthorizationManager.login');
|
|
192
226
|
this.reset();
|
|
193
227
|
/**
|
|
194
228
|
* In the future, it's possible that we may want to support different types of transports.
|
|
195
229
|
*/
|
|
196
|
-
const transport = __classPrivateFieldGet(this, _AuthorizationManager_instances, "m", _AuthorizationManager_buildTransport).call(this);
|
|
230
|
+
const transport = __classPrivateFieldGet(this, _AuthorizationManager_instances, "m", _AuthorizationManager_buildTransport).call(this, { params: options === null || options === void 0 ? void 0 : options.additionalParams });
|
|
197
231
|
transport.send();
|
|
198
232
|
}
|
|
233
|
+
/**
|
|
234
|
+
* This method will attempt to complete the PKCE protocol flow.
|
|
235
|
+
*/
|
|
199
236
|
handleCodeRedirect() {
|
|
200
|
-
return __awaiter(this, arguments, void 0, function* (options = { shouldReplace: true }) {
|
|
237
|
+
return __awaiter(this, arguments, void 0, function* (options = { shouldReplace: true, additionalParams: {} }) {
|
|
201
238
|
log('debug', 'AuthorizationManager.handleCodeRedirect');
|
|
202
|
-
const response = yield __classPrivateFieldGet(this, _AuthorizationManager_instances, "m", _AuthorizationManager_buildTransport).call(this).getToken({
|
|
239
|
+
const response = yield __classPrivateFieldGet(this, _AuthorizationManager_instances, "m", _AuthorizationManager_buildTransport).call(this, { params: options === null || options === void 0 ? void 0 : options.additionalParams }).getToken({
|
|
203
240
|
shouldReplace: options === null || options === void 0 ? void 0 : options.shouldReplace,
|
|
204
241
|
});
|
|
205
242
|
if (isGlobusAuthTokenResponse(response)) {
|
|
@@ -208,36 +245,34 @@ export class AuthorizationManager {
|
|
|
208
245
|
}
|
|
209
246
|
});
|
|
210
247
|
}
|
|
211
|
-
handleErrorResponse(response,
|
|
212
|
-
|
|
248
|
+
handleErrorResponse(response, options) {
|
|
249
|
+
const opts = typeof options === 'boolean'
|
|
250
|
+
? Object.assign(Object.assign({}, DEFAULT_HANDLE_ERROR_OPTIONS), { execute: options }) : Object.assign(Object.assign({}, DEFAULT_HANDLE_ERROR_OPTIONS), options);
|
|
251
|
+
log('debug', `AuthorizationManager.handleErrorResponse | response=${JSON.stringify(response)} execute=${opts.execute}`);
|
|
213
252
|
let handler = () => { };
|
|
214
253
|
if (isAuthorizationRequirementsError(response)) {
|
|
215
254
|
log('debug', 'AuthorizationManager.handleErrorResponse | error=AuthorizationRequirementsError');
|
|
216
|
-
handler = () => this.handleAuthorizationRequirementsError(response
|
|
255
|
+
handler = () => this.handleAuthorizationRequirementsError(response, {
|
|
256
|
+
additionalParams: opts.additionalParams,
|
|
257
|
+
});
|
|
217
258
|
}
|
|
218
259
|
if (isConsentRequiredError(response)) {
|
|
219
260
|
log('debug', 'AuthorizationManager.handleErrorResponse | error=ConsentRequiredError');
|
|
220
|
-
handler = () => this.handleConsentRequiredError(response);
|
|
261
|
+
handler = () => this.handleConsentRequiredError(response, { additionalParams: opts.additionalParams });
|
|
221
262
|
}
|
|
222
263
|
if ('code' in response && response['code'] === 'AuthenticationFailed') {
|
|
223
264
|
log('debug', 'AuthorizationManager.handleErrorResponse | error=AuthenticationFailed');
|
|
224
265
|
handler = () => this.revoke();
|
|
225
266
|
}
|
|
226
|
-
return execute === true ? handler() : handler;
|
|
267
|
+
return opts.execute === true ? handler() : handler;
|
|
227
268
|
}
|
|
228
269
|
/**
|
|
229
270
|
* Process a well-formed Authorization Requirements error response from a Globus service
|
|
230
271
|
* and redirect the user to the Globus Auth login page with the necessary parameters.
|
|
231
272
|
*/
|
|
232
|
-
handleAuthorizationRequirementsError(response) {
|
|
273
|
+
handleAuthorizationRequirementsError(response, options) {
|
|
233
274
|
__classPrivateFieldSet(this, _AuthorizationManager_transport, __classPrivateFieldGet(this, _AuthorizationManager_instances, "m", _AuthorizationManager_buildTransport).call(this, {
|
|
234
|
-
params: {
|
|
235
|
-
session_message: response.authorization_parameters.session_message,
|
|
236
|
-
session_required_identities: response.authorization_parameters.session_required_identities.join(','),
|
|
237
|
-
session_required_mfa: response.authorization_parameters.session_required_mfa,
|
|
238
|
-
session_required_single_domain: response.authorization_parameters.session_required_single_domain.join(','),
|
|
239
|
-
prompt: 'login',
|
|
240
|
-
},
|
|
275
|
+
params: Object.assign({ session_message: response.authorization_parameters.session_message, session_required_identities: response.authorization_parameters.session_required_identities.join(','), session_required_mfa: response.authorization_parameters.session_required_mfa, session_required_single_domain: response.authorization_parameters.session_required_single_domain.join(','), prompt: 'login' }, options === null || options === void 0 ? void 0 : options.additionalParams),
|
|
241
276
|
}), "f");
|
|
242
277
|
__classPrivateFieldGet(this, _AuthorizationManager_transport, "f").send();
|
|
243
278
|
}
|
|
@@ -245,9 +280,10 @@ export class AuthorizationManager {
|
|
|
245
280
|
* Process a well-formed `ConsentRequired` error response from a Globus service
|
|
246
281
|
* and redirect the user to the Globus Auth login page with the necessary parameters.
|
|
247
282
|
*/
|
|
248
|
-
handleConsentRequiredError(response) {
|
|
283
|
+
handleConsentRequiredError(response, options) {
|
|
249
284
|
__classPrivateFieldSet(this, _AuthorizationManager_transport, __classPrivateFieldGet(this, _AuthorizationManager_instances, "m", _AuthorizationManager_buildTransport).call(this, {
|
|
250
285
|
requested_scopes: __classPrivateFieldGet(this, _AuthorizationManager_instances, "m", _AuthorizationManager_withOfflineAccess).call(this, response.required_scopes.join(' ')),
|
|
286
|
+
params: Object.assign({}, options === null || options === void 0 ? void 0 : options.additionalParams),
|
|
251
287
|
}), "f");
|
|
252
288
|
__classPrivateFieldGet(this, _AuthorizationManager_transport, "f").send();
|
|
253
289
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"AuthorizationManager.js","sourceRoot":"","sources":["../../../../../src/lib/core/authorization/AuthorizationManager.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;AAAA
|
|
1
|
+
{"version":3,"file":"AuthorizationManager.js","sourceRoot":"","sources":["../../../../../src/lib/core/authorization/AuthorizationManager.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,YAAY,CAAC;AAIvC,OAAO,EACL,wBAAwB,EACxB,gBAAgB,EAChB,yBAAyB,EACzB,cAAc,EACd,MAAM,GACP,MAAM,8BAA8B,CAAC;AAEtC,OAAO,EAAE,aAAa,EAAE,UAAU,EAAE,MAAM,qBAAqB,CAAC;AAChE,OAAO,EAAE,GAAG,EAAE,MAAM,cAAc,CAAC;AAEnC,OAAO,EAAE,KAAK,EAAE,MAAM,YAAY,CAAC;AACnC,OAAO,EAGL,iBAAiB,GAClB,MAAM,wBAAwB,CAAC;AAChC,OAAO,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAC;AAE/C,OAAO,EACL,sBAAsB,EACtB,gCAAgC,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CAAC,aAAa,CAAC,MAAM,EACpC,sBAAsB,EAAE,wBAAwB,EAAE,EAClD,cAAc,EAAE,gBAAgB,EAAE,EAClC,YAAY,EAAE,IAAI,CAAC,aAAa,CAAC,QAAQ,EACzC,gBAAgB,EAAE,MAAM,IACrB,SAAS,EAMZ,CAAC;AACL,CAAC,iFAsKY,KAAY;IACvB,GAAG,CAAC,OAAO,EAAE,sDAAsD,KAAK,CAAC,eAAe,EAAE,CAAC,CAAC;IAC5F,OAAO,MAAM,CAAC,KAAK,CAAC,MAAM,CAAC;QACzB,OAAO,EAAE;YACP,SAAS,EAAE,IAAI,CAAC,aAAa,CAAC,MAAM;YACpC,KAAK,EAAE,KAAK,CAAC,YAAY;SAC1B;KACF,CAAC,CAAC;AACL,CAAC"}
|
|
@@ -7,14 +7,15 @@ export type GetTokenOptions = {
|
|
|
7
7
|
*/
|
|
8
8
|
shouldReplace?: boolean;
|
|
9
9
|
};
|
|
10
|
+
export type RedirectTransportOptions = IConfig & {
|
|
11
|
+
/**
|
|
12
|
+
* Additional parameters to be included in the query string of the authorization request.
|
|
13
|
+
*/
|
|
14
|
+
params?: IObject;
|
|
15
|
+
};
|
|
10
16
|
export declare class RedirectTransport {
|
|
11
17
|
#private;
|
|
12
|
-
constructor(options:
|
|
13
|
-
/**
|
|
14
|
-
* Additional parameters to be included in the query string of the authorization request.
|
|
15
|
-
*/
|
|
16
|
-
params?: IObject;
|
|
17
|
-
});
|
|
18
|
+
constructor(options: RedirectTransportOptions);
|
|
18
19
|
send(): void;
|
|
19
20
|
/**
|
|
20
21
|
* Parse the current URL for the authorization code (`?code=...`) and exchange it for an access token when available.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"RedirectTransport.d.ts","sourceRoot":"","sources":["../../../../../src/lib/core/authorization/RedirectTransport.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,OAAO,MAAM,sBAAsB,CAAC;AAChD,OAAO,KAAK,OAAO,MAAM,sBAAsB,CAAC;AAEhD,MAAM,MAAM,eAAe,GAAG;IAC5B;;;OAGG;IACH,aAAa,CAAC,EAAE,OAAO,CAAC;CACzB,CAAC;AAEF,
|
|
1
|
+
{"version":3,"file":"RedirectTransport.d.ts","sourceRoot":"","sources":["../../../../../src/lib/core/authorization/RedirectTransport.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,OAAO,MAAM,sBAAsB,CAAC;AAChD,OAAO,KAAK,OAAO,MAAM,sBAAsB,CAAC;AAEhD,MAAM,MAAM,eAAe,GAAG;IAC5B;;;OAGG;IACH,aAAa,CAAC,EAAE,OAAO,CAAC;CACzB,CAAC;AAEF,MAAM,MAAM,wBAAwB,GAAG,OAAO,GAAG;IAC/C;;OAEG;IACH,MAAM,CAAC,EAAE,OAAO,CAAC;CAClB,CAAC;AAEF,qBAAa,iBAAiB;;gBAKhB,OAAO,EAAE,wBAAwB;IAU7C,IAAI;IAIJ;;;OAGG;IACG,QAAQ,CAAC,OAAO,GAAE,eAAyC;CA+BlE"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"RedirectTransport.js","sourceRoot":"","sources":["../../../../../src/lib/core/authorization/RedirectTransport.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,OAAO,IAAI,MAAM,SAAS,CAAC;
|
|
1
|
+
{"version":3,"file":"RedirectTransport.js","sourceRoot":"","sources":["../../../../../src/lib/core/authorization/RedirectTransport.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,OAAO,IAAI,MAAM,SAAS,CAAC;AAmB3B,MAAM,OAAO,iBAAiB;IAK5B,YAAY,OAAiC;QAJ7C,0CAAY;QAEZ,oCAA8C,EAAE,EAAC;QAG/C,MAAM,EAAE,MAAM,KAAgB,OAAO,EAAlB,MAAM,UAAK,OAAO,EAA/B,UAAqB,CAAU,CAAC;QACtC,uBAAA,IAAI,2BAAS,IAAI,IAAI,mBAChB,MAAM,EACT,MAAA,CAAC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';
|
|
3
|
-
export * as tokens from './tokens.js';
|
|
4
1
|
/**
|
|
5
|
-
* @
|
|
2
|
+
* @module Authorization
|
|
3
|
+
* @description Provides modules for interacting with Globus-related authorization contexts in your application.
|
|
4
|
+
* @example
|
|
5
|
+
* import { authorization } from "globus/sdk";
|
|
6
|
+
* const manager = authorization.create(...);
|
|
6
7
|
*/
|
|
7
|
-
|
|
8
|
+
import { AuthorizationManager, type AuthorizationManagerConfiguration } from './AuthorizationManager.js';
|
|
8
9
|
/**
|
|
9
|
-
* Create an instance of the AuthorizationManager.
|
|
10
|
-
* @experimental
|
|
10
|
+
* Create an instance of the {@link AuthorizationManager}.
|
|
11
11
|
*/
|
|
12
12
|
export declare function create(configuration: AuthorizationManagerConfiguration): AuthorizationManager;
|
|
13
13
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/lib/core/authorization/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,oBAAoB,EACpB,KAAK,iCAAiC,EACvC,MAAM,2BAA2B,CAAC;AAEnC
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/lib/core/authorization/index.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AACH,OAAO,EACL,oBAAoB,EACpB,KAAK,iCAAiC,EACvC,MAAM,2BAA2B,CAAC;AAEnC;;GAEG;AACH,wBAAgB,MAAM,CAAC,aAAa,EAAE,iCAAiC,wBAEtE"}
|
|
@@ -1,13 +1,13 @@
|
|
|
1
|
-
import { AuthorizationManager, } from './AuthorizationManager.js';
|
|
2
|
-
import * as tokens from './tokens.js';
|
|
3
|
-
export * as tokens from './tokens.js';
|
|
4
1
|
/**
|
|
5
|
-
* @
|
|
2
|
+
* @module Authorization
|
|
3
|
+
* @description Provides modules for interacting with Globus-related authorization contexts in your application.
|
|
4
|
+
* @example
|
|
5
|
+
* import { authorization } from "globus/sdk";
|
|
6
|
+
* const manager = authorization.create(...);
|
|
6
7
|
*/
|
|
7
|
-
|
|
8
|
+
import { AuthorizationManager, } from './AuthorizationManager.js';
|
|
8
9
|
/**
|
|
9
|
-
* Create an instance of the AuthorizationManager.
|
|
10
|
-
* @experimental
|
|
10
|
+
* Create an instance of the {@link AuthorizationManager}.
|
|
11
11
|
*/
|
|
12
12
|
export function create(configuration) {
|
|
13
13
|
return new AuthorizationManager(configuration);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../src/lib/core/authorization/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,oBAAoB,GAErB,MAAM,2BAA2B,CAAC;AAEnC
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../src/lib/core/authorization/index.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AACH,OAAO,EACL,oBAAoB,GAErB,MAAM,2BAA2B,CAAC;AAEnC;;GAEG;AACH,MAAM,UAAU,MAAM,CAAC,aAAgD;IACrE,OAAO,IAAI,oBAAoB,CAAC,aAAa,CAAC,CAAC;AACjD,CAAC"}
|
package/esm/lib/core/errors.d.ts
CHANGED
|
@@ -1,3 +1,9 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @module Errors
|
|
3
|
+
* @example
|
|
4
|
+
* import { errors } from "globus/sdk";
|
|
5
|
+
* if (errors.isConsentRequiredError(...)) { ... }
|
|
6
|
+
*/
|
|
1
7
|
export declare class EnvironmentConfigurationError extends Error {
|
|
2
8
|
name: string;
|
|
3
9
|
constructor(variable: string, value: unknown);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"errors.d.ts","sourceRoot":"","sources":["../../../../src/lib/core/errors.ts"],"names":[],"mappings":"AAAA,qBAAa,6BAA8B,SAAQ,KAAK;IAC7C,IAAI,SAAmC;gBAEpC,QAAQ,EAAE,MAAM,EAAE,KAAK,EAAE,OAAO;CAK7C;AAED,MAAM,MAAM,eAA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6 +51,7 @@ export declare function getSDKOptions(options?: SDKOptions): {
|
|
|
51
51
|
};
|
|
52
52
|
};
|
|
53
53
|
environment?: "production" | "preview" | "staging" | "sandbox" | "integration" | "test" | undefined;
|
|
54
|
+
manager?: import("./authorization/AuthorizationManager.js").AuthorizationManager | undefined;
|
|
54
55
|
};
|
|
55
56
|
/**
|
|
56
57
|
* Handlers for: GLOBUS_SDK_VERIFY_SSL
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"global.d.ts","sourceRoot":"","sources":["../../../../src/lib/core/global.ts"],"names":[],"mappings":"AASA,OAAO,EAAE,UAAU,EAAE,MAAM,sBAAsB,CAAC;AAwBlD;;GAEG;AACH,eAAO,MAAM,YAAY;;;;;;;CAOf,CAAC;AAEX,MAAM,MAAM,WAAW,GAAG,CAAC,OAAO,YAAY,CAAC,CAAC,MAAM,OAAO,YAAY,CAAC,CAAC;AAE3E,wBAAgB,cAAc,IAAI,WAAW,CAM5C;AAED,eAAO,MAAM,QAAQ;;;;;;;;CAQpB,CAAC;AAEF,MAAM,MAAM,OAAO,GAAG,MAAM,OAAO,QAAQ,CAAC;AAE5C,eAAO,MAAM,aAAa,EAAE,MAAM,CAAC,OAAO,EAAE,OAAO,CAAC,MAAM,CAAC,WAAW,EAAE,MAAM,CAAC,CAAC,CAQ/E,CAAC;AAEF;;;;GAIG;AACH,wBAAgB,aAAa,CAAC,OAAO,CAAC,EAAE,UAAU
|
|
1
|
+
{"version":3,"file":"global.d.ts","sourceRoot":"","sources":["../../../../src/lib/core/global.ts"],"names":[],"mappings":"AASA,OAAO,EAAE,UAAU,EAAE,MAAM,sBAAsB,CAAC;AAwBlD;;GAEG;AACH,eAAO,MAAM,YAAY;;;;;;;CAOf,CAAC;AAEX,MAAM,MAAM,WAAW,GAAG,CAAC,OAAO,YAAY,CAAC,CAAC,MAAM,OAAO,YAAY,CAAC,CAAC;AAE3E,wBAAgB,cAAc,IAAI,WAAW,CAM5C;AAED,eAAO,MAAM,QAAQ;;;;;;;;CAQpB,CAAC;AAEF,MAAM,MAAM,OAAO,GAAG,MAAM,OAAO,QAAQ,CAAC;AAE5C,eAAO,MAAM,aAAa,EAAE,MAAM,CAAC,OAAO,EAAE,OAAO,CAAC,MAAM,CAAC,WAAW,EAAE,MAAM,CAAC,CAAC,CAQ/E,CAAC;AAEF;;;;GAIG;AACH,wBAAgB,aAAa,CAAC,OAAO,CAAC,EAAE,UAAU;;;;;;;;;;;;;;;;;;;;;;;;EAqBjD;AAED;;;;;;;;GAQG;AACH,wBAAgB,YAAY,IAAI,OAAO,CAQtC;AAED;;GAEG;AACH,wBAAgB,cAAc,kBAM7B;AAED,wBAAgB,cAAc,CAAC,OAAO,EAAE,OAAO,EAAE,WAAW,GAAE,WAA8B,sBAE3F;AAED,wBAAgB,iBAAiB,CAAC,OAAO,EAAE,OAAO,EAAE,WAAW,GAAE,WAA8B,sBAG9F"}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
export type Version = string;
|
|
2
|
+
/**
|
|
3
|
+
* The version of the `@globus/sdk` package that is in use.
|
|
4
|
+
*/
|
|
5
|
+
export declare const VERSION: Version;
|
|
6
|
+
export type Info = {
|
|
7
|
+
product: string;
|
|
8
|
+
version: Version;
|
|
9
|
+
};
|
|
10
|
+
/**
|
|
11
|
+
* The client information identifier for this package.
|
|
12
|
+
*/
|
|
13
|
+
export declare const CLIENT_INFO: Info;
|
|
14
|
+
/**
|
|
15
|
+
* Add a client information identifier to the existing SDK information.
|
|
16
|
+
*/
|
|
17
|
+
export declare function addClientInfo(info: Info): void;
|
|
18
|
+
/**
|
|
19
|
+
* Get the current client information as a string.
|
|
20
|
+
*/
|
|
21
|
+
export declare function getClientInfo(): string;
|
|
22
|
+
export declare function getClientInfoRequestHeaders(): Record<string, string>;
|
|
23
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/lib/core/info/index.ts"],"names":[],"mappings":"AAOA,MAAM,MAAM,OAAO,GAAG,MAAM,CAAC;AAE7B;;GAEG;AACH,eAAO,MAAM,OAAO,EAAE,OAAkB,CAAC;AAEzC,MAAM,MAAM,IAAI,GAAG;IACjB,OAAO,EAAE,MAAM,CAAC;IAChB,OAAO,EAAE,OAAO,CAAC;CAClB,CAAC;AAEF;;GAEG;AACH,eAAO,MAAM,WAAW,EAAE,IAGzB,CAAC;AAIF;;GAEG;AACH,wBAAgB,aAAa,CAAC,IAAI,EAAE,IAAI,QAEvC;AACD;;GAEG;AACH,wBAAgB,aAAa,IAAI,MAAM,CAEtC;AAED,wBAAgB,2BAA2B,IAAI,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAOpE"}
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* This module is mostly intended for internal use, but can be helpful
|
|
3
|
+
* identifying information about the SDK package you are using at runtime.
|
|
4
|
+
*/
|
|
5
|
+
import { toString, isEnabled, CLIENT_INFO_HEADER } from './private.js';
|
|
6
|
+
import { VERSION as _VERSION } from './version.js';
|
|
7
|
+
/**
|
|
8
|
+
* The version of the `@globus/sdk` package that is in use.
|
|
9
|
+
*/
|
|
10
|
+
export const VERSION = _VERSION;
|
|
11
|
+
/**
|
|
12
|
+
* The client information identifier for this package.
|
|
13
|
+
*/
|
|
14
|
+
export const CLIENT_INFO = {
|
|
15
|
+
product: 'javascript-sdk',
|
|
16
|
+
version: VERSION,
|
|
17
|
+
};
|
|
18
|
+
let INFOS = [CLIENT_INFO];
|
|
19
|
+
/**
|
|
20
|
+
* Add a client information identifier to the existing SDK information.
|
|
21
|
+
*/
|
|
22
|
+
export function addClientInfo(info) {
|
|
23
|
+
INFOS = INFOS.concat(info);
|
|
24
|
+
}
|
|
25
|
+
/**
|
|
26
|
+
* Get the current client information as a string.
|
|
27
|
+
*/
|
|
28
|
+
export function getClientInfo() {
|
|
29
|
+
return toString(INFOS);
|
|
30
|
+
}
|
|
31
|
+
export function getClientInfoRequestHeaders() {
|
|
32
|
+
if (!isEnabled()) {
|
|
33
|
+
return {};
|
|
34
|
+
}
|
|
35
|
+
return {
|
|
36
|
+
[CLIENT_INFO_HEADER]: getClientInfo(),
|
|
37
|
+
};
|
|
38
|
+
}
|
|
39
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../src/lib/core/info/index.ts"],"names":[],"mappings":"AAAA;;;GAGG;AACH,OAAO,EAAE,QAAQ,EAAE,SAAS,EAAE,kBAAkB,EAAE,MAAM,cAAc,CAAC;AACvE,OAAO,EAAE,OAAO,IAAI,QAAQ,EAAE,MAAM,cAAc,CAAC;AAInD;;GAEG;AACH,MAAM,CAAC,MAAM,OAAO,GAAY,QAAQ,CAAC;AAOzC;;GAEG;AACH,MAAM,CAAC,MAAM,WAAW,GAAS;IAC/B,OAAO,EAAE,gBAAgB;IACzB,OAAO,EAAE,OAAO;CACjB,CAAC;AAEF,IAAI,KAAK,GAAW,CAAC,WAAW,CAAC,CAAC;AAElC;;GAEG;AACH,MAAM,UAAU,aAAa,CAAC,IAAU;IACtC,KAAK,GAAG,KAAK,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC;AAC7B,CAAC;AACD;;GAEG;AACH,MAAM,UAAU,aAAa;IAC3B,OAAO,QAAQ,CAAC,KAAK,CAAC,CAAC;AACzB,CAAC;AAED,MAAM,UAAU,2BAA2B;IACzC,IAAI,CAAC,SAAS,EAAE,EAAE,CAAC;QACjB,OAAO,EAAE,CAAC;IACZ,CAAC;IACD,OAAO;QACL,CAAC,kBAAkB,CAAC,EAAE,aAAa,EAAE;KACtC,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import type { Info } from './index.js';
|
|
2
|
+
/**
|
|
3
|
+
* @private
|
|
4
|
+
*/
|
|
5
|
+
export declare const CLIENT_INFO_HEADER = "X-Globus-ClientInfo";
|
|
6
|
+
/**
|
|
7
|
+
* Disable the client information header from being included in requests (enabled by default).
|
|
8
|
+
* @private
|
|
9
|
+
*/
|
|
10
|
+
export declare function disable(): void;
|
|
11
|
+
/**
|
|
12
|
+
* Enables the client information header to be included in requests.
|
|
13
|
+
* @private
|
|
14
|
+
*/
|
|
15
|
+
export declare function enable(): void;
|
|
16
|
+
/**
|
|
17
|
+
* Whether or not the client information header should be sent with requests.
|
|
18
|
+
* @private
|
|
19
|
+
*/
|
|
20
|
+
export declare function isEnabled(): boolean;
|
|
21
|
+
/**
|
|
22
|
+
* Exported for test purposes only.
|
|
23
|
+
* @private
|
|
24
|
+
*/
|
|
25
|
+
export declare function toString(info: Info | Info[]): string;
|
|
26
|
+
//# sourceMappingURL=private.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"private.d.ts","sourceRoot":"","sources":["../../../../../src/lib/core/info/private.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,YAAY,CAAC;AAEvC;;GAEG;AACH,eAAO,MAAM,kBAAkB,wBAAwB,CAAC;AAGxD;;;GAGG;AACH,wBAAgB,OAAO,SAEtB;AAED;;;GAGG;AACH,wBAAgB,MAAM,SAErB;AAED;;;GAGG;AACH,wBAAgB,SAAS,YAExB;AAKD;;;GAGG;AACH,wBAAgB,QAAQ,CAAC,IAAI,EAAE,IAAI,GAAG,IAAI,EAAE,UAS3C"}
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @private
|
|
3
|
+
*/
|
|
4
|
+
export const CLIENT_INFO_HEADER = `X-Globus-ClientInfo`;
|
|
5
|
+
let ENABLED = true;
|
|
6
|
+
/**
|
|
7
|
+
* Disable the client information header from being included in requests (enabled by default).
|
|
8
|
+
* @private
|
|
9
|
+
*/
|
|
10
|
+
export function disable() {
|
|
11
|
+
ENABLED = false;
|
|
12
|
+
}
|
|
13
|
+
/**
|
|
14
|
+
* Enables the client information header to be included in requests.
|
|
15
|
+
* @private
|
|
16
|
+
*/
|
|
17
|
+
export function enable() {
|
|
18
|
+
ENABLED = true;
|
|
19
|
+
}
|
|
20
|
+
/**
|
|
21
|
+
* Whether or not the client information header should be sent with requests.
|
|
22
|
+
* @private
|
|
23
|
+
*/
|
|
24
|
+
export function isEnabled() {
|
|
25
|
+
return ENABLED;
|
|
26
|
+
}
|
|
27
|
+
const INFOS_SEPERATOR = ';';
|
|
28
|
+
const INFO_ITEM_SEPARATOR = ',';
|
|
29
|
+
/**
|
|
30
|
+
* Exported for test purposes only.
|
|
31
|
+
* @private
|
|
32
|
+
*/
|
|
33
|
+
export function toString(info) {
|
|
34
|
+
const infos = Array.isArray(info) ? info : [info];
|
|
35
|
+
return infos
|
|
36
|
+
.map((i) => Object.entries(i)
|
|
37
|
+
.map(([key, value]) => `${key}=${value}`)
|
|
38
|
+
.join(INFO_ITEM_SEPARATOR))
|
|
39
|
+
.join(INFOS_SEPERATOR);
|
|
40
|
+
}
|
|
41
|
+
//# sourceMappingURL=private.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"private.js","sourceRoot":"","sources":["../../../../../src/lib/core/info/private.ts"],"names":[],"mappings":"AAEA;;GAEG;AACH,MAAM,CAAC,MAAM,kBAAkB,GAAG,qBAAqB,CAAC;AAExD,IAAI,OAAO,GAAG,IAAI,CAAC;AACnB;;;GAGG;AACH,MAAM,UAAU,OAAO;IACrB,OAAO,GAAG,KAAK,CAAC;AAClB,CAAC;AAED;;;GAGG;AACH,MAAM,UAAU,MAAM;IACpB,OAAO,GAAG,IAAI,CAAC;AACjB,CAAC;AAED;;;GAGG;AACH,MAAM,UAAU,SAAS;IACvB,OAAO,OAAO,CAAC;AACjB,CAAC;AAED,MAAM,eAAe,GAAG,GAAG,CAAC;AAC5B,MAAM,mBAAmB,GAAG,GAAG,CAAC;AAEhC;;;GAGG;AACH,MAAM,UAAU,QAAQ,CAAC,IAAmB;IAC1C,MAAM,KAAK,GAAG,KAAK,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC;IAClD,OAAO,KAAK;SACT,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CACT,MAAM,CAAC,OAAO,CAAC,CAAC,CAAC;SACd,GAAG,CAAC,CAAC,CAAC,GAAG,EAAE,KAAK,CAAC,EAAE,EAAE,CAAC,GAAG,GAAG,IAAI,KAAK,EAAE,CAAC;SACxC,IAAI,CAAC,mBAAmB,CAAC,CAC7B;SACA,IAAI,CAAC,eAAe,CAAC,CAAC;AAC3B,CAAC"}
|