@atlaskit/util-service-support 6.2.0 → 6.2.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,17 @@
1
1
  # @atlaskit/util-service-support
2
2
 
3
+ ## 6.2.2
4
+
5
+ ### Patch Changes
6
+
7
+ - [`9d00501a414`](https://bitbucket.org/atlassian/atlassian-frontend/commits/9d00501a414) - Ensure legacy types are published for TS 4.5-4.8
8
+
9
+ ## 6.2.1
10
+
11
+ ### Patch Changes
12
+
13
+ - [`41fae2c6f68`](https://bitbucket.org/atlassian/atlassian-frontend/commits/41fae2c6f68) - Upgrade Typescript from `4.5.5` to `4.9.5`
14
+
3
15
  ## 6.2.0
4
16
 
5
17
  ### Minor Changes
@@ -1,4 +1,4 @@
1
1
  {
2
2
  "name": "@atlaskit/util-service-support",
3
- "version": "6.2.0"
3
+ "version": "6.2.2"
4
4
  }
@@ -1,4 +1,4 @@
1
1
  {
2
2
  "name": "@atlaskit/util-service-support",
3
- "version": "6.2.0"
3
+ "version": "6.2.2"
4
4
  }
@@ -1,4 +1,4 @@
1
1
  {
2
2
  "name": "@atlaskit/util-service-support",
3
- "version": "6.2.0"
3
+ "version": "6.2.2"
4
4
  }
@@ -2,4 +2,4 @@ import { RequestServiceOptions, ServiceConfig } from './types';
2
2
  /**
3
3
  * @returns Promise containing the json response
4
4
  */
5
- export declare const requestService: <T>(serviceConfig: ServiceConfig, options?: RequestServiceOptions | undefined) => Promise<T>;
5
+ export declare const requestService: <T>(serviceConfig: ServiceConfig, options?: RequestServiceOptions) => Promise<T>;
@@ -53,7 +53,7 @@ export interface SecurityOptions {
53
53
  headers?: KeyValues;
54
54
  omitCredentials?: boolean;
55
55
  }
56
- export declare const buildCredentials: (secOptions?: SecurityOptions | undefined) => "omit" | "include";
56
+ export declare const buildCredentials: (secOptions?: SecurityOptions) => "omit" | "include";
57
57
  /**
58
58
  * Returns a promise to a SecurityOptions that has just been forcibly refreshed with a
59
59
  * new token. Will be used for single retry per request if a 401 is returned.
@@ -0,0 +1,4 @@
1
+ export * from './types';
2
+ export * from './serviceResources';
3
+ import * as serviceUtils from './serviceUtils';
4
+ export declare const utils: typeof serviceUtils;
@@ -0,0 +1,12 @@
1
+ import { OnProviderChange, Provider } from './types';
2
+ export declare abstract class AbstractResource<Q, R, E, I, O> implements Provider<Q, R, E, I, O> {
3
+ private lastResult;
4
+ private listeners;
5
+ abstract filter(query?: Q, options?: O): void;
6
+ subscribe(onChange: OnProviderChange<R, E, I>): void;
7
+ unsubscribe(onChange: OnProviderChange<R, E, I>): void;
8
+ protected notifyResult(result: R): void;
9
+ protected notifyError(error: E): void;
10
+ protected notifyInfo(info: I): void;
11
+ protected notifyNotReady(): void;
12
+ }
@@ -0,0 +1,5 @@
1
+ import { RequestServiceOptions, ServiceConfig } from './types';
2
+ /**
3
+ * @returns Promise containing the json response
4
+ */
5
+ export declare const requestService: <T>(serviceConfig: ServiceConfig, options?: RequestServiceOptions) => Promise<T>;
@@ -0,0 +1,80 @@
1
+ export interface OnProviderChange<R, E, I> {
2
+ /**
3
+ * Normal callback on a search result, or updated search result.
4
+ */
5
+ result(result: R): void;
6
+ /**
7
+ * When something goes wrong, e.g. underlying service is not available.
8
+ */
9
+ error?(error: E): void;
10
+ /**
11
+ * Information to display, e.g. due to slow searches, initial message, etc.
12
+ */
13
+ info?(info: I): void;
14
+ /**
15
+ * Notifies if the Resource is not ready and won't respond to searches
16
+ * in a timely manner. Note searches that occur while not ready Will
17
+ * eventually be fulfilled.
18
+ */
19
+ notReady?(): void;
20
+ }
21
+ /**
22
+ * Defines a typical Resource.
23
+ *
24
+ * Q = query type
25
+ * R = result type
26
+ * E = error type
27
+ * I = info type
28
+ * O = options that filter can accept
29
+ */
30
+ export interface Provider<Q, R, E, I, O> {
31
+ /**
32
+ * Results are returned to the OnSearchResult
33
+ * in the subscriber.
34
+ *
35
+ * There may not be a 1-on-1 relationship between a search
36
+ * and a callback.
37
+ *
38
+ * For example, multiple queries may result in one callback if the
39
+ * responses are out of order (i.e. old responses are dropped). Or
40
+ * multiple callbacks may be fired, for example if the underlying data
41
+ * set to search has changed, the last search may be executed again
42
+ * with updated results.
43
+ */
44
+ filter(query?: Q, options?: O): void;
45
+ subscribe(onChange: OnProviderChange<R, E, I>): void;
46
+ unsubscribe(onChange: OnProviderChange<R, E, I>): void;
47
+ }
48
+ export interface KeyValues {
49
+ [index: string]: any;
50
+ }
51
+ export interface SecurityOptions {
52
+ params?: KeyValues;
53
+ headers?: KeyValues;
54
+ omitCredentials?: boolean;
55
+ }
56
+ export declare const buildCredentials: (secOptions?: SecurityOptions) => "omit" | "include";
57
+ /**
58
+ * Returns a promise to a SecurityOptions that has just been forcibly refreshed with a
59
+ * new token. Will be used for single retry per request if a 401 is returned.
60
+ */
61
+ export interface RefreshSecurityProvider {
62
+ (): Promise<SecurityOptions>;
63
+ }
64
+ /**
65
+ * Returns the current SecurityOptions for the mentions service.
66
+ */
67
+ export interface SecurityProvider {
68
+ (): SecurityOptions;
69
+ }
70
+ export interface ServiceConfig {
71
+ url: string;
72
+ securityProvider?: SecurityProvider;
73
+ refreshedSecurityProvider?: RefreshSecurityProvider;
74
+ }
75
+ export interface RequestServiceOptions {
76
+ path?: string;
77
+ queryParams?: KeyValues;
78
+ requestInit?: RequestInit;
79
+ ignoreResponsePayload?: boolean;
80
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@atlaskit/util-service-support",
3
- "version": "6.2.0",
3
+ "version": "6.2.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/"
@@ -12,6 +12,14 @@
12
12
  "module": "dist/esm/index.js",
13
13
  "module:es2019": "dist/es2019/index.js",
14
14
  "types": "dist/types/index.d.ts",
15
+ "typesVersions": {
16
+ ">=4.5 <4.9": {
17
+ "*": [
18
+ "dist/types-ts4.5/*",
19
+ "dist/types-ts4.5/index.d.ts"
20
+ ]
21
+ }
22
+ },
15
23
  "atlaskit:src": "src/index.ts",
16
24
  "atlassian": {
17
25
  "deprecatedAutoEntryPoints": true,
@@ -30,7 +38,7 @@
30
38
  "es6-promise": "^4.0.5",
31
39
  "fetch-mock": "^8.0.0",
32
40
  "sinon": "^2.2.0",
33
- "typescript": "4.5.5"
41
+ "typescript": "~4.9.5"
34
42
  },
35
43
  "keywords": [
36
44
  "fabric",
package/report.api.md CHANGED
@@ -37,7 +37,7 @@ export abstract class AbstractResource<Q, R, E, I, O>
37
37
 
38
38
  // @public (undocumented)
39
39
  export const buildCredentials: (
40
- secOptions?: SecurityOptions | undefined,
40
+ secOptions?: SecurityOptions,
41
41
  ) => 'include' | 'omit';
42
42
 
43
43
  // @public (undocumented)
@@ -72,7 +72,7 @@ export interface RefreshSecurityProvider {
72
72
  // @public (undocumented)
73
73
  const requestService: <T>(
74
74
  serviceConfig: ServiceConfig,
75
- options?: RequestServiceOptions | undefined,
75
+ options?: RequestServiceOptions,
76
76
  ) => Promise<T>;
77
77
 
78
78
  // @public (undocumented)
@@ -5,9 +5,9 @@
5
5
  "module:es2019": "../dist/es2019/serviceResources.js",
6
6
  "types": "../dist/types/serviceResources.d.ts",
7
7
  "typesVersions": {
8
- ">=4.0 <4.5": {
8
+ ">=4.5 <4.9": {
9
9
  "*": [
10
- "../dist/types-ts4.0/serviceResources.d.ts"
10
+ "../dist/types-ts4.5/serviceResources.d.ts"
11
11
  ]
12
12
  }
13
13
  }
@@ -5,9 +5,9 @@
5
5
  "module:es2019": "../dist/es2019/serviceUtils.js",
6
6
  "types": "../dist/types/serviceUtils.d.ts",
7
7
  "typesVersions": {
8
- ">=4.0 <4.5": {
8
+ ">=4.5 <4.9": {
9
9
  "*": [
10
- "../dist/types-ts4.0/serviceUtils.d.ts"
10
+ "../dist/types-ts4.5/serviceUtils.d.ts"
11
11
  ]
12
12
  }
13
13
  }
@@ -0,0 +1,109 @@
1
+ ## API Report File for "@atlaskit/util-service-support"
2
+
3
+ > Do not edit this file. It is a report generated by [API Extractor](https://api-extractor.com/).
4
+
5
+ ```ts
6
+
7
+ // @public (undocumented)
8
+ export abstract class AbstractResource<Q, R, E, I, O> implements Provider<Q, R, E, I, O> {
9
+ // (undocumented)
10
+ abstract filter(query?: Q, options?: O): void;
11
+ // (undocumented)
12
+ protected notifyError(error: E): void;
13
+ // (undocumented)
14
+ protected notifyInfo(info: I): void;
15
+ // (undocumented)
16
+ protected notifyNotReady(): void;
17
+ // (undocumented)
18
+ protected notifyResult(result: R): void;
19
+ // (undocumented)
20
+ subscribe(onChange: OnProviderChange<R, E, I>): void;
21
+ // (undocumented)
22
+ unsubscribe(onChange: OnProviderChange<R, E, I>): void;
23
+ }
24
+
25
+ // @public (undocumented)
26
+ export const buildCredentials: (secOptions?: SecurityOptions) => "include" | "omit";
27
+
28
+ // @public (undocumented)
29
+ export interface KeyValues {
30
+ // (undocumented)
31
+ [index: string]: any;
32
+ }
33
+
34
+ // @public (undocumented)
35
+ export interface OnProviderChange<R, E, I> {
36
+ error?(error: E): void;
37
+ info?(info: I): void;
38
+ notReady?(): void;
39
+ result(result: R): void;
40
+ }
41
+
42
+ // @public
43
+ export interface Provider<Q, R, E, I, O> {
44
+ filter(query?: Q, options?: O): void;
45
+ // (undocumented)
46
+ subscribe(onChange: OnProviderChange<R, E, I>): void;
47
+ // (undocumented)
48
+ unsubscribe(onChange: OnProviderChange<R, E, I>): void;
49
+ }
50
+
51
+ // @public
52
+ export interface RefreshSecurityProvider {
53
+ // (undocumented)
54
+ (): Promise<SecurityOptions>;
55
+ }
56
+
57
+ // @public (undocumented)
58
+ const requestService: <T>(serviceConfig: ServiceConfig, options?: RequestServiceOptions) => Promise<T>;
59
+
60
+ // @public (undocumented)
61
+ export interface RequestServiceOptions {
62
+ // (undocumented)
63
+ ignoreResponsePayload?: boolean;
64
+ // (undocumented)
65
+ path?: string;
66
+ // (undocumented)
67
+ queryParams?: KeyValues;
68
+ // (undocumented)
69
+ requestInit?: RequestInit;
70
+ }
71
+
72
+ // @public (undocumented)
73
+ export interface SecurityOptions {
74
+ // (undocumented)
75
+ headers?: KeyValues;
76
+ // (undocumented)
77
+ omitCredentials?: boolean;
78
+ // (undocumented)
79
+ params?: KeyValues;
80
+ }
81
+
82
+ // @public
83
+ export interface SecurityProvider {
84
+ // (undocumented)
85
+ (): SecurityOptions;
86
+ }
87
+
88
+ // @public (undocumented)
89
+ export interface ServiceConfig {
90
+ // (undocumented)
91
+ refreshedSecurityProvider?: RefreshSecurityProvider;
92
+ // (undocumented)
93
+ securityProvider?: SecurityProvider;
94
+ // (undocumented)
95
+ url: string;
96
+ }
97
+
98
+ declare namespace serviceUtils {
99
+ export {
100
+ requestService
101
+ }
102
+ }
103
+
104
+ // @public (undocumented)
105
+ export const utils: typeof serviceUtils;
106
+
107
+ // (No @packageDocumentation comment for this package)
108
+
109
+ ```
@@ -5,9 +5,9 @@
5
5
  "module:es2019": "../dist/es2019/types.js",
6
6
  "types": "../dist/types/types.d.ts",
7
7
  "typesVersions": {
8
- ">=4.0 <4.5": {
8
+ ">=4.5 <4.9": {
9
9
  "*": [
10
- "../dist/types-ts4.0/types.d.ts"
10
+ "../dist/types-ts4.5/types.d.ts"
11
11
  ]
12
12
  }
13
13
  }