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