@atlaskit/util-service-support 6.2.1 → 6.2.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 +12 -0
- package/dist/types-ts4.5/index.d.ts +4 -0
- package/dist/types-ts4.5/serviceResources.d.ts +12 -0
- package/dist/types-ts4.5/serviceUtils.d.ts +5 -0
- package/dist/types-ts4.5/types.d.ts +80 -0
- package/package.json +2 -3
- package/dist/cjs/version.json +0 -4
- package/dist/es2019/version.json +0 -4
- package/dist/esm/version.json +0 -4
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,17 @@
|
|
|
1
1
|
# @atlaskit/util-service-support
|
|
2
2
|
|
|
3
|
+
## 6.2.3
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- [`fd6bb9c9184`](https://bitbucket.org/atlassian/atlassian-frontend/commits/fd6bb9c9184) - Delete version.json
|
|
8
|
+
|
|
9
|
+
## 6.2.2
|
|
10
|
+
|
|
11
|
+
### Patch Changes
|
|
12
|
+
|
|
13
|
+
- [`9d00501a414`](https://bitbucket.org/atlassian/atlassian-frontend/commits/9d00501a414) - Ensure legacy types are published for TS 4.5-4.8
|
|
14
|
+
|
|
3
15
|
## 6.2.1
|
|
4
16
|
|
|
5
17
|
### Patch Changes
|
|
@@ -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) => "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.
|
|
3
|
+
"version": "6.2.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/"
|
|
@@ -33,7 +33,6 @@
|
|
|
33
33
|
"@babel/runtime": "^7.0.0"
|
|
34
34
|
},
|
|
35
35
|
"devDependencies": {
|
|
36
|
-
"@atlaskit/docs": "*",
|
|
37
36
|
"@atlassian/atlassian-frontend-prettier-config-1.0.0": "npm:@atlassian/atlassian-frontend-prettier-config@1.0.0",
|
|
38
37
|
"es6-promise": "^4.0.5",
|
|
39
38
|
"fetch-mock": "^8.0.0",
|
|
@@ -51,4 +50,4 @@
|
|
|
51
50
|
}
|
|
52
51
|
},
|
|
53
52
|
"prettier": "@atlassian/atlassian-frontend-prettier-config-1.0.0"
|
|
54
|
-
}
|
|
53
|
+
}
|
package/dist/cjs/version.json
DELETED
package/dist/es2019/version.json
DELETED
package/dist/esm/version.json
DELETED