@wireapp/api-client 16.6.1 → 18.0.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.
- package/CHANGELOG.md +54 -0
- package/package.json +6 -6
- package/src/APIClient.d.ts +52 -77
- package/src/APIClient.js +72 -78
- package/src/APIClient.js.map +1 -1
- package/src/auth/AuthAPI.js +13 -1
- package/src/auth/AuthAPI.js.map +1 -1
- package/src/auth/LoginData.d.ts +1 -0
- package/src/auth/VerificationActionType.d.ts +4 -0
- package/src/auth/VerificationActionType.js +27 -0
- package/src/auth/VerificationActionType.js.map +1 -0
- package/src/connection/ConnectionAPI.d.ts +7 -9
- package/src/connection/ConnectionAPI.js +25 -9
- package/src/connection/ConnectionAPI.js.map +1 -1
- package/src/conversation/Conversation.d.ts +8 -0
- package/src/conversation/Conversation.js +8 -1
- package/src/conversation/Conversation.js.map +1 -1
- package/src/conversation/ConversationAPI.d.ts +11 -16
- package/src/conversation/ConversationAPI.js +23 -25
- package/src/conversation/ConversationAPI.js.map +1 -1
- package/src/conversation/NewConversation.d.ts +1 -1
- package/src/conversation/data/ConversationAccessUpdateData.d.ts +6 -1
- package/src/team/scim/ScimAPI.d.ts +1 -1
- package/src/team/scim/ScimAPI.js +2 -2
- package/src/team/scim/ScimAPI.js.map +1 -1
- package/src/user/UserAPI.d.ts +14 -8
- package/src/user/UserAPI.js +39 -7
- package/src/user/UserAPI.js.map +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -3,6 +3,60 @@
|
|
|
3
3
|
All notable changes to this project will be documented in this file.
|
|
4
4
|
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
|
|
5
5
|
|
|
6
|
+
# [18.0.0](https://github.com/wireapp/wire-web-packages/tree/main/packages/api-client/compare/@wireapp/api-client@17.0.0...@wireapp/api-client@18.0.0) (2022-02-22)
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
### Features
|
|
10
|
+
|
|
11
|
+
* **api-client:** Allow setting a backend version ([#4226](https://github.com/wireapp/wire-web-packages/tree/main/packages/api-client/issues/4226)) ([7cda792](https://github.com/wireapp/wire-web-packages/tree/main/packages/api-client/commit/7cda792e98ebcf4317dc165d9e027654fb11b78f))
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
### BREAKING CHANGES
|
|
15
|
+
|
|
16
|
+
* **api-client:** All the methods that were using useFederation do not need this parameter anymore (since the federation state is guessed from the api version number)
|
|
17
|
+
|
|
18
|
+
|
|
19
|
+
|
|
20
|
+
|
|
21
|
+
|
|
22
|
+
# [17.0.0](https://github.com/wireapp/wire-web-packages/tree/main/packages/api-client/compare/@wireapp/api-client@16.8.0...@wireapp/api-client@17.0.0) (2022-02-21)
|
|
23
|
+
|
|
24
|
+
|
|
25
|
+
### Code Refactoring
|
|
26
|
+
|
|
27
|
+
* **api-client:** Move all the specific apis to an `api` namespace of the ApiClient ([#4228](https://github.com/wireapp/wire-web-packages/tree/main/packages/api-client/issues/4228)) ([d18b348](https://github.com/wireapp/wire-web-packages/tree/main/packages/api-client/commit/d18b34841822eea20114d99db67dc376b1311f15))
|
|
28
|
+
|
|
29
|
+
|
|
30
|
+
### BREAKING CHANGES
|
|
31
|
+
|
|
32
|
+
* **api-client:** All the specific api accessible from the apiClient have moved from `apiClient.<specificApi>.api` to `apiClient.api.<specificApi>` (eg. `apiClient.user.api` needs to be replaced with `apiClient.api.user`)
|
|
33
|
+
|
|
34
|
+
|
|
35
|
+
|
|
36
|
+
|
|
37
|
+
|
|
38
|
+
# [16.8.0](https://github.com/wireapp/wire-web-packages/tree/main/packages/api-client/compare/@wireapp/api-client@16.7.0...@wireapp/api-client@16.8.0) (2022-02-17)
|
|
39
|
+
|
|
40
|
+
|
|
41
|
+
### Features
|
|
42
|
+
|
|
43
|
+
* **api-client:** adding 2-factor verification codes ([#4225](https://github.com/wireapp/wire-web-packages/tree/main/packages/api-client/issues/4225)) ([459339d](https://github.com/wireapp/wire-web-packages/tree/main/packages/api-client/commit/459339d4f6aa8521686f9ac83a2f748b05dfa1c3))
|
|
44
|
+
|
|
45
|
+
|
|
46
|
+
|
|
47
|
+
|
|
48
|
+
|
|
49
|
+
# [16.7.0](https://github.com/wireapp/wire-web-packages/tree/main/packages/api-client/compare/@wireapp/api-client@16.6.1...@wireapp/api-client@16.7.0) (2022-02-01)
|
|
50
|
+
|
|
51
|
+
|
|
52
|
+
### Features
|
|
53
|
+
|
|
54
|
+
* **api-client:** adding access role v2 ([#4221](https://github.com/wireapp/wire-web-packages/tree/main/packages/api-client/issues/4221)) ([755c90e](https://github.com/wireapp/wire-web-packages/tree/main/packages/api-client/commit/755c90e0e847205a1c701477b2fdb3b659b2ece5))
|
|
55
|
+
|
|
56
|
+
|
|
57
|
+
|
|
58
|
+
|
|
59
|
+
|
|
6
60
|
## [16.6.1](https://github.com/wireapp/wire-web-packages/tree/main/packages/api-client/compare/@wireapp/api-client@16.6.0...@wireapp/api-client@16.6.1) (2022-02-01)
|
|
7
61
|
|
|
8
62
|
|
package/package.json
CHANGED
|
@@ -8,7 +8,7 @@
|
|
|
8
8
|
"@types/spark-md5": "3.0.2",
|
|
9
9
|
"@types/tough-cookie": "4.0.1",
|
|
10
10
|
"@wireapp/commons": "4.2.13",
|
|
11
|
-
"@wireapp/priority-queue": "1.6.
|
|
11
|
+
"@wireapp/priority-queue": "1.6.38",
|
|
12
12
|
"@wireapp/protocol-messaging": "1.37.0",
|
|
13
13
|
"axios": "0.21.4",
|
|
14
14
|
"axios-retry": "3.1.9",
|
|
@@ -30,8 +30,8 @@
|
|
|
30
30
|
"@types/karma": "6.3.1",
|
|
31
31
|
"@types/ws": "7.4.7",
|
|
32
32
|
"@wireapp/react-ui-kit": "7.55.0",
|
|
33
|
-
"@wireapp/store-engine": "4.9.
|
|
34
|
-
"@wireapp/store-engine-fs": "2.4.
|
|
33
|
+
"@wireapp/store-engine": "4.9.8",
|
|
34
|
+
"@wireapp/store-engine-fs": "2.4.8",
|
|
35
35
|
"babel-loader": "8.2.2",
|
|
36
36
|
"browser-sync": "2.27.5",
|
|
37
37
|
"concurrently": "6.2.0",
|
|
@@ -39,7 +39,7 @@
|
|
|
39
39
|
"dotenv": "10.0.0",
|
|
40
40
|
"istanbul": "1.1.0-alpha.1",
|
|
41
41
|
"jasmine": "3.8.0",
|
|
42
|
-
"karma": "6.3.
|
|
42
|
+
"karma": "6.3.14",
|
|
43
43
|
"karma-chrome-launcher": "3.1.0",
|
|
44
44
|
"karma-jasmine": "4.0.1",
|
|
45
45
|
"karma-jasmine-diff-reporter": "2.0.1",
|
|
@@ -90,6 +90,6 @@
|
|
|
90
90
|
"test:types": "tsc --noEmit",
|
|
91
91
|
"watch": "webpack serve --config webpack.browser.js"
|
|
92
92
|
},
|
|
93
|
-
"version": "
|
|
94
|
-
"gitHead": "
|
|
93
|
+
"version": "18.0.0",
|
|
94
|
+
"gitHead": "60af9b22cf064dec167da40a7e14c8edc8b13aa8"
|
|
95
95
|
}
|
package/src/APIClient.d.ts
CHANGED
|
@@ -30,85 +30,45 @@ export interface APIClient {
|
|
|
30
30
|
on(event: TOPIC.COOKIE_REFRESH, listener: (cookie?: Cookie) => void): this;
|
|
31
31
|
on(event: TOPIC.ACCESS_TOKEN_REFRESH, listener: (accessToken: AccessTokenData) => void): this;
|
|
32
32
|
}
|
|
33
|
+
declare type Apis = {
|
|
34
|
+
account: AccountAPI;
|
|
35
|
+
asset: AssetAPI;
|
|
36
|
+
auth: AuthAPI;
|
|
37
|
+
broadcast: BroadcastAPI;
|
|
38
|
+
client: ClientAPI;
|
|
39
|
+
connection: ConnectionAPI;
|
|
40
|
+
conversation: ConversationAPI;
|
|
41
|
+
giphy: GiphyAPI;
|
|
42
|
+
notification: NotificationAPI;
|
|
43
|
+
self: SelfAPI;
|
|
44
|
+
services: ServicesAPI;
|
|
45
|
+
serviceProvider: ServiceProviderAPI;
|
|
46
|
+
teams: {
|
|
47
|
+
conversation: TeamConversationAPI;
|
|
48
|
+
feature: FeatureAPI;
|
|
49
|
+
identityProvider: IdentityProviderAPI;
|
|
50
|
+
invitation: TeamInvitationAPI;
|
|
51
|
+
legalhold: LegalHoldAPI;
|
|
52
|
+
member: MemberAPI;
|
|
53
|
+
payment: PaymentAPI;
|
|
54
|
+
billing: BillingAPI;
|
|
55
|
+
scim: ScimAPI;
|
|
56
|
+
search: TeamSearchAPI;
|
|
57
|
+
service: ServiceAPI;
|
|
58
|
+
team: TeamAPI;
|
|
59
|
+
};
|
|
60
|
+
user: UserAPI;
|
|
61
|
+
};
|
|
62
|
+
/** map of all the features that the backend supports (depending on the backend api version number) */
|
|
63
|
+
export declare type BackendFeatures = {
|
|
64
|
+
/** Does the backend API support federated endpoints */
|
|
65
|
+
federationEndpoints: boolean;
|
|
66
|
+
/** Is the backend actually talking to other federated domains */
|
|
67
|
+
isFederated: boolean;
|
|
68
|
+
};
|
|
33
69
|
export declare class APIClient extends EventEmitter {
|
|
34
70
|
private readonly logger;
|
|
35
|
-
|
|
36
|
-
api: AccountAPI;
|
|
37
|
-
};
|
|
38
|
-
asset: {
|
|
39
|
-
api: AssetAPI;
|
|
40
|
-
};
|
|
41
|
-
auth: {
|
|
42
|
-
api: AuthAPI;
|
|
43
|
-
};
|
|
44
|
-
broadcast: {
|
|
45
|
-
api: BroadcastAPI;
|
|
46
|
-
};
|
|
47
|
-
client: {
|
|
48
|
-
api: ClientAPI;
|
|
49
|
-
};
|
|
50
|
-
connection: {
|
|
51
|
-
api: ConnectionAPI;
|
|
52
|
-
};
|
|
53
|
-
conversation: {
|
|
54
|
-
api: ConversationAPI;
|
|
55
|
-
};
|
|
56
|
-
giphy: {
|
|
57
|
-
api: GiphyAPI;
|
|
58
|
-
};
|
|
59
|
-
notification: {
|
|
60
|
-
api: NotificationAPI;
|
|
61
|
-
};
|
|
62
|
-
self: {
|
|
63
|
-
api: SelfAPI;
|
|
64
|
-
};
|
|
65
|
-
services: {
|
|
66
|
-
api: ServicesAPI;
|
|
67
|
-
};
|
|
68
|
-
serviceProvider: {
|
|
69
|
-
api: ServiceProviderAPI;
|
|
70
|
-
};
|
|
71
|
-
teams: {
|
|
72
|
-
conversation: {
|
|
73
|
-
api: TeamConversationAPI;
|
|
74
|
-
};
|
|
75
|
-
feature: {
|
|
76
|
-
api: FeatureAPI;
|
|
77
|
-
};
|
|
78
|
-
identityProvider: {
|
|
79
|
-
api: IdentityProviderAPI;
|
|
80
|
-
};
|
|
81
|
-
invitation: {
|
|
82
|
-
api: TeamInvitationAPI;
|
|
83
|
-
};
|
|
84
|
-
legalhold: {
|
|
85
|
-
api: LegalHoldAPI;
|
|
86
|
-
};
|
|
87
|
-
member: {
|
|
88
|
-
api: MemberAPI;
|
|
89
|
-
};
|
|
90
|
-
payment: {
|
|
91
|
-
api: PaymentAPI;
|
|
92
|
-
};
|
|
93
|
-
billing: {
|
|
94
|
-
api: BillingAPI;
|
|
95
|
-
};
|
|
96
|
-
scim: {
|
|
97
|
-
api: ScimAPI;
|
|
98
|
-
};
|
|
99
|
-
search: {
|
|
100
|
-
api: TeamSearchAPI;
|
|
101
|
-
};
|
|
102
|
-
service: {
|
|
103
|
-
api: ServiceAPI;
|
|
104
|
-
};
|
|
105
|
-
team: {
|
|
106
|
-
api: TeamAPI;
|
|
107
|
-
};
|
|
108
|
-
};
|
|
109
|
-
user: {
|
|
110
|
-
api: UserAPI;
|
|
111
|
-
};
|
|
71
|
+
api: Apis;
|
|
112
72
|
private readonly accessTokenStore;
|
|
113
73
|
context?: Context;
|
|
114
74
|
transport: {
|
|
@@ -116,6 +76,7 @@ export declare class APIClient extends EventEmitter {
|
|
|
116
76
|
ws: WebSocketClient;
|
|
117
77
|
};
|
|
118
78
|
config: Config;
|
|
79
|
+
backendFeatures: BackendFeatures;
|
|
119
80
|
static BACKEND: {
|
|
120
81
|
PRODUCTION: import("./env/Backend").BackendData;
|
|
121
82
|
STAGING: import("./env/Backend").BackendData;
|
|
@@ -123,6 +84,20 @@ export declare class APIClient extends EventEmitter {
|
|
|
123
84
|
static readonly TOPIC: typeof TOPIC;
|
|
124
85
|
static VERSION: string;
|
|
125
86
|
constructor(config?: Config);
|
|
87
|
+
private configureApis;
|
|
88
|
+
/**
|
|
89
|
+
* Will compute all the capabilities of the backend API according to the selected version and the version response payload
|
|
90
|
+
* @param backendVersion The agreed used version between the client and the backend
|
|
91
|
+
* @param responsePayload? The response from the server
|
|
92
|
+
*/
|
|
93
|
+
private computeBackendFeatures;
|
|
94
|
+
/**
|
|
95
|
+
* Will set the APIClient to use a specific version of the API (by default uses version 0)
|
|
96
|
+
* It will fetch the API Config and use the highest possible version
|
|
97
|
+
* @param acceptedVersions Which version the consumer supports
|
|
98
|
+
* @return The highest version that is both supported by client and backend
|
|
99
|
+
*/
|
|
100
|
+
useVersion(acceptedVersions: number[]): Promise<number>;
|
|
126
101
|
init(clientType?: ClientType, cookie?: Cookie): Promise<Context>;
|
|
127
102
|
login(loginData: LoginData): Promise<Context>;
|
|
128
103
|
loginWithToken(accessTokenString: string, clientType?: ClientType): Promise<Context>;
|
package/src/APIClient.js
CHANGED
|
@@ -85,84 +85,78 @@ class APIClient extends events_1.EventEmitter {
|
|
|
85
85
|
http: httpClient,
|
|
86
86
|
ws: webSocket,
|
|
87
87
|
};
|
|
88
|
-
this.
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
this.self = {
|
|
119
|
-
api: new self_1.SelfAPI(this.transport.http),
|
|
120
|
-
};
|
|
121
|
-
this.serviceProvider = {
|
|
122
|
-
api: new serviceProvider_1.ServiceProviderAPI(this.transport.http),
|
|
123
|
-
};
|
|
124
|
-
this.teams = {
|
|
125
|
-
conversation: {
|
|
126
|
-
api: new team_1.TeamConversationAPI(this.transport.http),
|
|
127
|
-
},
|
|
128
|
-
feature: {
|
|
129
|
-
api: new team_1.FeatureAPI(this.transport.http),
|
|
130
|
-
},
|
|
131
|
-
identityProvider: {
|
|
132
|
-
api: new team_1.IdentityProviderAPI(this.transport.http),
|
|
133
|
-
},
|
|
134
|
-
invitation: {
|
|
135
|
-
api: new team_1.TeamInvitationAPI(this.transport.http),
|
|
136
|
-
},
|
|
137
|
-
legalhold: {
|
|
138
|
-
api: new team_1.LegalHoldAPI(this.transport.http),
|
|
139
|
-
},
|
|
140
|
-
member: {
|
|
141
|
-
api: new team_1.MemberAPI(this.transport.http),
|
|
142
|
-
},
|
|
143
|
-
payment: {
|
|
144
|
-
api: new team_1.PaymentAPI(this.transport.http),
|
|
145
|
-
},
|
|
146
|
-
billing: {
|
|
147
|
-
api: new team_1.BillingAPI(this.transport.http),
|
|
148
|
-
},
|
|
149
|
-
scim: {
|
|
150
|
-
api: new ScimAPI_1.ScimAPI(this.transport.http),
|
|
151
|
-
},
|
|
152
|
-
search: {
|
|
153
|
-
api: new search_1.TeamSearchAPI(this.transport.http),
|
|
154
|
-
},
|
|
155
|
-
service: {
|
|
156
|
-
api: new team_1.ServiceAPI(this.transport.http),
|
|
157
|
-
},
|
|
158
|
-
team: {
|
|
159
|
-
api: new team_1.TeamAPI(this.transport.http),
|
|
88
|
+
this.backendFeatures = this.computeBackendFeatures(0);
|
|
89
|
+
this.api = this.configureApis(this.backendFeatures);
|
|
90
|
+
}
|
|
91
|
+
configureApis(backendFeatures) {
|
|
92
|
+
return {
|
|
93
|
+
account: new AccountAPI_1.AccountAPI(this.transport.http),
|
|
94
|
+
asset: new asset_1.AssetAPI(this.transport.http),
|
|
95
|
+
auth: new auth_1.AuthAPI(this.transport.http),
|
|
96
|
+
services: new services_1.ServicesAPI(this.transport.http),
|
|
97
|
+
broadcast: new broadcast_1.BroadcastAPI(this.transport.http),
|
|
98
|
+
client: new client_1.ClientAPI(this.transport.http),
|
|
99
|
+
connection: new connection_1.ConnectionAPI(this.transport.http, backendFeatures),
|
|
100
|
+
conversation: new conversation_1.ConversationAPI(this.transport.http, backendFeatures),
|
|
101
|
+
giphy: new giphy_1.GiphyAPI(this.transport.http),
|
|
102
|
+
notification: new notification_1.NotificationAPI(this.transport.http),
|
|
103
|
+
self: new self_1.SelfAPI(this.transport.http),
|
|
104
|
+
serviceProvider: new serviceProvider_1.ServiceProviderAPI(this.transport.http),
|
|
105
|
+
teams: {
|
|
106
|
+
conversation: new team_1.TeamConversationAPI(this.transport.http),
|
|
107
|
+
feature: new team_1.FeatureAPI(this.transport.http),
|
|
108
|
+
identityProvider: new team_1.IdentityProviderAPI(this.transport.http),
|
|
109
|
+
invitation: new team_1.TeamInvitationAPI(this.transport.http),
|
|
110
|
+
legalhold: new team_1.LegalHoldAPI(this.transport.http),
|
|
111
|
+
member: new team_1.MemberAPI(this.transport.http),
|
|
112
|
+
payment: new team_1.PaymentAPI(this.transport.http),
|
|
113
|
+
billing: new team_1.BillingAPI(this.transport.http),
|
|
114
|
+
scim: new ScimAPI_1.ScimAPI(this.transport.http),
|
|
115
|
+
search: new search_1.TeamSearchAPI(this.transport.http),
|
|
116
|
+
service: new team_1.ServiceAPI(this.transport.http),
|
|
117
|
+
team: new team_1.TeamAPI(this.transport.http),
|
|
160
118
|
},
|
|
119
|
+
user: new user_1.UserAPI(this.transport.http, backendFeatures),
|
|
161
120
|
};
|
|
162
|
-
|
|
163
|
-
|
|
121
|
+
}
|
|
122
|
+
/**
|
|
123
|
+
* Will compute all the capabilities of the backend API according to the selected version and the version response payload
|
|
124
|
+
* @param backendVersion The agreed used version between the client and the backend
|
|
125
|
+
* @param responsePayload? The response from the server
|
|
126
|
+
*/
|
|
127
|
+
computeBackendFeatures(backendVersion, responsePayload) {
|
|
128
|
+
return {
|
|
129
|
+
federationEndpoints: backendVersion > 0,
|
|
130
|
+
isFederated: (responsePayload === null || responsePayload === void 0 ? void 0 : responsePayload.federated) || false,
|
|
164
131
|
};
|
|
165
132
|
}
|
|
133
|
+
/**
|
|
134
|
+
* Will set the APIClient to use a specific version of the API (by default uses version 0)
|
|
135
|
+
* It will fetch the API Config and use the highest possible version
|
|
136
|
+
* @param acceptedVersions Which version the consumer supports
|
|
137
|
+
* @return The highest version that is both supported by client and backend
|
|
138
|
+
*/
|
|
139
|
+
async useVersion(acceptedVersions) {
|
|
140
|
+
if (acceptedVersions.length === 1 && acceptedVersions[0] === 0) {
|
|
141
|
+
// Nothing to do since version 0 is the default one
|
|
142
|
+
return 0;
|
|
143
|
+
}
|
|
144
|
+
let backendVersions = { supported: [0] };
|
|
145
|
+
try {
|
|
146
|
+
backendVersions = await (await this.transport.http.sendRequest({ url: '/api-version' })).data;
|
|
147
|
+
}
|
|
148
|
+
catch (error) { }
|
|
149
|
+
const highestCommonVersion = backendVersions.supported
|
|
150
|
+
.sort()
|
|
151
|
+
.reverse()
|
|
152
|
+
.find(version => acceptedVersions.includes(version));
|
|
153
|
+
if (highestCommonVersion === undefined) {
|
|
154
|
+
throw new Error(`Backend does not support requested versions [${acceptedVersions.join(', ')}] (supported versions ${backendVersions.supported.join(', ')})`);
|
|
155
|
+
}
|
|
156
|
+
this.backendFeatures = this.computeBackendFeatures(0, backendVersions);
|
|
157
|
+
this.api = this.configureApis(this.backendFeatures);
|
|
158
|
+
return highestCommonVersion;
|
|
159
|
+
}
|
|
166
160
|
async init(clientType = client_1.ClientType.NONE, cookie) {
|
|
167
161
|
CookieStore_1.CookieStore.setCookie(cookie);
|
|
168
162
|
const initialAccessToken = await this.transport.http.refreshAccessToken();
|
|
@@ -174,7 +168,7 @@ class APIClient extends events_1.EventEmitter {
|
|
|
174
168
|
if (this.context) {
|
|
175
169
|
await this.logout();
|
|
176
170
|
}
|
|
177
|
-
const accessToken = await this.auth.
|
|
171
|
+
const accessToken = await this.api.auth.postLogin(loginData);
|
|
178
172
|
this.logger.info(`Saved initial access token. It will expire in "${accessToken.expires_in}" seconds.`, obfuscation_1.ObfuscationUtil.obfuscateAccessToken(accessToken));
|
|
179
173
|
await this.accessTokenStore.updateToken(accessToken);
|
|
180
174
|
return this.createContext(accessToken.user, loginData.clientType);
|
|
@@ -194,7 +188,7 @@ class APIClient extends events_1.EventEmitter {
|
|
|
194
188
|
if (this.context) {
|
|
195
189
|
await this.logout();
|
|
196
190
|
}
|
|
197
|
-
const user = await this.auth.
|
|
191
|
+
const user = await this.api.auth.postRegister(userAccount);
|
|
198
192
|
await this.createContext(user.id, clientType);
|
|
199
193
|
return this.init(clientType, CookieStore_1.CookieStore.getCookie());
|
|
200
194
|
}
|
|
@@ -202,7 +196,7 @@ class APIClient extends events_1.EventEmitter {
|
|
|
202
196
|
try {
|
|
203
197
|
this.disconnect('Closed by client logout');
|
|
204
198
|
if (!options.skipLogoutRequest) {
|
|
205
|
-
await this.auth.
|
|
199
|
+
await this.api.auth.postLogout();
|
|
206
200
|
}
|
|
207
201
|
}
|
|
208
202
|
catch (error) {
|
|
@@ -220,7 +214,7 @@ class APIClient extends events_1.EventEmitter {
|
|
|
220
214
|
var _a;
|
|
221
215
|
let selfDomain = undefined;
|
|
222
216
|
try {
|
|
223
|
-
const self = await this.self.
|
|
217
|
+
const self = await this.api.self.getSelf();
|
|
224
218
|
selfDomain = (_a = self.qualified_id) === null || _a === void 0 ? void 0 : _a.domain;
|
|
225
219
|
this.logger.info(`Got self domain "${selfDomain}"`);
|
|
226
220
|
}
|
package/src/APIClient.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"APIClient.js","sourceRoot":"","sources":["APIClient.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;;;;GAiBG;;;;;;AAEH,mCAAoC;AACpC,sDAA8B;AAE9B,kCAUiB;AACjB,qDAAgD;AAChD,oCAAkC;AAClC,gCAA+B;AAC/B,4CAA0C;AAC1C,sCAAgD;AAChD,8CAA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ACpB;QACD,MAAM,IAAI,KAAK,CAAC,mBAAmB,CAAC,CAAC;IACvC,CAAC;IAED,gEAAgE;IAChE,IAAW,iBAAiB;QAC1B,IAAI,IAAI,CAAC,QAAQ,EAAE;YACjB,OAAO,IAAI,CAAC,QAAQ,CAAC;SACtB;QACD,MAAM,IAAI,KAAK,CAAC,qBAAqB,CAAC,CAAC;IACzC,CAAC;;AA/PH,8BAgQC;AAnPe,iBAAO,GAAG,aAAO,CAAC;AAET,eAAK,GAAG,KAAK,CAAC;AAEvB,iBAAO,GAAG,OAAO,CAAC"}
|
package/src/auth/AuthAPI.js
CHANGED
|
@@ -17,6 +17,17 @@
|
|
|
17
17
|
* along with this program. If not, see http://www.gnu.org/licenses/.
|
|
18
18
|
*
|
|
19
19
|
*/
|
|
20
|
+
var __rest = (this && this.__rest) || function (s, e) {
|
|
21
|
+
var t = {};
|
|
22
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
|
|
23
|
+
t[p] = s[p];
|
|
24
|
+
if (s != null && typeof Object.getOwnPropertySymbols === "function")
|
|
25
|
+
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
|
26
|
+
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
|
|
27
|
+
t[p[i]] = s[p[i]];
|
|
28
|
+
}
|
|
29
|
+
return t;
|
|
30
|
+
};
|
|
20
31
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
21
32
|
exports.AuthAPI = void 0;
|
|
22
33
|
const http_1 = require("../http/");
|
|
@@ -52,7 +63,8 @@ class AuthAPI {
|
|
|
52
63
|
await this.client.sendJSON(config);
|
|
53
64
|
}
|
|
54
65
|
async postLogin(loginData) {
|
|
55
|
-
const
|
|
66
|
+
const { verificationCode } = loginData, rest = __rest(loginData, ["verificationCode"]);
|
|
67
|
+
const login = Object.assign(Object.assign(Object.assign({}, rest), (verificationCode && { verification_code: verificationCode })), { clientType: undefined, password: loginData.password ? String(loginData.password) : undefined });
|
|
56
68
|
const config = {
|
|
57
69
|
data: login,
|
|
58
70
|
method: 'post',
|
package/src/auth/AuthAPI.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"AuthAPI.js","sourceRoot":"","sources":["AuthAPI.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;;;;GAiBG
|
|
1
|
+
{"version":3,"file":"AuthAPI.js","sourceRoot":"","sources":["AuthAPI.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;;;;GAiBG;;;;;;;;;;;;;;AAIH,mCAAqE;AACrE,uCAAsC;AACtC,+DAA8G;AAC9G,iDAA2E;AAO3E,MAAa,OAAO;IAClB,YAA6B,MAAkB;QAAlB,WAAM,GAAN,MAAM,CAAY;IAAG,CAAC;IAiB5C,UAAU,CAAC,MAAiB;QACjC,MAAM,MAAM,GAAuB;YACjC,MAAM,EAAE,KAAK;YACb,MAAM,EAAE,EAAE;YACV,GAAG,EAAE,OAAO,CAAC,GAAG,CAAC,OAAO;SACzB,CAAC;QAEF,IAAI,MAAM,EAAE;YACV,MAAM,CAAC,MAAM,CAAC,MAAM,GAAG,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;SACzC;QAED,OAAO,IAAI,CAAC,MAAM,CAAC,WAAW,CAAC,MAAM,CAAC,CAAC;IACzC,CAAC;IAEM,KAAK,CAAC,iBAAiB,CAAC,QAAgB,EAAE,MAAiB,EAAE,GAAc;QAChF,MAAM,MAAM,GAAuB;YACjC,IAAI,EAAE;gBACJ,GAAG;gBACH,MAAM;gBACN,QAAQ;aACT;YACD,MAAM,EAAE,MAAM;YACd,GAAG,EAAE,GAAG,OAAO,CAAC,GAAG,CAAC,OAAO,IAAI,OAAO,CAAC,GAAG,CAAC,MAAM,EAAE;YACnD,eAAe,EAAE,IAAI;SACtB,CAAC;QAEF,MAAM,IAAI,CAAC,MAAM,CAAC,QAAQ,CAAC,MAAM,CAAC,CA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Data.d.ts
CHANGED
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/*
|
|
3
|
+
* Wire
|
|
4
|
+
* Copyright (C) 2022 Wire Swiss GmbH
|
|
5
|
+
*
|
|
6
|
+
* This program is free software: you can redistribute it and/or modify
|
|
7
|
+
* it under the terms of the GNU General Public License as published by
|
|
8
|
+
* the Free Software Foundation, either version 3 of the License, or
|
|
9
|
+
* (at your option) any later version.
|
|
10
|
+
*
|
|
11
|
+
* This program is distributed in the hope that it will be useful,
|
|
12
|
+
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
13
|
+
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
14
|
+
* GNU General Public License for more details.
|
|
15
|
+
*
|
|
16
|
+
* You should have received a copy of the GNU General Public License
|
|
17
|
+
* along with this program. If not, see http://www.gnu.org/licenses/.
|
|
18
|
+
*
|
|
19
|
+
*/
|
|
20
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
21
|
+
exports.VerificationActionType = void 0;
|
|
22
|
+
var VerificationActionType;
|
|
23
|
+
(function (VerificationActionType) {
|
|
24
|
+
VerificationActionType["GENERATE_SCIM_TOKEN"] = "generate_scim_token";
|
|
25
|
+
VerificationActionType["LOGIN"] = "login";
|
|
26
|
+
})(VerificationActionType = exports.VerificationActionType || (exports.VerificationActionType = {}));
|
|
27
|
+
//# sourceMappingURL=VerificationActionType.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"VerificationActionType.js","sourceRoot":"","sources":["VerificationActionType.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;;;;GAiBG;;;AAEH,IAAY,sBAGX;AAHD,WAAY,sBAAsB;IAChC,qEAA2C,CAAA;IAC3C,yCAAe,CAAA;AACjB,CAAC,EAHW,sBAAsB,GAAtB,8BAAsB,KAAtB,8BAAsB,QAGjC"}
|
|
@@ -1,9 +1,11 @@
|
|
|
1
|
-
import
|
|
1
|
+
import { BackendFeatures } from '../APIClient';
|
|
2
|
+
import type { Connection, ConnectionUpdate, UserConnectionList } from '../connection/';
|
|
2
3
|
import { HttpClient } from '../http/';
|
|
3
4
|
import { QualifiedId } from '../user';
|
|
4
5
|
export declare class ConnectionAPI {
|
|
5
6
|
private readonly client;
|
|
6
|
-
|
|
7
|
+
private readonly backendFeatures;
|
|
8
|
+
constructor(client: HttpClient, backendFeatures: BackendFeatures);
|
|
7
9
|
static readonly URL: {
|
|
8
10
|
CONNECTIONS: string;
|
|
9
11
|
};
|
|
@@ -12,8 +14,7 @@ export declare class ConnectionAPI {
|
|
|
12
14
|
* @param userId The ID of the other user
|
|
13
15
|
* @see https://staging-nginz-https.zinfra.io/swagger-ui/#!/users/connection
|
|
14
16
|
*/
|
|
15
|
-
getConnection(userId:
|
|
16
|
-
getConnection(userId: string, useFederation?: false): Promise<Connection>;
|
|
17
|
+
getConnection(userId: string | QualifiedId): Promise<Connection>;
|
|
17
18
|
/**
|
|
18
19
|
* List the connections to other users.
|
|
19
20
|
* @param limit Number of results to return (default 100, max 500)
|
|
@@ -32,8 +33,7 @@ export declare class ConnectionAPI {
|
|
|
32
33
|
* @deprecated use `getConnectionList` instead
|
|
33
34
|
*/
|
|
34
35
|
getAllConnections(): Promise<Connection[]>;
|
|
35
|
-
postConnection(
|
|
36
|
-
postConnection(data: QualifiedId, useFederation: true): Promise<Connection>;
|
|
36
|
+
postConnection(userId: QualifiedId, name?: string): Promise<Connection>;
|
|
37
37
|
/**
|
|
38
38
|
* Create a connection to another user.
|
|
39
39
|
* Note: You can have no more than 1000 connections in accepted or sent state.
|
|
@@ -54,9 +54,7 @@ export declare class ConnectionAPI {
|
|
|
54
54
|
* Note: You can have no more than 1000 connections in accepted or sent state.
|
|
55
55
|
* @param userId The ID of the other user (qualified or not)
|
|
56
56
|
* @param updatedConnection: The updated connection
|
|
57
|
-
* @param useFederation: whether the backend supports federation or not (in which case a QualifiedId must be provided)
|
|
58
57
|
* @see https://staging-nginz-https.zinfra.io/swagger-ui/#!/users/updateConnection
|
|
59
58
|
*/
|
|
60
|
-
putConnection(userId: string, updatedConnection: ConnectionUpdate): Promise<Connection>;
|
|
61
|
-
putConnection(userId: QualifiedId, updatedConnection: ConnectionUpdate, useFederation: true): Promise<Connection>;
|
|
59
|
+
putConnection(userId: string | QualifiedId, updatedConnection: ConnectionUpdate): Promise<Connection>;
|
|
62
60
|
}
|