@globus/sdk 0.0.4-alpha.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 (212) hide show
  1. package/README.md +30 -0
  2. package/dist/common/src/__utils__/service-test-suite.d.ts +14 -0
  3. package/dist/common/src/__utils__/service-test-suite.d.ts.map +1 -0
  4. package/dist/common/src/__utils__/service-test-suite.js +29 -0
  5. package/dist/common/src/__utils__/service-test-suite.js.map +1 -0
  6. package/dist/common/src/index.d.ts +5 -0
  7. package/dist/common/src/index.d.ts.map +1 -0
  8. package/dist/common/src/index.js +22 -0
  9. package/dist/common/src/index.js.map +1 -0
  10. package/dist/common/src/lib/core/authorization.d.ts +21 -0
  11. package/dist/common/src/lib/core/authorization.d.ts.map +1 -0
  12. package/dist/common/src/lib/core/authorization.js +95 -0
  13. package/dist/common/src/lib/core/authorization.js.map +1 -0
  14. package/dist/common/src/lib/core/consent.d.ts +6 -0
  15. package/dist/common/src/lib/core/consent.d.ts.map +1 -0
  16. package/dist/common/src/lib/core/consent.js +33 -0
  17. package/dist/common/src/lib/core/consent.js.map +1 -0
  18. package/dist/common/src/lib/core/errors.d.ts +5 -0
  19. package/dist/common/src/lib/core/errors.d.ts.map +1 -0
  20. package/dist/common/src/lib/core/errors.js +12 -0
  21. package/dist/common/src/lib/core/errors.js.map +1 -0
  22. package/dist/common/src/lib/core/fetch.d.ts +7 -0
  23. package/dist/common/src/lib/core/fetch.d.ts.map +1 -0
  24. package/dist/common/src/lib/core/fetch.js +21 -0
  25. package/dist/common/src/lib/core/fetch.js.map +1 -0
  26. package/dist/common/src/lib/core/global.d.ts +35 -0
  27. package/dist/common/src/lib/core/global.d.ts.map +1 -0
  28. package/dist/common/src/lib/core/global.js +91 -0
  29. package/dist/common/src/lib/core/global.js.map +1 -0
  30. package/dist/common/src/lib/core/internals/__mocks__/fetch.d.ts +2 -0
  31. package/dist/common/src/lib/core/internals/__mocks__/fetch.d.ts.map +1 -0
  32. package/dist/common/src/lib/core/internals/__mocks__/fetch.js +4 -0
  33. package/dist/common/src/lib/core/internals/__mocks__/fetch.js.map +1 -0
  34. package/dist/common/src/lib/core/internals/fetch.d.ts +2 -0
  35. package/dist/common/src/lib/core/internals/fetch.d.ts.map +1 -0
  36. package/dist/common/src/lib/core/internals/fetch.js +6 -0
  37. package/dist/common/src/lib/core/internals/fetch.js.map +1 -0
  38. package/dist/common/src/lib/core/storage/index.d.ts +19 -0
  39. package/dist/common/src/lib/core/storage/index.d.ts.map +1 -0
  40. package/dist/common/src/lib/core/storage/index.js +35 -0
  41. package/dist/common/src/lib/core/storage/index.js.map +1 -0
  42. package/dist/common/src/lib/core/storage/local-storage.d.ts +8 -0
  43. package/dist/common/src/lib/core/storage/local-storage.d.ts.map +1 -0
  44. package/dist/common/src/lib/core/storage/local-storage.js +20 -0
  45. package/dist/common/src/lib/core/storage/local-storage.js.map +1 -0
  46. package/dist/common/src/lib/core/storage/memory.d.ts +9 -0
  47. package/dist/common/src/lib/core/storage/memory.d.ts.map +1 -0
  48. package/dist/common/src/lib/core/storage/memory.js +35 -0
  49. package/dist/common/src/lib/core/storage/memory.js.map +1 -0
  50. package/dist/common/src/lib/core/url.d.ts +6 -0
  51. package/dist/common/src/lib/core/url.d.ts.map +1 -0
  52. package/dist/common/src/lib/core/url.js +26 -0
  53. package/dist/common/src/lib/core/url.js.map +1 -0
  54. package/dist/common/src/lib/sdk.d.ts +2 -0
  55. package/dist/common/src/lib/sdk.d.ts.map +1 -0
  56. package/dist/common/src/lib/sdk.js +8 -0
  57. package/dist/common/src/lib/sdk.js.map +1 -0
  58. package/dist/common/src/lib/services/auth/config.d.ts +4 -0
  59. package/dist/common/src/lib/services/auth/config.d.ts.map +1 -0
  60. package/dist/common/src/lib/services/auth/config.js +13 -0
  61. package/dist/common/src/lib/services/auth/config.js.map +1 -0
  62. package/dist/common/src/lib/services/auth/index.d.ts +17 -0
  63. package/dist/common/src/lib/services/auth/index.d.ts.map +1 -0
  64. package/dist/common/src/lib/services/auth/index.js +21 -0
  65. package/dist/common/src/lib/services/auth/index.js.map +1 -0
  66. package/dist/common/src/lib/services/auth/types.d.ts +15 -0
  67. package/dist/common/src/lib/services/auth/types.d.ts.map +1 -0
  68. package/dist/common/src/lib/services/auth/types.js +3 -0
  69. package/dist/common/src/lib/services/auth/types.js.map +1 -0
  70. package/dist/common/src/lib/services/shared.d.ts +6 -0
  71. package/dist/common/src/lib/services/shared.d.ts.map +1 -0
  72. package/dist/common/src/lib/services/shared.js +10 -0
  73. package/dist/common/src/lib/services/shared.js.map +1 -0
  74. package/dist/common/src/lib/services/transfer/config.d.ts +4 -0
  75. package/dist/common/src/lib/services/transfer/config.d.ts.map +1 -0
  76. package/dist/common/src/lib/services/transfer/config.js +13 -0
  77. package/dist/common/src/lib/services/transfer/config.js.map +1 -0
  78. package/dist/common/src/lib/services/transfer/index.d.ts +14 -0
  79. package/dist/common/src/lib/services/transfer/index.d.ts.map +1 -0
  80. package/dist/common/src/lib/services/transfer/index.js +17 -0
  81. package/dist/common/src/lib/services/transfer/index.js.map +1 -0
  82. package/dist/common/src/lib/services/transfer/service/endpoint-search.d.ts +11 -0
  83. package/dist/common/src/lib/services/transfer/service/endpoint-search.d.ts.map +1 -0
  84. package/dist/common/src/lib/services/transfer/service/endpoint-search.js +20 -0
  85. package/dist/common/src/lib/services/transfer/service/endpoint-search.js.map +1 -0
  86. package/dist/common/src/lib/services/transfer/service/endpoint.d.ts +5 -0
  87. package/dist/common/src/lib/services/transfer/service/endpoint.d.ts.map +1 -0
  88. package/dist/common/src/lib/services/transfer/service/endpoint.js +12 -0
  89. package/dist/common/src/lib/services/transfer/service/endpoint.js.map +1 -0
  90. package/dist/common/src/lib/services/transfer/service/file-operations.d.ts +39 -0
  91. package/dist/common/src/lib/services/transfer/service/file-operations.d.ts.map +1 -0
  92. package/dist/common/src/lib/services/transfer/service/file-operations.js +60 -0
  93. package/dist/common/src/lib/services/transfer/service/file-operations.js.map +1 -0
  94. package/dist/common/src/lib/services/transfer/service/task-submission.d.ts +22 -0
  95. package/dist/common/src/lib/services/transfer/service/task-submission.d.ts.map +1 -0
  96. package/dist/common/src/lib/services/transfer/service/task-submission.js +37 -0
  97. package/dist/common/src/lib/services/transfer/service/task-submission.js.map +1 -0
  98. package/dist/common/src/lib/services/transfer/shared.d.ts +3 -0
  99. package/dist/common/src/lib/services/transfer/shared.d.ts.map +1 -0
  100. package/dist/common/src/lib/services/transfer/shared.js +14 -0
  101. package/dist/common/src/lib/services/transfer/shared.js.map +1 -0
  102. package/dist/common/src/lib/services/types.d.ts +26 -0
  103. package/dist/common/src/lib/services/types.d.ts.map +1 -0
  104. package/dist/common/src/lib/services/types.js +3 -0
  105. package/dist/common/src/lib/services/types.js.map +1 -0
  106. package/dist/common/tsconfig.cjs.tsbuildinfo +1 -0
  107. package/dist/src/__utils__/service-test-suite.d.ts +14 -0
  108. package/dist/src/__utils__/service-test-suite.d.ts.map +1 -0
  109. package/dist/src/__utils__/service-test-suite.js +26 -0
  110. package/dist/src/__utils__/service-test-suite.js.map +1 -0
  111. package/dist/src/index.d.ts +5 -0
  112. package/dist/src/index.d.ts.map +1 -0
  113. package/dist/src/index.js +8 -0
  114. package/dist/src/index.js.map +1 -0
  115. package/dist/src/lib/core/authorization.d.ts +21 -0
  116. package/dist/src/lib/core/authorization.d.ts.map +1 -0
  117. package/dist/src/lib/core/authorization.js +70 -0
  118. package/dist/src/lib/core/authorization.js.map +1 -0
  119. package/dist/src/lib/core/consent.d.ts +6 -0
  120. package/dist/src/lib/core/consent.d.ts.map +1 -0
  121. package/dist/src/lib/core/consent.js +27 -0
  122. package/dist/src/lib/core/consent.js.map +1 -0
  123. package/dist/src/lib/core/errors.d.ts +5 -0
  124. package/dist/src/lib/core/errors.d.ts.map +1 -0
  125. package/dist/src/lib/core/errors.js +8 -0
  126. package/dist/src/lib/core/errors.js.map +1 -0
  127. package/dist/src/lib/core/fetch.d.ts +7 -0
  128. package/dist/src/lib/core/fetch.d.ts.map +1 -0
  129. package/dist/src/lib/core/fetch.js +17 -0
  130. package/dist/src/lib/core/fetch.js.map +1 -0
  131. package/dist/src/lib/core/global.d.ts +35 -0
  132. package/dist/src/lib/core/global.d.ts.map +1 -0
  133. package/dist/src/lib/core/global.js +83 -0
  134. package/dist/src/lib/core/global.js.map +1 -0
  135. package/dist/src/lib/core/internals/__mocks__/fetch.d.ts +2 -0
  136. package/dist/src/lib/core/internals/__mocks__/fetch.d.ts.map +1 -0
  137. package/dist/src/lib/core/internals/__mocks__/fetch.js +4 -0
  138. package/dist/src/lib/core/internals/__mocks__/fetch.js.map +1 -0
  139. package/dist/src/lib/core/internals/fetch.d.ts +2 -0
  140. package/dist/src/lib/core/internals/fetch.d.ts.map +1 -0
  141. package/dist/src/lib/core/internals/fetch.js +3 -0
  142. package/dist/src/lib/core/internals/fetch.js.map +1 -0
  143. package/dist/src/lib/core/storage/index.d.ts +19 -0
  144. package/dist/src/lib/core/storage/index.d.ts.map +1 -0
  145. package/dist/src/lib/core/storage/index.js +30 -0
  146. package/dist/src/lib/core/storage/index.js.map +1 -0
  147. package/dist/src/lib/core/storage/local-storage.d.ts +8 -0
  148. package/dist/src/lib/core/storage/local-storage.d.ts.map +1 -0
  149. package/dist/src/lib/core/storage/local-storage.js +16 -0
  150. package/dist/src/lib/core/storage/local-storage.js.map +1 -0
  151. package/dist/src/lib/core/storage/memory.d.ts +9 -0
  152. package/dist/src/lib/core/storage/memory.d.ts.map +1 -0
  153. package/dist/src/lib/core/storage/memory.js +21 -0
  154. package/dist/src/lib/core/storage/memory.js.map +1 -0
  155. package/dist/src/lib/core/url.d.ts +6 -0
  156. package/dist/src/lib/core/url.d.ts.map +1 -0
  157. package/dist/src/lib/core/url.js +21 -0
  158. package/dist/src/lib/core/url.js.map +1 -0
  159. package/dist/src/lib/sdk.d.ts +2 -0
  160. package/dist/src/lib/sdk.d.ts.map +1 -0
  161. package/dist/src/lib/sdk.js +4 -0
  162. package/dist/src/lib/sdk.js.map +1 -0
  163. package/dist/src/lib/services/auth/config.d.ts +4 -0
  164. package/dist/src/lib/services/auth/config.d.ts.map +1 -0
  165. package/dist/src/lib/services/auth/config.js +10 -0
  166. package/dist/src/lib/services/auth/config.js.map +1 -0
  167. package/dist/src/lib/services/auth/index.d.ts +17 -0
  168. package/dist/src/lib/services/auth/index.d.ts.map +1 -0
  169. package/dist/src/lib/services/auth/index.js +16 -0
  170. package/dist/src/lib/services/auth/index.js.map +1 -0
  171. package/dist/src/lib/services/auth/types.d.ts +15 -0
  172. package/dist/src/lib/services/auth/types.d.ts.map +1 -0
  173. package/dist/src/lib/services/auth/types.js +2 -0
  174. package/dist/src/lib/services/auth/types.js.map +1 -0
  175. package/dist/src/lib/services/shared.d.ts +6 -0
  176. package/dist/src/lib/services/shared.d.ts.map +1 -0
  177. package/dist/src/lib/services/shared.js +7 -0
  178. package/dist/src/lib/services/shared.js.map +1 -0
  179. package/dist/src/lib/services/transfer/config.d.ts +4 -0
  180. package/dist/src/lib/services/transfer/config.d.ts.map +1 -0
  181. package/dist/src/lib/services/transfer/config.js +10 -0
  182. package/dist/src/lib/services/transfer/config.js.map +1 -0
  183. package/dist/src/lib/services/transfer/index.d.ts +14 -0
  184. package/dist/src/lib/services/transfer/index.d.ts.map +1 -0
  185. package/dist/src/lib/services/transfer/index.js +17 -0
  186. package/dist/src/lib/services/transfer/index.js.map +1 -0
  187. package/dist/src/lib/services/transfer/service/endpoint-search.d.ts +11 -0
  188. package/dist/src/lib/services/transfer/service/endpoint-search.d.ts.map +1 -0
  189. package/dist/src/lib/services/transfer/service/endpoint-search.js +17 -0
  190. package/dist/src/lib/services/transfer/service/endpoint-search.js.map +1 -0
  191. package/dist/src/lib/services/transfer/service/endpoint.d.ts +5 -0
  192. package/dist/src/lib/services/transfer/service/endpoint.d.ts.map +1 -0
  193. package/dist/src/lib/services/transfer/service/endpoint.js +8 -0
  194. package/dist/src/lib/services/transfer/service/endpoint.js.map +1 -0
  195. package/dist/src/lib/services/transfer/service/file-operations.d.ts +39 -0
  196. package/dist/src/lib/services/transfer/service/file-operations.d.ts.map +1 -0
  197. package/dist/src/lib/services/transfer/service/file-operations.js +53 -0
  198. package/dist/src/lib/services/transfer/service/file-operations.js.map +1 -0
  199. package/dist/src/lib/services/transfer/service/task-submission.d.ts +22 -0
  200. package/dist/src/lib/services/transfer/service/task-submission.d.ts.map +1 -0
  201. package/dist/src/lib/services/transfer/service/task-submission.js +31 -0
  202. package/dist/src/lib/services/transfer/service/task-submission.js.map +1 -0
  203. package/dist/src/lib/services/transfer/shared.d.ts +3 -0
  204. package/dist/src/lib/services/transfer/shared.d.ts.map +1 -0
  205. package/dist/src/lib/services/transfer/shared.js +10 -0
  206. package/dist/src/lib/services/transfer/shared.js.map +1 -0
  207. package/dist/src/lib/services/types.d.ts +26 -0
  208. package/dist/src/lib/services/types.d.ts.map +1 -0
  209. package/dist/src/lib/services/types.js +2 -0
  210. package/dist/src/lib/services/types.js.map +1 -0
  211. package/dist/tsconfig.tsbuildinfo +1 -0
  212. package/package.json +36 -0
package/README.md ADDED
@@ -0,0 +1,30 @@
1
+ ![](https://github.com/globusonline/globus-js/actions/workflows/test-sdk.yml/badge.svg)
2
+
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
+
5
+
6
+ - [@globus/sdk API Documentation](https://globus-jb.s3.amazonaws.com/@globus/sdk/index.html)
7
+
8
+
9
+ ## Supported Platforms
10
+
11
+ ### Node.js
12
+
13
+ Our goal is to support all Active LTS [Node.js releases](https://nodejs.org/en/about/releases/). We intend to support all Maintenance LTS versions until their official end-of-life.
14
+
15
+ | Version | |
16
+ |------------|---------|
17
+ | Node.js 14 | ✅ |
18
+ | Node.js 16 | ✅ |
19
+ | Node.js 18 | ✅ |
20
+
21
+ ### Browser Support
22
+
23
+ Officially, the SDK supports widely adopted evergreen browsers: Edge, Chrome, Safari and Firefox.
24
+
25
+ | Browser | Version |
26
+ |---------|---------|
27
+ | Google Chrome | |
28
+ | Mozilla Firefox | |
29
+ | Microsoft Edge | |
30
+ | Apple Safari | |
@@ -0,0 +1,14 @@
1
+ import { fetch } from "../lib/core/internals/fetch";
2
+ /**
3
+ * Generate a Test Suite (`jest.describe`) for a service, providing a test function.
4
+ *
5
+ * The generated suite will:
6
+ * - Mock (and provide) `fetch`
7
+ * - Configure SDK storage to be Node compatiable ("memory")
8
+ *
9
+ * @param serviceName The name of the service to be tested.
10
+ * @param featureSet The name of the service feature set being tested.
11
+ * @param fn The Jest test function
12
+ */
13
+ export default function (serviceName: string, featureSet: string, fn: (fetchMock: typeof fetch) => void): void;
14
+ //# sourceMappingURL=service-test-suite.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"service-test-suite.d.ts","sourceRoot":"","sources":["../../../../src/__utils__/service-test-suite.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,MAAM,6BAA6B,CAAC;AAKpD;;;;;;;;;;GAUG;AACH,MAAM,CAAC,OAAO,WACZ,WAAW,EAAE,MAAM,EACnB,UAAU,EAAE,MAAM,EAClB,EAAE,EAAE,CAAC,SAAS,EAAE,OAAO,KAAK,KAAK,IAAI,QAWtC"}
@@ -0,0 +1,29 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ const fetch_1 = require("../lib/core/internals/fetch");
4
+ const storage_1 = require("../lib/core/storage");
5
+ jest.mock("../lib/core/internals/fetch");
6
+ /**
7
+ * Generate a Test Suite (`jest.describe`) for a service, providing a test function.
8
+ *
9
+ * The generated suite will:
10
+ * - Mock (and provide) `fetch`
11
+ * - Configure SDK storage to be Node compatiable ("memory")
12
+ *
13
+ * @param serviceName The name of the service to be tested.
14
+ * @param featureSet The name of the service feature set being tested.
15
+ * @param fn The Jest test function
16
+ */
17
+ function default_1(serviceName, featureSet, fn) {
18
+ describe(`${serviceName} - ${featureSet}`, () => {
19
+ beforeEach(() => {
20
+ (0, storage_1.createStorage)("memory");
21
+ });
22
+ afterEach(() => {
23
+ jest.clearAllMocks();
24
+ });
25
+ fn(fetch_1.fetch);
26
+ });
27
+ }
28
+ exports.default = default_1;
29
+ //# sourceMappingURL=service-test-suite.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"service-test-suite.js","sourceRoot":"","sources":["../../../../src/__utils__/service-test-suite.ts"],"names":[],"mappings":";;AAAA,uDAAoD;AACpD,iDAAoD;AAEpD,IAAI,CAAC,IAAI,CAAC,6BAA6B,CAAC,CAAC;AAEzC;;;;;;;;;;GAUG;AACH,mBACE,WAAmB,EACnB,UAAkB,EAClB,EAAqC;IAErC,QAAQ,CAAC,GAAG,WAAW,MAAM,UAAU,EAAE,EAAE,GAAG,EAAE;QAC9C,UAAU,CAAC,GAAG,EAAE;YACd,IAAA,uBAAa,EAAC,QAAQ,CAAC,CAAC;QAC1B,CAAC,CAAC,CAAC;QACH,SAAS,CAAC,GAAG,EAAE;YACb,IAAI,CAAC,aAAa,EAAE,CAAC;QACvB,CAAC,CAAC,CAAC;QACH,EAAE,CAAC,aAAK,CAAC,CAAC;IACZ,CAAC,CAAC,CAAC;AACL,CAAC;AAdD,4BAcC"}
@@ -0,0 +1,5 @@
1
+ export * from './lib/sdk';
2
+ export * as authorization from './lib/core/authorization';
3
+ export * as auth from './lib/services/auth';
4
+ export * as transfer from './lib/services/transfer';
5
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,WAAW,CAAC;AAC1B,OAAO,KAAK,aAAa,MAAM,0BAA0B,CAAC;AAC1D,OAAO,KAAK,IAAI,MAAM,qBAAqB,CAAC;AAC5C,OAAO,KAAK,QAAQ,MAAM,yBAAyB,CAAC"}
@@ -0,0 +1,22 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
+ for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
+ };
16
+ Object.defineProperty(exports, "__esModule", { value: true });
17
+ exports.transfer = exports.auth = exports.authorization = void 0;
18
+ __exportStar(require("./lib/sdk"), exports);
19
+ exports.authorization = require("./lib/core/authorization");
20
+ exports.auth = require("./lib/services/auth");
21
+ exports.transfer = require("./lib/services/transfer");
22
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;AAAA,4CAA0B;AAC1B,4DAA0D;AAC1D,8CAA4C;AAC5C,sDAAoD"}
@@ -0,0 +1,21 @@
1
+ import type IConfig from "js-pkce/dist/IConfig";
2
+ type PKCEConfiguration = {
3
+ client_id?: IConfig["client_id"];
4
+ requested_scopes: IConfig["requested_scopes"];
5
+ redirect_uri: IConfig["redirect_uri"];
6
+ };
7
+ export declare class PKCEAuthorization {
8
+ #private;
9
+ constructor(configuration: PKCEConfiguration);
10
+ reset(): void;
11
+ redirect(): void;
12
+ handleCodeRedirect(options?: {
13
+ removeStateAndReplaceLocation: boolean;
14
+ }): Promise<void>;
15
+ hasToken(): boolean;
16
+ revoke(): void;
17
+ }
18
+ export declare function pkce(configuration: PKCEConfiguration): PKCEAuthorization;
19
+ export declare function incremental(configuration: PKCEConfiguration): PKCEAuthorization;
20
+ export {};
21
+ //# sourceMappingURL=authorization.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"authorization.d.ts","sourceRoot":"","sources":["../../../../../src/lib/core/authorization.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,OAAO,MAAM,sBAAsB,CAAC;AAchD,KAAK,iBAAiB,GAAG;IACvB,SAAS,CAAC,EAAE,OAAO,CAAC,WAAW,CAAC,CAAC;IACjC,gBAAgB,EAAE,OAAO,CAAC,kBAAkB,CAAC,CAAC;IAC9C,YAAY,EAAE,OAAO,CAAC,cAAc,CAAC,CAAC;CACvC,CAAC;AAEF,qBAAa,iBAAiB;;gBAKhB,aAAa,EAAE,iBAAiB;IAwB5C,KAAK;IAKL,QAAQ;IAKF,kBAAkB,CAAC,OAAO;;KAA0C;IAiB1E,QAAQ,IAAI,OAAO;IAMnB,MAAM;CAGP;AAED,wBAAgB,IAAI,CAAC,aAAa,EAAE,iBAAiB,qBAEpD;AAED,wBAAgB,WAAW,CAAC,aAAa,EAAE,iBAAiB,qBAE3D"}
@@ -0,0 +1,95 @@
1
+ "use strict";
2
+ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
3
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
4
+ return new (P || (P = Promise))(function (resolve, reject) {
5
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
6
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
7
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
8
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
9
+ });
10
+ };
11
+ var __classPrivateFieldSet = (this && this.__classPrivateFieldSet) || function (receiver, state, value, kind, f) {
12
+ if (kind === "m") throw new TypeError("Private method is not writable");
13
+ if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a setter");
14
+ if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot write private member to an object whose class did not declare it");
15
+ return (kind === "a" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value)), value;
16
+ };
17
+ var __classPrivateFieldGet = (this && this.__classPrivateFieldGet) || function (receiver, state, kind, f) {
18
+ if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a getter");
19
+ if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot read private member from an object whose class did not declare it");
20
+ return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
21
+ };
22
+ var _PKCEAuthorization_instances, _PKCEAuthorization_pkce, _PKCEAuthorization_configuration, _PKCEAuthorization_response, _PKCEAuthorization_createPKCEInstance, _PKCEAuthorization_resetPKCE;
23
+ Object.defineProperty(exports, "__esModule", { value: true });
24
+ exports.incremental = exports.pkce = exports.PKCEAuthorization = void 0;
25
+ const js_pkce_1 = require("js-pkce");
26
+ const auth_1 = require("../services/auth");
27
+ const global_1 = require("./global");
28
+ const consent_1 = require("./consent");
29
+ const storage_1 = require("./storage");
30
+ let storage;
31
+ class PKCEAuthorization {
32
+ constructor(configuration) {
33
+ _PKCEAuthorization_instances.add(this);
34
+ _PKCEAuthorization_pkce.set(this, void 0);
35
+ _PKCEAuthorization_configuration.set(this, void 0);
36
+ _PKCEAuthorization_response.set(this, void 0);
37
+ storage = (0, storage_1.createStorage)("localStorage");
38
+ __classPrivateFieldSet(this, _PKCEAuthorization_configuration, Object.assign({ client_id: (0, global_1.getConfigurationValue)("CLIENT_ID"), authorization_endpoint: (0, auth_1.getAuthorizationEndpoint)(), token_endpoint: (0, auth_1.getTokenEndpoint)() }, configuration), "f");
39
+ __classPrivateFieldSet(this, _PKCEAuthorization_pkce, __classPrivateFieldGet(this, _PKCEAuthorization_instances, "m", _PKCEAuthorization_createPKCEInstance).call(this), "f");
40
+ }
41
+ reset() {
42
+ __classPrivateFieldGet(this, _PKCEAuthorization_instances, "m", _PKCEAuthorization_resetPKCE).call(this);
43
+ (0, consent_1.reset)();
44
+ }
45
+ redirect() {
46
+ this.reset();
47
+ window.location.replace(__classPrivateFieldGet(this, _PKCEAuthorization_pkce, "f").authorizeUrl());
48
+ }
49
+ handleCodeRedirect(options = { removeStateAndReplaceLocation: true }) {
50
+ return __awaiter(this, void 0, void 0, function* () {
51
+ const url = new URL(window.location.href);
52
+ const params = new URLSearchParams(url.search);
53
+ if (!params.get("code"))
54
+ return;
55
+ const response = yield __classPrivateFieldGet(this, _PKCEAuthorization_pkce, "f").exchangeForAccessToken(url.toString());
56
+ __classPrivateFieldSet(this, _PKCEAuthorization_response, response, "f");
57
+ (0, consent_1.addTokenResponse)(__classPrivateFieldGet(this, _PKCEAuthorization_response, "f"));
58
+ // Remove PKCE-state from the URL since we have a token.
59
+ if (options.removeStateAndReplaceLocation) {
60
+ params.delete("code");
61
+ params.delete("state");
62
+ url.search = params.toString();
63
+ window.location.replace(url);
64
+ }
65
+ });
66
+ }
67
+ hasToken() {
68
+ return __classPrivateFieldGet(this, _PKCEAuthorization_configuration, "f").requested_scopes
69
+ .split(" ")
70
+ .every((scope) => Boolean((0, consent_1.getTokenForScope)(scope)));
71
+ }
72
+ revoke() {
73
+ this.reset();
74
+ }
75
+ }
76
+ exports.PKCEAuthorization = PKCEAuthorization;
77
+ _PKCEAuthorization_pkce = new WeakMap(), _PKCEAuthorization_configuration = new WeakMap(), _PKCEAuthorization_response = new WeakMap(), _PKCEAuthorization_instances = new WeakSet(), _PKCEAuthorization_createPKCEInstance = function _PKCEAuthorization_createPKCEInstance() {
78
+ return new js_pkce_1.default(__classPrivateFieldGet(this, _PKCEAuthorization_configuration, "f"));
79
+ }, _PKCEAuthorization_resetPKCE = function _PKCEAuthorization_resetPKCE() {
80
+ /**
81
+ * Resets js-pkce state
82
+ * @see https://github.com/bpedroza/js-pkce/blob/master/src/PKCE.ts
83
+ */
84
+ sessionStorage.removeItem("pkce_state");
85
+ sessionStorage.removeItem("pkce_code_verifier");
86
+ };
87
+ function pkce(configuration) {
88
+ return new PKCEAuthorization(configuration);
89
+ }
90
+ exports.pkce = pkce;
91
+ function incremental(configuration) {
92
+ return new PKCEAuthorization(configuration);
93
+ }
94
+ exports.incremental = incremental;
95
+ //# sourceMappingURL=authorization.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"authorization.js","sourceRoot":"","sources":["../../../../../src/lib/core/authorization.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;AAAA,qCAA2B;AAI3B,2CAA8E;AAC9E,qCAAiD;AACjD,uCAImB;AAEnB,uCAAyD;AAEzD,IAAI,OAAsB,CAAC;AAQ3B,MAAa,iBAAiB;IAK5B,YAAY,aAAgC;;QAJ5C,0CAAY;QACZ,mDAAwB;QACxB,8CAAsC;QAGpC,OAAO,GAAG,IAAA,uBAAa,EAAC,cAAc,CAAC,CAAC;QACxC,uBAAA,IAAI,oDACF,SAAS,EAAE,IAAA,8BAAqB,EAAC,WAAW,CAAC,EAC7C,sBAAsB,EAAE,IAAA,+BAAwB,GAAE,EAClD,cAAc,EAAE,IAAA,uBAAgB,GAAE,IAC/B,aAAa,OACjB,CAAC;QACF,uBAAA,IAAI,2BAAS,uBAAA,IAAI,2EAAoB,MAAxB,IAAI,CAAsB,MAAA,CAAC;IAC1C,CAAC;IAeD,KAAK;QACH,uBAAA,IAAI,kEAAW,MAAf,IAAI,CAAa,CAAC;QAClB,IAAA,eAAW,GAAE,CAAC;IAChB,CAAC;IAED,QAAQ;QACN,IAAI,CAAC,KAAK,EAAE,CAAC;QACb,MAAM,CAAC,QAAQ,CAAC,OAAO,CAAC,uBAAA,IAAI,+BAAM,CAAC,YAAY,EAAE,CAAC,CAAC;IACrD,CAAC;IAEK,kBAAkB,CAAC,OAAO,GAAG,EAAE,6BAA6B,EAAE,IAAI,EAAE;;YACxE,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;YAE/C,IAAI,CAAC,MAAM,CAAC,GAAG,CAAC,MAAM,CAAC;gBAAE,OAAO;YAChC,MAAM,QAAQ,GAAG,MAAM,uBAAA,IAAI,+BAAM,CAAC,sBAAsB,CAAC,GAAG,CAAC,QAAQ,EAAE,CAAC,CAAC;YACzE,uBAAA,IAAI,+BAAa,QAAQ,MAAA,CAAC;YAC1B,IAAA,0BAAgB,EAAC,uBAAA,IAAI,mCAAU,CAAC,CAAC;YACjC,wDAAwD;YACxD,IAAI,OAAO,CAAC,6BAA6B,EAAE;gBACzC,MAAM,CAAC,MAAM,CAAC,MAAM,CAAC,CAAC;gBACtB,MAAM,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC;gBACvB,GAAG,CAAC,MAAM,GAAG,MAAM,CAAC,QAAQ,EAAE,CAAC;gBAC/B,MAAM,CAAC,QAAQ,CAAC,OAAO,CAAC,GAAG,CAAC,CAAC;aAC9B;QACH,CAAC;KAAA;IAED,QAAQ;QACN,OAAO,uBAAA,IAAI,wCAAe,CAAC,gBAAgB;aACxC,KAAK,CAAC,GAAG,CAAC;aACV,KAAK,CAAC,CAAC,KAAK,EAAE,EAAE,CAAC,OAAO,CAAC,IAAA,0BAAgB,EAAC,KAAK,CAAC,CAAC,CAAC,CAAC;IACxD,CAAC;IAED,MAAM;QACJ,IAAI,CAAC,KAAK,EAAE,CAAC;IACf,CAAC;CACF;AAjED,8CAiEC;;IAhDG,OAAO,IAAI,iBAAI,CAAC,uBAAA,IAAI,wCAAe,CAAC,CAAC;AACvC,CAAC;IAGC;;;OAGG;IACH,cAAc,CAAC,UAAU,CAAC,YAAY,CAAC,CAAC;IACxC,cAAc,CAAC,UAAU,CAAC,oBAAoB,CAAC,CAAC;AAClD,CAAC;AAwCH,SAAgB,IAAI,CAAC,aAAgC;IACnD,OAAO,IAAI,iBAAiB,CAAC,aAAa,CAAC,CAAC;AAC9C,CAAC;AAFD,oBAEC;AAED,SAAgB,WAAW,CAAC,aAAgC;IAC1D,OAAO,IAAI,iBAAiB,CAAC,aAAa,CAAC,CAAC;AAC9C,CAAC;AAFD,kCAEC"}
@@ -0,0 +1,6 @@
1
+ import type { TokenResponse } from "../services/auth";
2
+ import ITokenResponse from "js-pkce/dist/ITokenResponse";
3
+ export declare function addTokenResponse(token: ITokenResponse | TokenResponse): void;
4
+ export declare function getTokenForScope(scope: string): string | null;
5
+ export declare function reset(): void;
6
+ //# sourceMappingURL=consent.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"consent.d.ts","sourceRoot":"","sources":["../../../../../src/lib/core/consent.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAS,aAAa,EAAE,MAAM,kBAAkB,CAAC;AAC7D,OAAO,cAAc,MAAM,6BAA6B,CAAC;AAazD,wBAAgB,gBAAgB,CAAC,KAAK,EAAE,cAAc,GAAG,aAAa,QAKrE;AAED,wBAAgB,gBAAgB,CAAC,KAAK,EAAE,MAAM,iBAM7C;AAED,wBAAgB,KAAK,SAEpB"}
@@ -0,0 +1,33 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.reset = exports.getTokenForScope = exports.addTokenResponse = void 0;
4
+ const storage_1 = require("./storage");
5
+ function isValidToken(check) {
6
+ const maybe = check;
7
+ return Boolean(maybe.token_type && maybe.access_token);
8
+ }
9
+ function store(token) {
10
+ token.scope.split(" ").forEach((scope) => {
11
+ (0, storage_1.getStorage)().set(scope, token);
12
+ });
13
+ }
14
+ function addTokenResponse(token) {
15
+ store(token);
16
+ if ("other_tokens" in token) {
17
+ token.other_tokens.forEach(store);
18
+ }
19
+ }
20
+ exports.addTokenResponse = addTokenResponse;
21
+ function getTokenForScope(scope) {
22
+ const token = (0, storage_1.getStorage)().get(scope);
23
+ if (!token || !isValidToken(token)) {
24
+ return null;
25
+ }
26
+ return `${token.token_type} ${token.access_token}`;
27
+ }
28
+ exports.getTokenForScope = getTokenForScope;
29
+ function reset() {
30
+ (0, storage_1.getStorage)().clear();
31
+ }
32
+ exports.reset = reset;
33
+ //# sourceMappingURL=consent.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"consent.js","sourceRoot":"","sources":["../../../../../src/lib/core/consent.ts"],"names":[],"mappings":";;;AAAA,uCAAuC;AAIvC,SAAS,YAAY,CAAC,KAAc;IAClC,MAAM,KAAK,GAAG,KAAc,CAAC;IAC7B,OAAO,OAAO,CAAC,KAAK,CAAC,UAAU,IAAI,KAAK,CAAC,YAAY,CAAC,CAAC;AACzD,CAAC;AAED,SAAS,KAAK,CAAC,KAAqB;IAClC,KAAK,CAAC,KAAK,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,OAAO,CAAC,CAAC,KAAK,EAAE,EAAE;QACvC,IAAA,oBAAU,GAAE,CAAC,GAAG,CAAC,KAAK,EAAE,KAAK,CAAC,CAAC;IACjC,CAAC,CAAC,CAAC;AACL,CAAC;AAED,SAAgB,gBAAgB,CAAC,KAAqC;IACpE,KAAK,CAAC,KAAK,CAAC,CAAC;IACb,IAAI,cAAc,IAAI,KAAK,EAAE;QAC3B,KAAK,CAAC,YAAY,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC;KACnC;AACH,CAAC;AALD,4CAKC;AAED,SAAgB,gBAAgB,CAAC,KAAa;IAC5C,MAAM,KAAK,GAAG,IAAA,oBAAU,GAAE,CAAC,GAAG,CAAC,KAAK,CAAC,CAAC;IACtC,IAAI,CAAC,KAAK,IAAI,CAAC,YAAY,CAAC,KAAK,CAAC,EAAE;QAClC,OAAO,IAAI,CAAC;KACb;IACD,OAAO,GAAG,KAAK,CAAC,UAAU,IAAI,KAAK,CAAC,YAAY,EAAE,CAAC;AACrD,CAAC;AAND,4CAMC;AAED,SAAgB,KAAK;IACnB,IAAA,oBAAU,GAAE,CAAC,KAAK,EAAE,CAAC;AACvB,CAAC;AAFD,sBAEC"}
@@ -0,0 +1,5 @@
1
+ export declare class EnvironmentConfigurationError extends Error {
2
+ name: string;
3
+ constructor(variable: string, value: any);
4
+ }
5
+ //# sourceMappingURL=errors.d.ts.map
@@ -0,0 +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;gBACpC,QAAQ,EAAE,MAAM,EAAE,KAAK,EAAE,GAAG;CAIzC"}
@@ -0,0 +1,12 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.EnvironmentConfigurationError = void 0;
4
+ class EnvironmentConfigurationError extends Error {
5
+ constructor(variable, value) {
6
+ super();
7
+ this.name = 'EnvironmentConfigurationError';
8
+ this.message = `Invalid configuration value provided for ${variable} (${value}).`;
9
+ }
10
+ }
11
+ exports.EnvironmentConfigurationError = EnvironmentConfigurationError;
12
+ //# sourceMappingURL=errors.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"errors.js","sourceRoot":"","sources":["../../../../../src/lib/core/errors.ts"],"names":[],"mappings":";;;AAAA,MAAa,6BAA8B,SAAQ,KAAK;IAEtD,YAAY,QAAgB,EAAE,KAAU;QACtC,KAAK,EAAE,CAAC;QAFD,SAAI,GAAG,+BAA+B,CAAC;QAG9C,IAAI,CAAC,OAAO,GAAG,4CAA4C,QAAQ,KAAK,KAAK,IAAI,CAAC;IACpF,CAAC;CACF;AAND,sEAMC"}
@@ -0,0 +1,7 @@
1
+ type GlobusScope = string;
2
+ export type FetchOverrides = (Omit<RequestInit, "headers"> & {
3
+ headers?: Record<string, string>;
4
+ }) | undefined;
5
+ export declare function fetchWithScope(scope: GlobusScope, input: RequestInfo | URL, fetchOverrides?: FetchOverrides): Promise<Response>;
6
+ export {};
7
+ //# sourceMappingURL=fetch.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"fetch.d.ts","sourceRoot":"","sources":["../../../../../src/lib/core/fetch.ts"],"names":[],"mappings":"AAGA,KAAK,WAAW,GAAG,MAAM,CAAC;AAE1B,MAAM,MAAM,cAAc,GACtB,CAAC,IAAI,CAAC,WAAW,EAAE,SAAS,CAAC,GAAG;IAC9B,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;CAClC,CAAC,GACF,SAAS,CAAC;AAEd,wBAAgB,cAAc,CAC5B,KAAK,EAAE,WAAW,EAClB,KAAK,EAAE,WAAW,GAAG,GAAG,EACxB,cAAc,GAAE,cAAmB,qBAiBpC"}
@@ -0,0 +1,21 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.fetchWithScope = void 0;
4
+ const fetch_1 = require("./internals/fetch");
5
+ const consent_1 = require("./consent");
6
+ function fetchWithScope(scope, input, fetchOverrides = {}) {
7
+ const headers = fetchOverrides.headers || {};
8
+ /**
9
+ * If an `Authorization` override header was provided, we skip any
10
+ * sort of lookup and use the provided value.
11
+ */
12
+ if (!(headers === null || headers === void 0 ? void 0 : headers["Authorization"])) {
13
+ const token = (0, consent_1.getTokenForScope)(scope);
14
+ if (token) {
15
+ headers["Authorization"] = token;
16
+ }
17
+ }
18
+ return (0, fetch_1.fetch)(input, Object.assign(Object.assign({}, fetchOverrides), { headers }));
19
+ }
20
+ exports.fetchWithScope = fetchWithScope;
21
+ //# sourceMappingURL=fetch.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"fetch.js","sourceRoot":"","sources":["../../../../../src/lib/core/fetch.ts"],"names":[],"mappings":";;;AAAA,6CAA0C;AAC1C,uCAA6C;AAU7C,SAAgB,cAAc,CAC5B,KAAkB,EAClB,KAAwB,EACxB,iBAAiC,EAAE;IAEnC,MAAM,OAAO,GAAG,cAAc,CAAC,OAAO,IAAI,EAAE,CAAC;IAC7C;;;OAGG;IACH,IAAI,CAAC,CAAA,OAAO,aAAP,OAAO,uBAAP,OAAO,CAAG,eAAe,CAAC,CAAA,EAAE;QAC/B,MAAM,KAAK,GAAG,IAAA,0BAAgB,EAAC,KAAK,CAAC,CAAC;QACtC,IAAI,KAAK,EAAE;YACT,OAAO,CAAC,eAAe,CAAC,GAAG,KAAK,CAAC;SAClC;KACF;IACD,OAAO,IAAA,aAAK,EAAC,KAAK,kCACb,cAAc,KACjB,OAAO,IACP,CAAC;AACL,CAAC;AApBD,wCAoBC"}
@@ -0,0 +1,35 @@
1
+ import * as AUTH from "../services/auth/config";
2
+ import * as TRANSFER from "../services/transfer/config";
3
+ export declare function env(key: string, fallback?: any): any;
4
+ /**
5
+ * Handlers for: GLOBUS_SDK_ENVIRONMENT
6
+ */
7
+ export declare const ENVIRONMENTS: {
8
+ readonly PRODUCTION: "production";
9
+ readonly PREVIEW: "preview";
10
+ readonly STAGING: "staging";
11
+ readonly SANDBOX: "sandbox";
12
+ readonly INTEGRATION: "integration";
13
+ readonly TEST: "test";
14
+ };
15
+ export type Environment = typeof ENVIRONMENTS[keyof typeof ENVIRONMENTS];
16
+ export declare function getEnvironment(): Environment;
17
+ export declare const SERVICES: Record<string, string>;
18
+ export declare const SERVICE_HOSTS: Record<Service, Partial<Record<Environment, string>>>;
19
+ export type Service = typeof AUTH.ID | typeof TRANSFER.ID;
20
+ /**
21
+ * Handlers for: GLOBUS_SDK_VERIFY_SSL
22
+ * Since disabling SSL is at least not-recommended, we consider
23
+ * this value to always be true, but provide a warning when it set
24
+ * to one of the falsey values for informational purposes.
25
+ *
26
+ * Taking direction from `globus-sdk-python` for possible false values
27
+ * @see https://github.com/globus/globus-sdk-python/blob/18eced9c12e2ec41745d1be183148845198b999c/src/globus_sdk/config/env_vars.py#L20
28
+ */
29
+ export declare function getVerifySSL(): boolean;
30
+ /**
31
+ * Handlers for: GLOBUS_SDK_HTTP_TIMEOUT
32
+ */
33
+ export declare function getHttpTimeout(): number | null;
34
+ export declare function getConfigurationValue(key: string): any;
35
+ //# sourceMappingURL=global.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"global.d.ts","sourceRoot":"","sources":["../../../../../src/lib/core/global.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,IAAI,MAAM,yBAAyB,CAAC;AAChD,OAAO,KAAK,QAAQ,MAAM,6BAA6B,CAAC;AAWxD,wBAAgB,GAAG,CAAC,GAAG,EAAE,MAAM,EAAE,QAAQ,GAAE,GAAe,GAAG,GAAG,CAa/D;AAED;;GAEG;AACH,eAAO,MAAM,YAAY;;;;;;;CAOf,CAAC;AAEX,MAAM,MAAM,WAAW,GAAG,OAAO,YAAY,CAAC,MAAM,OAAO,YAAY,CAAC,CAAC;AAEzE,wBAAgB,cAAc,IAAI,WAAW,CAM5C;AAED,eAAO,MAAM,QAAQ,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAG3C,CAAC;AAEF,eAAO,MAAM,aAAa,EAAE,MAAM,CAChC,OAAO,EACP,OAAO,CAAC,MAAM,CAAC,WAAW,EAAE,MAAM,CAAC,CAAC,CAIrC,CAAC;AAEF,MAAM,MAAM,OAAO,GAAG,OAAO,IAAI,CAAC,EAAE,GAAG,OAAO,QAAQ,CAAC,EAAE,CAAC;AAE1D;;;;;;;;GAQG;AACH,wBAAgB,YAAY,IAAI,OAAO,CAQtC;AAED;;GAEG;AACH,wBAAgB,cAAc,IAAI,MAAM,GAAG,IAAI,CAM9C;AAMD,wBAAgB,qBAAqB,CAAC,GAAG,EAAE,MAAM,OAEhD"}
@@ -0,0 +1,91 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.getConfigurationValue = exports.getHttpTimeout = exports.getVerifySSL = exports.SERVICE_HOSTS = exports.SERVICES = exports.getEnvironment = exports.ENVIRONMENTS = exports.env = void 0;
4
+ const AUTH = require("../services/auth/config");
5
+ const TRANSFER = require("../services/transfer/config");
6
+ const errors_1 = require("./errors");
7
+ function getRuntime() {
8
+ return typeof window !== "undefined" ? window : process;
9
+ }
10
+ function isBrowser(runtime) {
11
+ return typeof window === typeof runtime;
12
+ }
13
+ function env(key, fallback = undefined) {
14
+ const runtime = getRuntime();
15
+ let envConfiguration;
16
+ if (isBrowser(runtime)) {
17
+ envConfiguration = runtime;
18
+ }
19
+ else {
20
+ envConfiguration = runtime.env;
21
+ }
22
+ if (Object.prototype.hasOwnProperty.call(envConfiguration, key)) {
23
+ // @ts-ignore
24
+ return envConfiguration[key];
25
+ }
26
+ return fallback;
27
+ }
28
+ exports.env = env;
29
+ /**
30
+ * Handlers for: GLOBUS_SDK_ENVIRONMENT
31
+ */
32
+ exports.ENVIRONMENTS = {
33
+ PRODUCTION: "production",
34
+ PREVIEW: "preview",
35
+ STAGING: "staging",
36
+ SANDBOX: "sandbox",
37
+ INTEGRATION: "integration",
38
+ TEST: "test",
39
+ };
40
+ function getEnvironment() {
41
+ const environment = env('GLOBUS_SDK_ENVIRONMENT', exports.ENVIRONMENTS.PRODUCTION);
42
+ if (!Object.values(exports.ENVIRONMENTS).includes(environment)) {
43
+ throw new errors_1.EnvironmentConfigurationError('GLOBUS_SDK_ENVIRONMENT', environment);
44
+ }
45
+ return environment;
46
+ }
47
+ exports.getEnvironment = getEnvironment;
48
+ exports.SERVICES = {
49
+ [AUTH.ID]: AUTH.ID,
50
+ [TRANSFER.ID]: TRANSFER.ID,
51
+ };
52
+ exports.SERVICE_HOSTS = {
53
+ [AUTH.ID]: AUTH.HOSTS,
54
+ [TRANSFER.ID]: TRANSFER.HOSTS,
55
+ };
56
+ /**
57
+ * Handlers for: GLOBUS_SDK_VERIFY_SSL
58
+ * Since disabling SSL is at least not-recommended, we consider
59
+ * this value to always be true, but provide a warning when it set
60
+ * to one of the falsey values for informational purposes.
61
+ *
62
+ * Taking direction from `globus-sdk-python` for possible false values
63
+ * @see https://github.com/globus/globus-sdk-python/blob/18eced9c12e2ec41745d1be183148845198b999c/src/globus_sdk/config/env_vars.py#L20
64
+ */
65
+ function getVerifySSL() {
66
+ const verifySSLTemp = env('GLOBUS_SDK_VERIFY_SSL', 'true').toLowerCase();
67
+ if (["n", "no", "f", "false", "off", "0"].includes(verifySSLTemp)) {
68
+ console.warn('Setting GLOBUS_SDK_VERIFY_SSL to false is disallowed in the Globus Javascript SDK. It will always true in this context');
69
+ }
70
+ return true;
71
+ }
72
+ exports.getVerifySSL = getVerifySSL;
73
+ /**
74
+ * Handlers for: GLOBUS_SDK_HTTP_TIMEOUT
75
+ */
76
+ function getHttpTimeout() {
77
+ const timeout = Number(env('GLOBUS_SDK_HTTP_TIMEOUT', 60));
78
+ if (timeout === -1) {
79
+ return null;
80
+ }
81
+ return timeout;
82
+ }
83
+ exports.getHttpTimeout = getHttpTimeout;
84
+ function getConfiguration() {
85
+ return env('GLOBUS') || {};
86
+ }
87
+ function getConfigurationValue(key) {
88
+ return getConfiguration()[key];
89
+ }
90
+ exports.getConfigurationValue = getConfigurationValue;
91
+ //# sourceMappingURL=global.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"global.js","sourceRoot":"","sources":["../../../../../src/lib/core/global.ts"],"names":[],"mappings":";;;AAAA,gDAAgD;AAChD,wDAAwD;AACxD,qCAAyD;AAEzD,SAAS,UAAU;IACjB,OAAO,OAAO,MAAM,KAAK,WAAW,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,OAAO,CAAC;AAC1D,CAAC;AAED,SAAS,SAAS,CAAC,OAAgC;IACjD,OAAO,OAAO,MAAM,KAAK,OAAO,OAAO,CAAC;AAC1C,CAAC;AAED,SAAgB,GAAG,CAAC,GAAW,EAAE,WAAgB,SAAS;IACxD,MAAM,OAAO,GAAG,UAAU,EAAE,CAAC;IAC7B,IAAI,gBAA4C,CAAC;IACjD,IAAI,SAAS,CAAC,OAAO,CAAC,EAAE;QACtB,gBAAgB,GAAG,OAAO,CAAC;KAC5B;SAAM;QACL,gBAAgB,GAAG,OAAO,CAAC,GAAG,CAAC;KAChC;IACD,IAAI,MAAM,CAAC,SAAS,CAAC,cAAc,CAAC,IAAI,CAAC,gBAAgB,EAAE,GAAG,CAAC,EAAE;QAC/D,aAAa;QACb,OAAO,gBAAgB,CAAC,GAAG,CAAC,CAAC;KAC9B;IACD,OAAO,QAAQ,CAAC;AAClB,CAAC;AAbD,kBAaC;AAED;;GAEG;AACU,QAAA,YAAY,GAAG;IAC1B,UAAU,EAAE,YAAY;IACxB,OAAO,EAAE,SAAS;IAClB,OAAO,EAAE,SAAS;IAClB,OAAO,EAAE,SAAS;IAClB,WAAW,EAAE,aAAa;IAC1B,IAAI,EAAE,MAAM;CACJ,CAAC;AAIX,SAAgB,cAAc;IAC5B,MAAM,WAAW,GAAG,GAAG,CAAC,wBAAwB,EAAE,oBAAY,CAAC,UAAU,CAAC,CAAC;IAC3E,IAAI,CAAC,MAAM,CAAC,MAAM,CAAC,oBAAY,CAAC,CAAC,QAAQ,CAAC,WAAW,CAAC,EAAE;QACtD,MAAM,IAAI,sCAA6B,CAAC,wBAAwB,EAAE,WAAW,CAAC,CAAC;KAChF;IACD,OAAO,WAAW,CAAC;AACrB,CAAC;AAND,wCAMC;AAEY,QAAA,QAAQ,GAA2B;IAC9C,CAAC,IAAI,CAAC,EAAE,CAAC,EAAE,IAAI,CAAC,EAAE;IAClB,CAAC,QAAQ,CAAC,EAAE,CAAC,EAAE,QAAQ,CAAC,EAAE;CAC3B,CAAC;AAEW,QAAA,aAAa,GAGtB;IACF,CAAC,IAAI,CAAC,EAAE,CAAC,EAAE,IAAI,CAAC,KAAK;IACrB,CAAC,QAAQ,CAAC,EAAE,CAAC,EAAE,QAAQ,CAAC,KAAK;CAC9B,CAAC;AAIF;;;;;;;;GAQG;AACH,SAAgB,YAAY;IAC1B,MAAM,aAAa,GAAI,GAAG,CAAC,uBAAuB,EAAE,MAAM,CAAY,CAAC,WAAW,EAAE,CAAC;IACrF,IAAI,CAAC,GAAG,EAAE,IAAI,EAAE,GAAG,EAAE,OAAO,EAAE,KAAK,EAAE,GAAG,CAAC,CAAC,QAAQ,CAAC,aAAa,CAAC,EAAE;QACjE,OAAO,CAAC,IAAI,CACV,wHAAwH,CACzH,CAAC;KACH;IACD,OAAO,IAAI,CAAC;AACd,CAAC;AARD,oCAQC;AAED;;GAEG;AACH,SAAgB,cAAc;IAC5B,MAAM,OAAO,GAAW,MAAM,CAAC,GAAG,CAAC,yBAAyB,EAAE,EAAE,CAAC,CAAC,CAAC;IACnE,IAAI,OAAO,KAAK,CAAC,CAAC,EAAE;QAClB,OAAO,IAAI,CAAC;KACb;IACD,OAAO,OAAO,CAAC;AACjB,CAAC;AAND,wCAMC;AAED,SAAS,gBAAgB;IACvB,OAAO,GAAG,CAAC,QAAQ,CAAC,IAAI,EAAE,CAAC;AAC7B,CAAC;AAED,SAAgB,qBAAqB,CAAC,GAAW;IAC/C,OAAO,gBAAgB,EAAE,CAAC,GAAG,CAAC,CAAC;AACjC,CAAC;AAFD,sDAEC"}
@@ -0,0 +1,2 @@
1
+ declare const actual: typeof import("../fetch");
2
+ //# sourceMappingURL=fetch.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"fetch.d.ts","sourceRoot":"","sources":["../../../../../../../src/lib/core/internals/__mocks__/fetch.ts"],"names":[],"mappings":"AAAA,QAAA,MAAM,MAAM,EAAE,cAAc,UAAU,CACN,CAAC"}
@@ -0,0 +1,4 @@
1
+ "use strict";
2
+ const actual = jest.requireActual("../fetch");
3
+ module.exports = Object.assign(Object.assign({}, actual), { fetch: jest.fn().mockResolvedValue({}) });
4
+ //# sourceMappingURL=fetch.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"fetch.js","sourceRoot":"","sources":["../../../../../../../src/lib/core/internals/__mocks__/fetch.ts"],"names":[],"mappings":";AAAA,MAAM,MAAM,GACV,IAAI,CAAC,aAAa,CAAC,UAAU,CAAC,CAAC;AAEjC,MAAM,CAAC,OAAO,mCACT,MAAM,KACT,KAAK,EAAE,IAAI,CAAC,EAAE,EAAE,CAAC,iBAAiB,CAAC,EAAE,CAAC,GACvC,CAAC"}
@@ -0,0 +1,2 @@
1
+ export declare const fetch: typeof globalThis.fetch;
2
+ //# sourceMappingURL=fetch.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"fetch.d.ts","sourceRoot":"","sources":["../../../../../../src/lib/core/internals/fetch.ts"],"names":[],"mappings":"AACA,eAAO,MAAM,KAAK,yBAAS,CAAC"}
@@ -0,0 +1,6 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.fetch = void 0;
4
+ const cross_fetch_1 = require("cross-fetch");
5
+ exports.fetch = cross_fetch_1.default;
6
+ //# sourceMappingURL=fetch.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"fetch.js","sourceRoot":"","sources":["../../../../../../src/lib/core/internals/fetch.ts"],"names":[],"mappings":";;;AAAA,6CAAiC;AACpB,QAAA,KAAK,GAAG,qBAAM,CAAC"}
@@ -0,0 +1,19 @@
1
+ /**
2
+ * Acts as a basic wrapper for storage layers to make their surface APIs consistent.
3
+ */
4
+ export interface StorageSystem {
5
+ get(key: string): any | undefined;
6
+ set(key: string, value: any): void;
7
+ remove(key: string): void;
8
+ clear(): void;
9
+ }
10
+ type StorageOptions = "localStorage" | "memory" | {
11
+ new (): StorageSystem;
12
+ };
13
+ /**
14
+ * Returns the active storage system or creates an instance for the running process.
15
+ */
16
+ export declare function createStorage(storageType?: StorageOptions): StorageSystem;
17
+ export default createStorage;
18
+ export declare function getStorage(): StorageSystem;
19
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../../src/lib/core/storage/index.ts"],"names":[],"mappings":"AAEA;;GAEG;AACH,MAAM,WAAW,aAAa;IAC5B,GAAG,CAAC,GAAG,EAAE,MAAM,GAAG,GAAG,GAAG,SAAS,CAAC;IAClC,GAAG,CAAC,GAAG,EAAE,MAAM,EAAE,KAAK,EAAE,GAAG,GAAG,IAAI,CAAC;IACnC,MAAM,CAAC,GAAG,EAAE,MAAM,GAAG,IAAI,CAAC;IAC1B,KAAK,IAAI,IAAI,CAAC;CACf;AAGD,KAAK,cAAc,GACf,cAAc,GACd,QAAQ,GACR;IACE,QAAQ,aAAa,CAAC;CACvB,CAAC;AAEN;;GAEG;AACH,wBAAgB,aAAa,CAC3B,WAAW,GAAE,cAAyB,GACrC,aAAa,CAaf;AAED,eAAe,aAAa,CAAC;AAE7B,wBAAgB,UAAU,kBAKzB"}
@@ -0,0 +1,35 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.getStorage = exports.createStorage = void 0;
4
+ const memory_1 = require("./memory");
5
+ const local_storage_1 = require("./local-storage");
6
+ let storage;
7
+ /**
8
+ * Returns the active storage system or creates an instance for the running process.
9
+ */
10
+ function createStorage(storageType = "memory") {
11
+ if (!storage) {
12
+ let Factory;
13
+ if (storageType === "localStorage") {
14
+ Factory = local_storage_1.LocalStorage;
15
+ }
16
+ else if (storageType === "memory") {
17
+ Factory = memory_1.MemoryStorage;
18
+ }
19
+ else {
20
+ Factory = storageType;
21
+ }
22
+ storage = new Factory();
23
+ }
24
+ return storage;
25
+ }
26
+ exports.createStorage = createStorage;
27
+ exports.default = createStorage;
28
+ function getStorage() {
29
+ if (!storage) {
30
+ throw Error("You must create a storage system.");
31
+ }
32
+ return storage;
33
+ }
34
+ exports.getStorage = getStorage;
35
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../../src/lib/core/storage/index.ts"],"names":[],"mappings":";;;AAAA,qCAAyC;AACzC,mDAA+C;AAW/C,IAAI,OAAkC,CAAC;AAQvC;;GAEG;AACH,SAAgB,aAAa,CAC3B,cAA8B,QAAQ;IAEtC,IAAI,CAAC,OAAO,EAAE;QACZ,IAAI,OAAO,CAAC;QACZ,IAAI,WAAW,KAAK,cAAc,EAAE;YAClC,OAAO,GAAG,4BAAY,CAAC;SACxB;aAAM,IAAI,WAAW,KAAK,QAAQ,EAAE;YACnC,OAAO,GAAG,sBAAa,CAAC;SACzB;aAAM;YACL,OAAO,GAAG,WAAW,CAAC;SACvB;QACD,OAAO,GAAG,IAAI,OAAO,EAAE,CAAC;KACzB;IACD,OAAO,OAAO,CAAC;AACjB,CAAC;AAfD,sCAeC;AAED,kBAAe,aAAa,CAAC;AAE7B,SAAgB,UAAU;IACxB,IAAI,CAAC,OAAO,EAAE;QACZ,MAAM,KAAK,CAAC,mCAAmC,CAAC,CAAC;KAClD;IACD,OAAO,OAAO,CAAC;AACjB,CAAC;AALD,gCAKC"}
@@ -0,0 +1,8 @@
1
+ import { StorageSystem } from "./index";
2
+ export declare class LocalStorage implements StorageSystem {
3
+ get(key: string): any;
4
+ set(key: string, value: any): void;
5
+ remove(key: string): void;
6
+ clear(): void;
7
+ }
8
+ //# sourceMappingURL=local-storage.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"local-storage.d.ts","sourceRoot":"","sources":["../../../../../../src/lib/core/storage/local-storage.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,SAAS,CAAC;AAExC,qBAAa,YAAa,YAAW,aAAa;IAChD,GAAG,CAAC,GAAG,EAAE,MAAM;IAKf,GAAG,CAAC,GAAG,EAAE,MAAM,EAAE,KAAK,EAAE,GAAG;IAI3B,MAAM,CAAC,GAAG,EAAE,MAAM;IAIlB,KAAK;CAGN"}