@globus/sdk 3.3.1 → 3.4.1
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/core/authorization/AuthorizationManager.d.ts +25 -10
- package/cjs/lib/core/authorization/AuthorizationManager.d.ts.map +1 -1
- package/cjs/lib/core/authorization/AuthorizationManager.js +22 -19
- 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/errors.d.ts +17 -4
- package/cjs/lib/core/errors.d.ts.map +1 -1
- package/cjs/lib/core/errors.js +30 -7
- package/cjs/lib/core/errors.js.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/auth/index.d.ts +13 -0
- package/cjs/lib/services/auth/index.d.ts.map +1 -1
- package/cjs/lib/services/auth/index.js.map +1 -1
- 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.map +1 -1
- package/cjs/lib/services/shared.js +2 -1
- package/cjs/lib/services/shared.js.map +1 -1
- package/cjs/lib/services/transfer/service/endpoint-manager/task.d.ts +1 -1
- package/cjs/lib/services/transfer/service/endpoint-manager/task.d.ts.map +1 -1
- package/cjs/package.json +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/core/authorization/AuthorizationManager.d.ts +25 -10
- package/esm/lib/core/authorization/AuthorizationManager.d.ts.map +1 -1
- package/esm/lib/core/authorization/AuthorizationManager.js +24 -21
- 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/errors.d.ts +17 -4
- package/esm/lib/core/errors.d.ts.map +1 -1
- package/esm/lib/core/errors.js +28 -6
- package/esm/lib/core/errors.js.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/auth/index.d.ts +13 -0
- package/esm/lib/services/auth/index.d.ts.map +1 -1
- package/esm/lib/services/auth/index.js.map +1 -1
- 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.map +1 -1
- package/esm/lib/services/shared.js +2 -1
- package/esm/lib/services/shared.js.map +1 -1
- package/esm/lib/services/transfer/service/endpoint-manager/task.d.ts +1 -1
- package/esm/lib/services/transfer/service/endpoint-manager/task.d.ts.map +1 -1
- package/package.json +1 -1
- package/umd/globus.production.js +1 -1
package/README.md
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
The Globus SDK for JavaScript provides first class TypeScript support and makes it easy to call Globus services using idiomatic JavaScript APIs to build Node.js and web applications.
|
|
4
4
|
|
|
5
5
|
- [@globus/sdk API Documentation](https://globus.github.io/globus-sdk-javascript/)
|
|
6
|
-
- [Examples](
|
|
6
|
+
- [Examples](https://github.com/globus/globus-sdk-javascript/blob/main/examples/README.md)
|
|
7
7
|
|
|
8
8
|
## Installation
|
|
9
9
|
|
package/cjs/index.d.ts
CHANGED
package/cjs/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAoDG;AAOH;;GAEG;
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAoDG;AAOH;;GAEG;AACH,OAAO,KAAK,IAAI,MAAM,0BAA0B,CAAC;AACjD,OAAO,KAAK,MAAM,MAAM,sBAAsB,CAAC;AAC/C,OAAO,KAAK,aAAa,MAAM,mCAAmC,CAAC;AACnE,OAAO,KAAK,MAAM,MAAM,sBAAsB,CAAC;AAE/C;;GAEG;AAEH,OAAO,KAAK,IAAI,MAAM,8BAA8B,CAAC;AACrD,OAAO,KAAK,QAAQ,MAAM,kCAAkC,CAAC;AAC7D,OAAO,KAAK,MAAM,MAAM,gCAAgC,CAAC;AACzD,OAAO,KAAK,MAAM,MAAM,gCAAgC,CAAC;AACzD,OAAO,KAAK,KAAK,MAAM,+BAA+B,CAAC;AACvD,OAAO,KAAK,GAAG,MAAM,+CAA+C,CAAC;AACrE,OAAO,KAAK,KAAK,MAAM,+BAA+B,CAAC;AACvD,OAAO,KAAK,OAAO,MAAM,iCAAiC,CAAC;AAE3D;;GAEG;AAEH,OAAO,KAAK,MAAM,MAAM,mBAAmB,CAAC"}
|
package/cjs/index.js
CHANGED
|
@@ -76,7 +76,7 @@ var __importStar = (this && this.__importStar) || function (mod) {
|
|
|
76
76
|
return result;
|
|
77
77
|
};
|
|
78
78
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
79
|
-
exports.webapp = exports.compute = exports.timer = exports.gcs = exports.flows = exports.groups = exports.search = exports.transfer = exports.auth = exports.errors = exports.authorization = exports.logger = void 0;
|
|
79
|
+
exports.webapp = exports.compute = exports.timer = exports.gcs = exports.flows = exports.groups = exports.search = exports.transfer = exports.auth = exports.errors = exports.authorization = exports.logger = exports.info = void 0;
|
|
80
80
|
/// <reference types="@globus/types" />
|
|
81
81
|
/// <reference types="@globus/types/auth" />
|
|
82
82
|
/// <reference types="@globus/types/transfer" />
|
|
@@ -84,6 +84,7 @@ exports.webapp = exports.compute = exports.timer = exports.gcs = exports.flows =
|
|
|
84
84
|
/**
|
|
85
85
|
* Core
|
|
86
86
|
*/
|
|
87
|
+
exports.info = __importStar(require("./lib/core/info/index.js"));
|
|
87
88
|
exports.logger = __importStar(require("./lib/core/logger.js"));
|
|
88
89
|
exports.authorization = __importStar(require("./lib/core/authorization/index.js"));
|
|
89
90
|
exports.errors = __importStar(require("./lib/core/errors.js"));
|
package/cjs/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAoDG;;;;;;;;;;;;;;;;;;;;;;;;;;AAEH,uCAAuC;AACvC,4CAA4C;AAC5C,gDAAgD;AAChD,8CAA8C;AAE9C;;GAEG;
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAoDG;;;;;;;;;;;;;;;;;;;;;;;;;;AAEH,uCAAuC;AACvC,4CAA4C;AAC5C,gDAAgD;AAChD,8CAA8C;AAE9C;;GAEG;AACH,iEAAiD;AACjD,+DAA+C;AAC/C,mFAAmE;AACnE,+DAA+C;AAE/C;;GAEG;AAEH,qEAAqD;AACrD,6EAA6D;AAC7D,yEAAyD;AACzD,yEAAyD;AACzD,uEAAuD;AACvD,qFAAqE;AACrE,uEAAuD;AACvD,2EAA2D;AAE3D;;GAEG;AAEH,4DAA4C"}
|
|
@@ -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';
|
|
@@ -43,7 +43,7 @@ export type AuthorizationManagerConfiguration = {
|
|
|
43
43
|
*
|
|
44
44
|
* const manager = authorization.create({
|
|
45
45
|
* // Your registered Globus Application client ID.
|
|
46
|
-
*
|
|
46
|
+
* client: '...',
|
|
47
47
|
* // The redirect URL for your application; Where you will call `manager.handleCodeRedirect()`
|
|
48
48
|
* redirect: 'https://example.com/callback',
|
|
49
49
|
* // Known scopes required by your application.
|
|
@@ -124,32 +124,47 @@ export declare class AuthorizationManager {
|
|
|
124
124
|
/**
|
|
125
125
|
* Initiate the login process by redirecting to the Globus Auth login page.
|
|
126
126
|
*/
|
|
127
|
-
login(
|
|
127
|
+
login(options?: {
|
|
128
|
+
additionalParams: {};
|
|
129
|
+
}): void;
|
|
128
130
|
/**
|
|
129
131
|
* This method will attempt to complete the PKCE protocol flow.
|
|
130
132
|
*/
|
|
131
133
|
handleCodeRedirect(options?: {
|
|
132
134
|
shouldReplace: GetTokenOptions['shouldReplace'];
|
|
135
|
+
additionalParams?: RedirectTransportOptions['params'];
|
|
133
136
|
}): Promise<void>;
|
|
134
137
|
/**
|
|
135
138
|
* Handle an error response from a Globus service in the context of this `AuthorizationManager`.
|
|
136
139
|
* This method will introspect the response and attempt to handle any errors that should result
|
|
137
140
|
* in some additional Globus Auth interaction.
|
|
138
|
-
* @param response
|
|
139
|
-
* @param
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
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.
|
|
145
|
+
*/
|
|
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;
|
|
143
154
|
/**
|
|
144
155
|
* Process a well-formed Authorization Requirements error response from a Globus service
|
|
145
156
|
* and redirect the user to the Globus Auth login page with the necessary parameters.
|
|
146
157
|
*/
|
|
147
|
-
handleAuthorizationRequirementsError(response: AuthorizationRequirementsError
|
|
158
|
+
handleAuthorizationRequirementsError(response: AuthorizationRequirementsError, options?: {
|
|
159
|
+
additionalParams?: RedirectTransportOptions['params'];
|
|
160
|
+
}): void;
|
|
148
161
|
/**
|
|
149
162
|
* Process a well-formed `ConsentRequired` error response from a Globus service
|
|
150
163
|
* and redirect the user to the Globus Auth login page with the necessary parameters.
|
|
151
164
|
*/
|
|
152
|
-
handleConsentRequiredError(response: ConsentRequiredError
|
|
165
|
+
handleConsentRequiredError(response: ConsentRequiredError, options?: {
|
|
166
|
+
additionalParams?: RedirectTransportOptions['params'];
|
|
167
|
+
}): void;
|
|
153
168
|
/**
|
|
154
169
|
* Add a Globus Auth token response to storage, if `other_tokens` are present they are also added.
|
|
155
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":"AAEA,OAAO,KAAK,OAAO,MAAM,sBAAsB,CAAC;AAahD,OAAO,EAAE,KAAK,EAAE,MAAM,YAAY,CAAC;AACnC,OAAO,
|
|
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,EAErB,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,aAAa,CAAC,EAAE,MAAM,GAAG,KAAK,CAAC;CAChC,CAAC;AAYF;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA8BG;AACH,qBAAa,oBAAoB;;IAG/B,aAAa,EAAE,iCAAiC,CAAC;IAIjD;;;OAGG;IACH,IAAI,aAAa,IAOQ,OAAO,CAL/B;IAED;;OAEG;IACH,IAAI,aAAa,CAAC,KAAK,EAAE,OAAO,EAG/B;IAED,MAAM,EAAE,WAAW,CAAC;IAEpB,MAAM;QACJ;;;;;;WAMG;;YAIC;;;eAGG;6BACc,OAAO;;;QAI5B;;;WAGG;;MAEH;gBA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E;;;;OAIG;IACH,gBAAgB,UAAW,KAAK,GAAG,aAAa,UAM9C;IAEF;;;;OAIG;IACG,MAAM;CAoBb"}
|
|
@@ -34,6 +34,10 @@ const DEFAULT_CONFIGURATION = {
|
|
|
34
34
|
useRefreshTokens: false,
|
|
35
35
|
defaultScopes: 'openid profile email',
|
|
36
36
|
};
|
|
37
|
+
const DEFAULT_HANDLE_ERROR_OPTIONS = {
|
|
38
|
+
execute: true,
|
|
39
|
+
additionalParams: undefined,
|
|
40
|
+
};
|
|
37
41
|
/**
|
|
38
42
|
* Provides management of Globus authorization context for your application.
|
|
39
43
|
* - Handles the OAuth protcol flow (via PKCE)
|
|
@@ -58,7 +62,7 @@ const DEFAULT_CONFIGURATION = {
|
|
|
58
62
|
*
|
|
59
63
|
* const manager = authorization.create({
|
|
60
64
|
* // Your registered Globus Application client ID.
|
|
61
|
-
*
|
|
65
|
+
* client: '...',
|
|
62
66
|
* // The redirect URL for your application; Where you will call `manager.handleCodeRedirect()`
|
|
63
67
|
* redirect: 'https://example.com/callback',
|
|
64
68
|
* // Known scopes required by your application.
|
|
@@ -220,22 +224,22 @@ class AuthorizationManager {
|
|
|
220
224
|
/**
|
|
221
225
|
* Initiate the login process by redirecting to the Globus Auth login page.
|
|
222
226
|
*/
|
|
223
|
-
login() {
|
|
227
|
+
login(options = { additionalParams: {} }) {
|
|
224
228
|
(0, logger_js_1.log)('debug', 'AuthorizationManager.login');
|
|
225
229
|
this.reset();
|
|
226
230
|
/**
|
|
227
231
|
* In the future, it's possible that we may want to support different types of transports.
|
|
228
232
|
*/
|
|
229
|
-
const transport = __classPrivateFieldGet(this, _AuthorizationManager_instances, "m", _AuthorizationManager_buildTransport).call(this);
|
|
233
|
+
const transport = __classPrivateFieldGet(this, _AuthorizationManager_instances, "m", _AuthorizationManager_buildTransport).call(this, { params: options === null || options === void 0 ? void 0 : options.additionalParams });
|
|
230
234
|
transport.send();
|
|
231
235
|
}
|
|
232
236
|
/**
|
|
233
237
|
* This method will attempt to complete the PKCE protocol flow.
|
|
234
238
|
*/
|
|
235
239
|
handleCodeRedirect() {
|
|
236
|
-
return __awaiter(this, arguments, void 0, function* (options = { shouldReplace: true }) {
|
|
240
|
+
return __awaiter(this, arguments, void 0, function* (options = { shouldReplace: true, additionalParams: {} }) {
|
|
237
241
|
(0, logger_js_1.log)('debug', 'AuthorizationManager.handleCodeRedirect');
|
|
238
|
-
const response = yield __classPrivateFieldGet(this, _AuthorizationManager_instances, "m", _AuthorizationManager_buildTransport).call(this).getToken({
|
|
242
|
+
const response = yield __classPrivateFieldGet(this, _AuthorizationManager_instances, "m", _AuthorizationManager_buildTransport).call(this, { params: options === null || options === void 0 ? void 0 : options.additionalParams }).getToken({
|
|
239
243
|
shouldReplace: options === null || options === void 0 ? void 0 : options.shouldReplace,
|
|
240
244
|
});
|
|
241
245
|
if ((0, index_js_1.isGlobusAuthTokenResponse)(response)) {
|
|
@@ -244,36 +248,34 @@ class AuthorizationManager {
|
|
|
244
248
|
}
|
|
245
249
|
});
|
|
246
250
|
}
|
|
247
|
-
handleErrorResponse(response,
|
|
248
|
-
|
|
251
|
+
handleErrorResponse(response, options) {
|
|
252
|
+
const opts = typeof options === 'boolean'
|
|
253
|
+
? Object.assign(Object.assign({}, DEFAULT_HANDLE_ERROR_OPTIONS), { execute: options }) : Object.assign(Object.assign({}, DEFAULT_HANDLE_ERROR_OPTIONS), options);
|
|
254
|
+
(0, logger_js_1.log)('debug', `AuthorizationManager.handleErrorResponse | response=${JSON.stringify(response)} execute=${opts.execute}`);
|
|
249
255
|
let handler = () => { };
|
|
250
256
|
if ((0, errors_js_1.isAuthorizationRequirementsError)(response)) {
|
|
251
257
|
(0, logger_js_1.log)('debug', 'AuthorizationManager.handleErrorResponse | error=AuthorizationRequirementsError');
|
|
252
|
-
handler = () => this.handleAuthorizationRequirementsError(response
|
|
258
|
+
handler = () => this.handleAuthorizationRequirementsError(response, {
|
|
259
|
+
additionalParams: opts.additionalParams,
|
|
260
|
+
});
|
|
253
261
|
}
|
|
254
262
|
if ((0, errors_js_1.isConsentRequiredError)(response)) {
|
|
255
263
|
(0, logger_js_1.log)('debug', 'AuthorizationManager.handleErrorResponse | error=ConsentRequiredError');
|
|
256
|
-
handler = () => this.handleConsentRequiredError(response);
|
|
264
|
+
handler = () => this.handleConsentRequiredError(response, { additionalParams: opts.additionalParams });
|
|
257
265
|
}
|
|
258
266
|
if ('code' in response && response['code'] === 'AuthenticationFailed') {
|
|
259
267
|
(0, logger_js_1.log)('debug', 'AuthorizationManager.handleErrorResponse | error=AuthenticationFailed');
|
|
260
268
|
handler = () => this.revoke();
|
|
261
269
|
}
|
|
262
|
-
return execute === true ? handler() : handler;
|
|
270
|
+
return opts.execute === true ? handler() : handler;
|
|
263
271
|
}
|
|
264
272
|
/**
|
|
265
273
|
* Process a well-formed Authorization Requirements error response from a Globus service
|
|
266
274
|
* and redirect the user to the Globus Auth login page with the necessary parameters.
|
|
267
275
|
*/
|
|
268
|
-
handleAuthorizationRequirementsError(response) {
|
|
276
|
+
handleAuthorizationRequirementsError(response, options) {
|
|
269
277
|
__classPrivateFieldSet(this, _AuthorizationManager_transport, __classPrivateFieldGet(this, _AuthorizationManager_instances, "m", _AuthorizationManager_buildTransport).call(this, {
|
|
270
|
-
params: {
|
|
271
|
-
session_message: response.authorization_parameters.session_message,
|
|
272
|
-
session_required_identities: response.authorization_parameters.session_required_identities.join(','),
|
|
273
|
-
session_required_mfa: response.authorization_parameters.session_required_mfa,
|
|
274
|
-
session_required_single_domain: response.authorization_parameters.session_required_single_domain.join(','),
|
|
275
|
-
prompt: 'login',
|
|
276
|
-
},
|
|
278
|
+
params: Object.assign(Object.assign({ prompt: 'login' }, (0, errors_js_1.toAuthorizationQueryParams)(response)), options === null || options === void 0 ? void 0 : options.additionalParams),
|
|
277
279
|
}), "f");
|
|
278
280
|
__classPrivateFieldGet(this, _AuthorizationManager_transport, "f").send();
|
|
279
281
|
}
|
|
@@ -281,9 +283,10 @@ class AuthorizationManager {
|
|
|
281
283
|
* Process a well-formed `ConsentRequired` error response from a Globus service
|
|
282
284
|
* and redirect the user to the Globus Auth login page with the necessary parameters.
|
|
283
285
|
*/
|
|
284
|
-
handleConsentRequiredError(response) {
|
|
286
|
+
handleConsentRequiredError(response, options) {
|
|
285
287
|
__classPrivateFieldSet(this, _AuthorizationManager_transport, __classPrivateFieldGet(this, _AuthorizationManager_instances, "m", _AuthorizationManager_buildTransport).call(this, {
|
|
286
288
|
requested_scopes: __classPrivateFieldGet(this, _AuthorizationManager_instances, "m", _AuthorizationManager_withOfflineAccess).call(this, response.required_scopes.join(' ')),
|
|
289
|
+
params: Object.assign({}, options === null || options === void 0 ? void 0 : options.additionalParams),
|
|
287
290
|
}), "f");
|
|
288
291
|
__classPrivateFieldGet(this, _AuthorizationManager_transport, "f").send();
|
|
289
292
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"AuthorizationManager.js","sourceRoot":"","sources":["../../../../../src/lib/core/authorization/AuthorizationManager.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;AAAA,2CAAuC;AAIvC,2DAMsC;AAEtC,kDAAgE;AAChE,4CAAmC;AAEnC,yCAAmC;AACnC,
|
|
1
|
+
{"version":3,"file":"AuthorizationManager.js","sourceRoot":"","sources":["../../../../../src/lib/core/authorization/AuthorizationManager.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;AAAA,2CAAuC;AAIvC,2DAMsC;AAEtC,kDAAgE;AAChE,4CAAmC;AAEnC,yCAAmC;AACnC,iEAIgC;AAChC,qDAA+C;AAE/C,4CAMsB;AAyBtB,MAAM,qBAAqB,GAAG;IAC5B,gBAAgB,EAAE,KAAK;IACvB,aAAa,EAAE,sBAAsB;CACtC,CAAC;AAEF,MAAM,4BAA4B,GAAG;IACnC,OAAO,EAAE,IAAI;IACb,gBAAgB,EAAE,SAAS;CAC5B,CAAC;AAEF;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA8BG;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M,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,sDAA2B;
|
|
1
|
+
{"version":3,"file":"RedirectTransport.js","sourceRoot":"","sources":["../../../../../src/lib/core/authorization/RedirectTransport.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,sDAA2B;AAmB3B,MAAa,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,iBAAI,mBAChB,MAAM,EACT,MAAA,CAAC;QACH,uBAAA,IAAI,+CACC,MAAM,OACV,CAAC;IACJ,CAAC;IAED,IAAI;QACF,MAAM,CAAC,QAAQ,CAAC,OAAO,CAAC,uBAAA,IAAI,+BAAM,CAAC,YAAY,CAAC,uBAAA,IAAI,iCAAQ,CAAC,CAAC,CAAC;IACjE,CAAC;IAED;;;OAGG;IACG,QAAQ;6DAAC,UAA2B,EAAE,aAAa,EAAE,IAAI,EAAE;YAC/D,MAAM,GAAG,GAAG,IAAI,GAAG,CAAC,MAAM,CAAC,QAAQ,CAAC,IAAI,CAAC,CAAC;YAC1C,MAAM,MAAM,GAAG,IAAI,eAAe,CAAC,GAAG,CAAC,MAAM,CAAC,CAAC;YAC/C;;eAEG;YACH,IAAI,CAAC,MAAM,CAAC,GAAG,CAAC,MAAM,CAAC;gBAAE,OAAO,SAAS,CAAC;YAC1C,MAAM,QAAQ,GAAG,MAAM,uBAAA,IAAI,+BAAM,CAAC,sBAAsB,CAAC,GAAG,CAAC,QAAQ,EAAE,CAAC,CAAC;YACzE;;;eAGG;YACH,cAAc,CAAC,UAAU,CAAC,YAAY,CAAC,CAAC;YACxC,cAAc,CAAC,UAAU,CAAC,oBAAoB,CAAC,CAAC;YAChD,IAAI,OAAO,CAAC,aAAa,EAAE,CAAC;gBAC1B;;mBAEG;gBACH,MAAM,CAAC,MAAM,CAAC,MAAM,CAAC,CAAC;gBACtB,MAAM,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC;gBACvB;;mBAEG;gBACH,GAAG,CAAC,MAAM,GAAG,MAAM,CAAC,QAAQ,EAAE,CAAC;gBAC/B;;mBAEG;gBACH,MAAM,CAAC,QAAQ,CAAC,OAAO,CAAC,GAAG,CAAC,CAAC;YAC/B,CAAC;YACD,OAAO,QAAQ,CAAC;QAClB,CAAC;KAAA;CACF;AAtDD,8CAsDC"}
|
package/cjs/lib/core/errors.d.ts
CHANGED
|
@@ -4,6 +4,7 @@
|
|
|
4
4
|
* import { errors } from "globus/sdk";
|
|
5
5
|
* if (errors.isConsentRequiredError(...)) { ... }
|
|
6
6
|
*/
|
|
7
|
+
import type { AuthorizationQueryParameters } from '../services/auth/index.js';
|
|
7
8
|
export declare class EnvironmentConfigurationError extends Error {
|
|
8
9
|
name: string;
|
|
9
10
|
constructor(variable: string, value: unknown);
|
|
@@ -19,14 +20,26 @@ export type ConsentRequiredError = {
|
|
|
19
20
|
[key: string]: unknown;
|
|
20
21
|
};
|
|
21
22
|
export declare function isConsentRequiredError(test: unknown): test is ConsentRequiredError;
|
|
23
|
+
/**
|
|
24
|
+
* An error that includes an `authorization_parameters` property, a.k.a "G.A.R.E".
|
|
25
|
+
*
|
|
26
|
+
* A well-known error shape is provided by services when additional authorization requirements must be met by the session.
|
|
27
|
+
* This object can be converted to parameters accepted by Globus Auth using `sdk.errors.toAuthorizationQueryParams()`.
|
|
28
|
+
*/
|
|
22
29
|
export type AuthorizationRequirementsError = {
|
|
23
30
|
authorization_parameters: {
|
|
24
|
-
session_message
|
|
25
|
-
session_required_identities
|
|
26
|
-
session_required_mfa
|
|
27
|
-
session_required_single_domain
|
|
31
|
+
session_message?: string;
|
|
32
|
+
session_required_identities?: string[];
|
|
33
|
+
session_required_mfa?: boolean;
|
|
34
|
+
session_required_single_domain?: string[];
|
|
35
|
+
prompt?: string;
|
|
36
|
+
required_scopes?: string[];
|
|
28
37
|
};
|
|
29
38
|
[key: string]: unknown;
|
|
30
39
|
};
|
|
40
|
+
/**
|
|
41
|
+
* Convert an `AuthorizationRequirementsError` to a query string object accepted by Globus Auth.
|
|
42
|
+
*/
|
|
43
|
+
export declare function toAuthorizationQueryParams(error: AuthorizationRequirementsError): AuthorizationQueryParameters;
|
|
31
44
|
export declare function isAuthorizationRequirementsError(test: unknown): test is AuthorizationRequirementsError;
|
|
32
45
|
//# sourceMappingURL=errors.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"errors.d.ts","sourceRoot":"","sources":["../../../../src/lib/core/errors.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;
|
|
1
|
+
{"version":3,"file":"errors.d.ts","sourceRoot":"","sources":["../../../../src/lib/core/errors.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AACH,OAAO,KAAK,EAAE,4BAA4B,EAAE,MAAM,2BAA2B,CAAC;AAE9E,qBAAa,6BAA8B,SAAQ,KAAK;IAC7C,IAAI,SAAmC;gBAEpC,QAAQ,EAAE,MAAM,EAAE,KAAK,EAAE,OAAO;CAK7C;AAED,MAAM,MAAM,eAAe,GAAG;IAC5B,IAAI,EAAE,MAAM,CAAC;IACb,OAAO,EAAE,MAAM,CAAC;CACjB,CAAC;AAEF,wBAAgB,iBAAiB,CAAC,IAAI,EAAE,OAAO,GAAG,IAAI,IAAI,eAAe,CAExE;AAED,MAAM,MAAM,oBAAoB,GAAG;IACjC,IAAI,EAAE,iBAAiB,CAAC;IACxB,eAAe,EAAE,MAAM,EAAE,CAAC;IAC1B,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC;CACxB,CAAC;AAEF,wBAAgB,sBAAsB,CAAC,IAAI,EAAE,OAAO,GAAG,IAAI,IAAI,oBAAoB,CAOlF;AAED;;;;;GAKG;AACH,MAAM,MAAM,8BAA8B,GAAG;IAC3C,wBAAwB,EAAE;QACxB,eAAe,CAAC,EAAE,MAAM,CAAC;QACzB,2BAA2B,CAAC,EAAE,MAAM,EAAE,CAAC;QACvC,oBAAoB,CAAC,EAAE,OAAO,CAAC;QAC/B,8BAA8B,CAAC,EAAE,MAAM,EAAE,CAAC;QAC1C,MAAM,CAAC,EAAE,MAAM,CAAC;QAChB,eAAe,CAAC,EAAE,MAAM,EAAE,CAAC;KAC5B,CAAC;IACF,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC;CACxB,CAAC;AAKF;;GAEG;AACH,wBAAgB,0BAA0B,CACxC,KAAK,EAAE,8BAA8B,GACpC,4BAA4B,CAmB9B;AAED,wBAAgB,gCAAgC,CAC9C,IAAI,EAAE,OAAO,GACZ,IAAI,IAAI,8BAA8B,CAOxC"}
|
package/cjs/lib/core/errors.js
CHANGED
|
@@ -1,12 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
/**
|
|
3
|
-
* @module Errors
|
|
4
|
-
* @example
|
|
5
|
-
* import { errors } from "globus/sdk";
|
|
6
|
-
* if (errors.isConsentRequiredError(...)) { ... }
|
|
7
|
-
*/
|
|
8
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
9
|
-
exports.isAuthorizationRequirementsError = exports.isConsentRequiredError = exports.isErrorWellFormed = exports.EnvironmentConfigurationError = void 0;
|
|
3
|
+
exports.isAuthorizationRequirementsError = exports.toAuthorizationQueryParams = exports.isConsentRequiredError = exports.isErrorWellFormed = exports.EnvironmentConfigurationError = void 0;
|
|
10
4
|
class EnvironmentConfigurationError extends Error {
|
|
11
5
|
constructor(variable, value) {
|
|
12
6
|
super();
|
|
@@ -27,6 +21,35 @@ function isConsentRequiredError(test) {
|
|
|
27
21
|
Array.isArray(test.required_scopes));
|
|
28
22
|
}
|
|
29
23
|
exports.isConsentRequiredError = isConsentRequiredError;
|
|
24
|
+
/**
|
|
25
|
+
* Keys that should not be included in the query string object (not recognized by Globus Auth).
|
|
26
|
+
*/
|
|
27
|
+
const NO_OP_KEYS = ['required_scopes'];
|
|
28
|
+
/**
|
|
29
|
+
* Convert an `AuthorizationRequirementsError` to a query string object accepted by Globus Auth.
|
|
30
|
+
*/
|
|
31
|
+
function toAuthorizationQueryParams(error) {
|
|
32
|
+
return Object.entries(error.authorization_parameters).reduce((acc, [key, v]) => {
|
|
33
|
+
/**
|
|
34
|
+
* Remove keys that are not recognized by Globus Auth and empty values.
|
|
35
|
+
*/
|
|
36
|
+
if (NO_OP_KEYS.includes(key) || v === undefined || v === null) {
|
|
37
|
+
return acc;
|
|
38
|
+
}
|
|
39
|
+
/**
|
|
40
|
+
* All other values are converted to strings.
|
|
41
|
+
*/
|
|
42
|
+
let value = v;
|
|
43
|
+
if (Array.isArray(value)) {
|
|
44
|
+
value = value.join(',');
|
|
45
|
+
}
|
|
46
|
+
else if (typeof v === 'boolean') {
|
|
47
|
+
value = value ? 'true' : 'false';
|
|
48
|
+
}
|
|
49
|
+
return Object.assign(Object.assign({}, acc), { [key]: value });
|
|
50
|
+
}, {});
|
|
51
|
+
}
|
|
52
|
+
exports.toAuthorizationQueryParams = toAuthorizationQueryParams;
|
|
30
53
|
function isAuthorizationRequirementsError(test) {
|
|
31
54
|
return (isErrorWellFormed(test) &&
|
|
32
55
|
'authorization_parameters' in test &&
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"errors.js","sourceRoot":"","sources":["../../../../src/lib/core/errors.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"errors.js","sourceRoot":"","sources":["../../../../src/lib/core/errors.ts"],"names":[],"mappings":";;;AAQA,MAAa,6BAA8B,SAAQ,KAAK;IAGtD,YAAY,QAAgB,EAAE,KAAc;QAC1C,KAAK,EAAE,CAAC;QAHD,SAAI,GAAG,+BAA+B,CAAC;QAI9C,4EAA4E;QAC5E,IAAI,CAAC,OAAO,GAAG,4CAA4C,QAAQ,KAAK,KAAK,IAAI,CAAC;IACpF,CAAC;CACF;AARD,sEAQC;AAOD,SAAgB,iBAAiB,CAAC,IAAa;IAC7C,OAAO,OAAO,IAAI,KAAK,QAAQ,IAAI,IAAI,KAAK,IAAI,IAAI,MAAM,IAAI,IAAI,IAAI,SAAS,IAAI,IAAI,CAAC;AAC1F,CAAC;AAFD,8CAEC;AAQD,SAAgB,sBAAsB,CAAC,IAAa;IAClD,OAAO,CACL,iBAAiB,CAAC,IAAI,CAAC;QACvB,IAAI,CAAC,IAAI,KAAK,iBAAiB;QAC/B,iBAAiB,IAAI,IAAI;QACzB,KAAK,CAAC,OAAO,CAAC,IAAI,CAAC,eAAe,CAAC,CACpC,CAAC;AACJ,CAAC;AAPD,wDAOC;AAmBD;;GAEG;AACH,MAAM,UAAU,GAA6C,CAAC,iBAAiB,CAAC,CAAC;AACjF;;GAEG;AACH,SAAgB,0BAA0B,CACxC,KAAqC;IAErC,OAAO,MAAM,CAAC,OAAO,CAAC,KAAK,CAAC,wBAAwB,CAAC,CAAC,MAAM,CAAC,CAAC,GAAG,EAAE,CAAC,GAAG,EAAE,CAAC,CAAC,EAAE,EAAE;QAC7E;;WAEG;QACH,IAAI,UAAU,CAAC,QAAQ,CAAC,GAAG,CAAC,IAAI,CAAC,KAAK,SAAS,IAAI,CAAC,KAAK,IAAI,EAAE,CAAC;YAC9D,OAAO,GAAG,CAAC;QACb,CAAC;QACD;;WAEG;QACH,IAAI,KAAK,GAAG,CAAC,CAAC;QACd,IAAI,KAAK,CAAC,OAAO,CAAC,KAAK,CAAC,EAAE,CAAC;YACzB,KAAK,GAAG,KAAK,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;QAC1B,CAAC;aAAM,IAAI,OAAO,CAAC,KAAK,SAAS,EAAE,CAAC;YAClC,KAAK,GAAG,KAAK,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,OAAO,CAAC;QACnC,CAAC;QACD,uCAAY,GAAG,KAAE,CAAC,GAAG,CAAC,EAAE,KAAK,IAAG;IAClC,CAAC,EAAE,EAAE,CAAC,CAAC;AACT,CAAC;AArBD,gEAqBC;AAED,SAAgB,gCAAgC,CAC9C,IAAa;IAEb,OAAO,CACL,iBAAiB,CAAC,IAAI,CAAC;QACvB,0BAA0B,IAAI,IAAI;QAClC,OAAO,IAAI,CAAC,wBAAwB,KAAK,QAAQ;QACjD,IAAI,CAAC,wBAAwB,KAAK,IAAI,CACvC,CAAC;AACJ,CAAC;AATD,4EASC"}
|
|
@@ -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,45 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.getClientInfoRequestHeaders = exports.getClientInfo = exports.addClientInfo = exports.CLIENT_INFO = exports.VERSION = void 0;
|
|
4
|
+
/**
|
|
5
|
+
* This module is mostly intended for internal use, but can be helpful
|
|
6
|
+
* identifying information about the SDK package you are using at runtime.
|
|
7
|
+
*/
|
|
8
|
+
const private_js_1 = require("./private.js");
|
|
9
|
+
const version_js_1 = require("./version.js");
|
|
10
|
+
/**
|
|
11
|
+
* The version of the `@globus/sdk` package that is in use.
|
|
12
|
+
*/
|
|
13
|
+
exports.VERSION = version_js_1.VERSION;
|
|
14
|
+
/**
|
|
15
|
+
* The client information identifier for this package.
|
|
16
|
+
*/
|
|
17
|
+
exports.CLIENT_INFO = {
|
|
18
|
+
product: 'javascript-sdk',
|
|
19
|
+
version: exports.VERSION,
|
|
20
|
+
};
|
|
21
|
+
let INFOS = [exports.CLIENT_INFO];
|
|
22
|
+
/**
|
|
23
|
+
* Add a client information identifier to the existing SDK information.
|
|
24
|
+
*/
|
|
25
|
+
function addClientInfo(info) {
|
|
26
|
+
INFOS = INFOS.concat(info);
|
|
27
|
+
}
|
|
28
|
+
exports.addClientInfo = addClientInfo;
|
|
29
|
+
/**
|
|
30
|
+
* Get the current client information as a string.
|
|
31
|
+
*/
|
|
32
|
+
function getClientInfo() {
|
|
33
|
+
return (0, private_js_1.toString)(INFOS);
|
|
34
|
+
}
|
|
35
|
+
exports.getClientInfo = getClientInfo;
|
|
36
|
+
function getClientInfoRequestHeaders() {
|
|
37
|
+
if (!(0, private_js_1.isEnabled)()) {
|
|
38
|
+
return {};
|
|
39
|
+
}
|
|
40
|
+
return {
|
|
41
|
+
[private_js_1.CLIENT_INFO_HEADER]: getClientInfo(),
|
|
42
|
+
};
|
|
43
|
+
}
|
|
44
|
+
exports.getClientInfoRequestHeaders = getClientInfoRequestHeaders;
|
|
45
|
+
//# 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,6CAAuE;AACvE,6CAAmD;AAInD;;GAEG;AACU,QAAA,OAAO,GAAY,oBAAQ,CAAC;AAOzC;;GAEG;AACU,QAAA,WAAW,GAAS;IAC/B,OAAO,EAAE,gBAAgB;IACzB,OAAO,EAAE,eAAO;CACjB,CAAC;AAEF,IAAI,KAAK,GAAW,CAAC,mBAAW,CAAC,CAAC;AAElC;;GAEG;AACH,SAAgB,aAAa,CAAC,IAAU;IACtC,KAAK,GAAG,KAAK,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC;AAC7B,CAAC;AAFD,sCAEC;AACD;;GAEG;AACH,SAAgB,aAAa;IAC3B,OAAO,IAAA,qBAAQ,EAAC,KAAK,CAAC,CAAC;AACzB,CAAC;AAFD,sCAEC;AAED,SAAgB,2BAA2B;IACzC,IAAI,CAAC,IAAA,sBAAS,GAAE,EAAE,CAAC;QACjB,OAAO,EAAE,CAAC;IACZ,CAAC;IACD,OAAO;QACL,CAAC,+BAAkB,CAAC,EAAE,aAAa,EAAE;KACtC,CAAC;AACJ,CAAC;AAPD,kEAOC"}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import type { Info } from './index.js';
|
|
2
|
+
/**
|
|
3
|
+
* @private
|
|
4
|
+
*/
|
|
5
|
+
export declare const CLIENT_INFO_HEADER = "X-Globus-Client-Info";
|
|
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,yBAAyB,CAAC;AAGzD;;;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,48 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.toString = exports.isEnabled = exports.enable = exports.disable = exports.CLIENT_INFO_HEADER = void 0;
|
|
4
|
+
/**
|
|
5
|
+
* @private
|
|
6
|
+
*/
|
|
7
|
+
exports.CLIENT_INFO_HEADER = `X-Globus-Client-Info`;
|
|
8
|
+
let ENABLED = true;
|
|
9
|
+
/**
|
|
10
|
+
* Disable the client information header from being included in requests (enabled by default).
|
|
11
|
+
* @private
|
|
12
|
+
*/
|
|
13
|
+
function disable() {
|
|
14
|
+
ENABLED = false;
|
|
15
|
+
}
|
|
16
|
+
exports.disable = disable;
|
|
17
|
+
/**
|
|
18
|
+
* Enables the client information header to be included in requests.
|
|
19
|
+
* @private
|
|
20
|
+
*/
|
|
21
|
+
function enable() {
|
|
22
|
+
ENABLED = true;
|
|
23
|
+
}
|
|
24
|
+
exports.enable = enable;
|
|
25
|
+
/**
|
|
26
|
+
* Whether or not the client information header should be sent with requests.
|
|
27
|
+
* @private
|
|
28
|
+
*/
|
|
29
|
+
function isEnabled() {
|
|
30
|
+
return ENABLED;
|
|
31
|
+
}
|
|
32
|
+
exports.isEnabled = isEnabled;
|
|
33
|
+
const INFOS_SEPERATOR = ';';
|
|
34
|
+
const INFO_ITEM_SEPARATOR = ',';
|
|
35
|
+
/**
|
|
36
|
+
* Exported for test purposes only.
|
|
37
|
+
* @private
|
|
38
|
+
*/
|
|
39
|
+
function toString(info) {
|
|
40
|
+
const infos = Array.isArray(info) ? info : [info];
|
|
41
|
+
return infos
|
|
42
|
+
.map((i) => Object.entries(i)
|
|
43
|
+
.map(([key, value]) => `${key}=${value}`)
|
|
44
|
+
.join(INFO_ITEM_SEPARATOR))
|
|
45
|
+
.join(INFOS_SEPERATOR);
|
|
46
|
+
}
|
|
47
|
+
exports.toString = toString;
|
|
48
|
+
//# 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;AACU,QAAA,kBAAkB,GAAG,sBAAsB,CAAC;AAEzD,IAAI,OAAO,GAAG,IAAI,CAAC;AACnB;;;GAGG;AACH,SAAgB,OAAO;IACrB,OAAO,GAAG,KAAK,CAAC;AAClB,CAAC;AAFD,0BAEC;AAED;;;GAGG;AACH,SAAgB,MAAM;IACpB,OAAO,GAAG,IAAI,CAAC;AACjB,CAAC;AAFD,wBAEC;AAED;;;GAGG;AACH,SAAgB,SAAS;IACvB,OAAO,OAAO,CAAC;AACjB,CAAC;AAFD,8BAEC;AAED,MAAM,eAAe,GAAG,GAAG,CAAC;AAC5B,MAAM,mBAAmB,GAAG,GAAG,CAAC;AAEhC;;;GAGG;AACH,SAAgB,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;AATD,4BASC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"version.d.ts","sourceRoot":"","sources":["../../../../../src/lib/core/info/version.ts"],"names":[],"mappings":"AACA,eAAO,MAAM,OAAO,UAAU,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"version.js","sourceRoot":"","sources":["../../../../../src/lib/core/info/version.ts"],"names":[],"mappings":";;;AAAA,iCAAiC;AACpB,QAAA,OAAO,GAAG,OAAO,CAAC;AAC/B,uBAAuB"}
|