@atlaskit/util-service-support 6.3.0 → 6.3.2

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/CHANGELOG.md CHANGED
@@ -1,5 +1,19 @@
1
1
  # @atlaskit/util-service-support
2
2
 
3
+ ## 6.3.2
4
+
5
+ ### Patch Changes
6
+
7
+ - Updated dependencies
8
+
9
+ ## 6.3.1
10
+
11
+ ### Patch Changes
12
+
13
+ - [#128616](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/pull-requests/128616)
14
+ [`6e9df3227a504`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/6e9df3227a504) -
15
+ Improve type safety of requestServiceMultipart API
16
+
3
17
  ## 6.3.0
4
18
 
5
19
  ### Minor Changes
@@ -4,7 +4,7 @@
4
4
  "declaration": true,
5
5
  "target": "es5",
6
6
  "composite": true,
7
- "outDir": "../dist",
7
+ "outDir": "../../../../../confluence/tsDist/@atlaskit__util-service-support",
8
8
  "rootDir": "../"
9
9
  },
10
10
  "include": [
@@ -0,0 +1,27 @@
1
+ {
2
+ "extends": "../../../../tsconfig.entry-points.townsquare.json",
3
+ "compilerOptions": {
4
+ "declaration": true,
5
+ "target": "es5",
6
+ "outDir": "../../../../../townsquare/tsDist/@atlaskit__util-service-support/app",
7
+ "rootDir": "../",
8
+ "composite": true
9
+ },
10
+ "include": [
11
+ "../src/**/*.ts",
12
+ "../src/**/*.tsx"
13
+ ],
14
+ "exclude": [
15
+ "../src/**/__tests__/*",
16
+ "../src/**/*.test.*",
17
+ "../src/**/test.*"
18
+ ],
19
+ "references": [
20
+ {
21
+ "path": "../../../platform/feature-flags/afm-townsquare/tsconfig.json"
22
+ },
23
+ {
24
+ "path": "../../../react-ufo/atlaskit/afm-townsquare/tsconfig.json"
25
+ }
26
+ ]
27
+ }
@@ -0,0 +1,27 @@
1
+ {
2
+ "extends": "../../../../tsconfig.entry-points.volt.json",
3
+ "compilerOptions": {
4
+ "declaration": true,
5
+ "target": "es5",
6
+ "outDir": "../../../../../volt/tsDist/@atlaskit__util-service-support/app",
7
+ "rootDir": "../",
8
+ "composite": true
9
+ },
10
+ "include": [
11
+ "../src/**/*.ts",
12
+ "../src/**/*.tsx"
13
+ ],
14
+ "exclude": [
15
+ "../src/**/__tests__/*",
16
+ "../src/**/*.test.*",
17
+ "../src/**/test.*"
18
+ ],
19
+ "references": [
20
+ {
21
+ "path": "../../../platform/feature-flags/afm-volt/tsconfig.json"
22
+ },
23
+ {
24
+ "path": "../../../react-ufo/atlaskit/afm-volt/tsconfig.json"
25
+ }
26
+ ]
27
+ }
package/dist/cjs/index.js CHANGED
@@ -35,7 +35,6 @@ Object.keys(_serviceResources).forEach(function (key) {
35
35
  });
36
36
  var serviceUtils = _interopRequireWildcard(require("./serviceUtils"));
37
37
  var multipartServiceUtils = _interopRequireWildcard(require("./multipartServiceUtils"));
38
- function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(e) { return e ? t : r; })(e); }
39
- function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != _typeof(e) && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && {}.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; }
38
+ function _interopRequireWildcard(e, t) { if ("function" == typeof WeakMap) var r = new WeakMap(), n = new WeakMap(); return (_interopRequireWildcard = function _interopRequireWildcard(e, t) { if (!t && e && e.__esModule) return e; var o, i, f = { __proto__: null, default: e }; if (null === e || "object" != _typeof(e) && "function" != typeof e) return f; if (o = t ? n : r) { if (o.has(e)) return o.get(e); o.set(e, f); } for (var _t in e) "default" !== _t && {}.hasOwnProperty.call(e, _t) && ((i = (o = Object.defineProperty) && Object.getOwnPropertyDescriptor(e, _t)) && (i.get || i.set) ? o(f, _t, i) : f[_t] = e[_t]); return f; })(e, t); }
40
39
  var utils = exports.utils = serviceUtils;
41
40
  var multipartUtils = exports.multipartUtils = multipartServiceUtils;
@@ -22,6 +22,11 @@ function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t =
22
22
  * Make a request that **may** result in an HTTP multipart response from the server.
23
23
  * @returns an object with a parsed JSON body OR an object with the parts from
24
24
  * the HTTP multipart response.
25
+ *
26
+ * PartsType type parameter specifies the type of the response when the server response
27
+ * is multipart.
28
+ *
29
+ * BodyType specifies the type of the response when the server response is not multipart
25
30
  */
26
31
  var _requestServiceMultipart = exports.requestServiceMultipart = /*#__PURE__*/function () {
27
32
  var _ref = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee(serviceConfig) {
@@ -11,6 +11,11 @@ import { getActiveTraceHttpRequestHeaders } from '@atlaskit/react-ufo/experience
11
11
  * Make a request that **may** result in an HTTP multipart response from the server.
12
12
  * @returns an object with a parsed JSON body OR an object with the parts from
13
13
  * the HTTP multipart response.
14
+ *
15
+ * PartsType type parameter specifies the type of the response when the server response
16
+ * is multipart.
17
+ *
18
+ * BodyType specifies the type of the response when the server response is not multipart
14
19
  */
15
20
  export const requestServiceMultipart = async (serviceConfig, options = defaultRequestServiceOptions) => {
16
21
  const {
@@ -53,7 +58,7 @@ export const requestServiceMultipart = async (serviceConfig, options = defaultRe
53
58
  if (parts[Symbol.asyncIterator] < 'u') {
54
59
  // this lets us know that the response is multipart
55
60
  //
56
- // ((parts as PartsType)[Symbol.asyncIterator] as any) < 'u' came from the `meros` docs:
61
+ // ((parts as PartsGenerator)[Symbol.asyncIterator] as any) < 'u' came from the `meros` docs:
57
62
  // https://github.com/maraisr/meros/blob/dec4feaa24090b94e8ac42fab1aff38a1e521680/readme.md
58
63
  // Look for expand section `If the content-type is NOT a multipart, then meros will resolve with the response argument.`
59
64
  return {
@@ -16,6 +16,11 @@ import { getActiveTraceHttpRequestHeaders } from '@atlaskit/react-ufo/experience
16
16
  * Make a request that **may** result in an HTTP multipart response from the server.
17
17
  * @returns an object with a parsed JSON body OR an object with the parts from
18
18
  * the HTTP multipart response.
19
+ *
20
+ * PartsType type parameter specifies the type of the response when the server response
21
+ * is multipart.
22
+ *
23
+ * BodyType specifies the type of the response when the server response is not multipart
19
24
  */
20
25
  var _requestServiceMultipart = /*#__PURE__*/function () {
21
26
  var _ref = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee(serviceConfig) {
@@ -4,3 +4,4 @@ import * as serviceUtils from './serviceUtils';
4
4
  import * as multipartServiceUtils from './multipartServiceUtils';
5
5
  export declare const utils: typeof serviceUtils;
6
6
  export declare const multipartUtils: typeof multipartServiceUtils;
7
+ export type { RequestServiceResult, PartsGenerator, MultiPartFetchResult, BodyResult, } from './multipartServiceUtils';
@@ -1,14 +1,14 @@
1
1
  import { type RequestServiceOptions, type ServiceConfig } from './types';
2
- type PartsType = AsyncGenerator<Part<object, string>, unknown, unknown>;
3
- type MultiPartFetchResult = {
2
+ export type PartsGenerator<PartsType> = AsyncGenerator<Part<PartsType, unknown>>;
3
+ export type MultiPartFetchResult<PartsType> = {
4
4
  isMultipart: true;
5
- parts: PartsType;
5
+ parts: PartsGenerator<PartsType>;
6
6
  };
7
- type BodyResult<T> = {
7
+ export type BodyResult<T> = {
8
8
  isMultipart: false;
9
9
  body: T;
10
10
  };
11
- type RequestServiceResult<BodyType> = MultiPartFetchResult | BodyResult<BodyType>;
11
+ export type RequestServiceResult<PartsType, BodyType> = MultiPartFetchResult<PartsType> | BodyResult<BodyType>;
12
12
  /** Copied from meros types, as there are difficulties with resolving the type in CI */
13
13
  export type Part<Body, Fallback> = {
14
14
  json: false;
@@ -24,6 +24,11 @@ type Options = Omit<RequestServiceOptions, 'ignoreResponsePayload'>;
24
24
  * Make a request that **may** result in an HTTP multipart response from the server.
25
25
  * @returns an object with a parsed JSON body OR an object with the parts from
26
26
  * the HTTP multipart response.
27
+ *
28
+ * PartsType type parameter specifies the type of the response when the server response
29
+ * is multipart.
30
+ *
31
+ * BodyType specifies the type of the response when the server response is not multipart
27
32
  */
28
- export declare const requestServiceMultipart: <T>(serviceConfig: ServiceConfig, options?: Options) => Promise<RequestServiceResult<T>>;
33
+ export declare const requestServiceMultipart: <PartsType, BodyType>(serviceConfig: ServiceConfig, options?: Options) => Promise<RequestServiceResult<PartsType, BodyType>>;
29
34
  export {};
@@ -4,3 +4,4 @@ import * as serviceUtils from './serviceUtils';
4
4
  import * as multipartServiceUtils from './multipartServiceUtils';
5
5
  export declare const utils: typeof serviceUtils;
6
6
  export declare const multipartUtils: typeof multipartServiceUtils;
7
+ export type { RequestServiceResult, PartsGenerator, MultiPartFetchResult, BodyResult, } from './multipartServiceUtils';
@@ -1,14 +1,14 @@
1
1
  import { type RequestServiceOptions, type ServiceConfig } from './types';
2
- type PartsType = AsyncGenerator<Part<object, string>, unknown, unknown>;
3
- type MultiPartFetchResult = {
2
+ export type PartsGenerator<PartsType> = AsyncGenerator<Part<PartsType, unknown>>;
3
+ export type MultiPartFetchResult<PartsType> = {
4
4
  isMultipart: true;
5
- parts: PartsType;
5
+ parts: PartsGenerator<PartsType>;
6
6
  };
7
- type BodyResult<T> = {
7
+ export type BodyResult<T> = {
8
8
  isMultipart: false;
9
9
  body: T;
10
10
  };
11
- type RequestServiceResult<BodyType> = MultiPartFetchResult | BodyResult<BodyType>;
11
+ export type RequestServiceResult<PartsType, BodyType> = MultiPartFetchResult<PartsType> | BodyResult<BodyType>;
12
12
  /** Copied from meros types, as there are difficulties with resolving the type in CI */
13
13
  export type Part<Body, Fallback> = {
14
14
  json: false;
@@ -24,6 +24,11 @@ type Options = Omit<RequestServiceOptions, 'ignoreResponsePayload'>;
24
24
  * Make a request that **may** result in an HTTP multipart response from the server.
25
25
  * @returns an object with a parsed JSON body OR an object with the parts from
26
26
  * the HTTP multipart response.
27
+ *
28
+ * PartsType type parameter specifies the type of the response when the server response
29
+ * is multipart.
30
+ *
31
+ * BodyType specifies the type of the response when the server response is not multipart
27
32
  */
28
- export declare const requestServiceMultipart: <T>(serviceConfig: ServiceConfig, options?: Options) => Promise<RequestServiceResult<T>>;
33
+ export declare const requestServiceMultipart: <PartsType, BodyType>(serviceConfig: ServiceConfig, options?: Options) => Promise<RequestServiceResult<PartsType, BodyType>>;
29
34
  export {};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@atlaskit/util-service-support",
3
- "version": "6.3.0",
3
+ "version": "6.3.2",
4
4
  "description": "A library of support classes for integrating React components with REST HTTP services",
5
5
  "publishConfig": {
6
6
  "registry": "https://registry.npmjs.org/"
@@ -35,7 +35,7 @@
35
35
  },
36
36
  "dependencies": {
37
37
  "@atlaskit/platform-feature-flags": "^1.1.0",
38
- "@atlaskit/react-ufo": "^3.4.0",
38
+ "@atlaskit/react-ufo": "^4.0.0",
39
39
  "@babel/runtime": "^7.0.0",
40
40
  "meros": "^1.3.0"
41
41
  },