@api-client/core 0.12.13 → 0.12.14
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/build/src/browser.d.ts +3 -3
- package/build/src/browser.d.ts.map +1 -1
- package/build/src/browser.js +2 -2
- package/build/src/browser.js.map +1 -1
- package/build/src/index.d.ts +3 -3
- package/build/src/index.d.ts.map +1 -1
- package/build/src/index.js +2 -2
- package/build/src/index.js.map +1 -1
- package/build/src/proxy/HttpProjectProxy.js +1 -1
- package/build/src/proxy/HttpProjectProxy.js.map +1 -1
- package/build/src/sdk/AuthSdk.d.ts.map +1 -0
- package/build/src/sdk/AuthSdk.js.map +1 -0
- package/build/src/{runtime/store → sdk}/DataCatalogSdk.d.ts +5 -5
- package/build/src/sdk/DataCatalogSdk.d.ts.map +1 -0
- package/build/src/{runtime/store → sdk}/DataCatalogSdk.js +2 -2
- package/build/src/sdk/DataCatalogSdk.js.map +1 -0
- package/build/src/{runtime/store → sdk}/FilesSdk.d.ts +7 -7
- package/build/src/sdk/FilesSdk.d.ts.map +1 -0
- package/build/src/{runtime/store → sdk}/FilesSdk.js +2 -2
- package/build/src/sdk/FilesSdk.js.map +1 -0
- package/build/src/{runtime/store → sdk}/HistorySdk.d.ts +2 -2
- package/build/src/sdk/HistorySdk.d.ts.map +1 -0
- package/build/src/{runtime/store → sdk}/HistorySdk.js +2 -2
- package/build/src/sdk/HistorySdk.js.map +1 -0
- package/build/src/sdk/Http.d.ts.map +1 -0
- package/build/src/sdk/Http.js.map +1 -0
- package/build/src/sdk/HttpNode.d.ts.map +1 -0
- package/build/src/{runtime/store → sdk}/HttpNode.js +1 -2
- package/build/src/sdk/HttpNode.js.map +1 -0
- package/build/src/{runtime/store → sdk}/HttpWeb.d.ts +1 -1
- package/build/src/sdk/HttpWeb.d.ts.map +1 -0
- package/build/src/{runtime/store → sdk}/HttpWeb.js +1 -1
- package/build/src/sdk/HttpWeb.js.map +1 -0
- package/build/src/{runtime/store → sdk}/OrganizationsSdk.d.ts +13 -5
- package/build/src/sdk/OrganizationsSdk.d.ts.map +1 -0
- package/build/src/{runtime/store → sdk}/OrganizationsSdk.js +32 -1
- package/build/src/sdk/OrganizationsSdk.js.map +1 -0
- package/build/src/{runtime/store → sdk}/ProjectExecutionsSdk.d.ts +2 -2
- package/build/src/sdk/ProjectExecutionsSdk.d.ts.map +1 -0
- package/build/src/{runtime/store → sdk}/ProjectExecutionsSdk.js +1 -1
- package/build/src/sdk/ProjectExecutionsSdk.js.map +1 -0
- package/build/src/{runtime/store → sdk}/RevisionsSdk.d.ts +2 -2
- package/build/src/sdk/RevisionsSdk.d.ts.map +1 -0
- package/build/src/{runtime/store → sdk}/RevisionsSdk.js +1 -1
- package/build/src/sdk/RevisionsSdk.js.map +1 -0
- package/build/src/sdk/RouteBuilder.d.ts.map +1 -0
- package/build/src/sdk/RouteBuilder.js.map +1 -0
- package/build/src/{runtime/store → sdk}/Sdk.d.ts +1 -1
- package/build/src/sdk/Sdk.d.ts.map +1 -0
- package/build/src/sdk/Sdk.js.map +1 -0
- package/build/src/{runtime/store → sdk}/SdkBase.d.ts +3 -3
- package/build/src/sdk/SdkBase.d.ts.map +1 -0
- package/build/src/{runtime/store → sdk}/SdkBase.js +1 -1
- package/build/src/sdk/SdkBase.js.map +1 -0
- package/build/src/{runtime/store → sdk}/SharedSdk.d.ts +2 -2
- package/build/src/sdk/SharedSdk.d.ts.map +1 -0
- package/build/src/{runtime/store → sdk}/SharedSdk.js +1 -1
- package/build/src/sdk/SharedSdk.js.map +1 -0
- package/build/src/sdk/StoreSdkNode.d.ts.map +1 -0
- package/build/src/sdk/StoreSdkNode.js.map +1 -0
- package/build/src/sdk/StoreSdkWeb.d.ts.map +1 -0
- package/build/src/sdk/StoreSdkWeb.js.map +1 -0
- package/build/src/{runtime/store → sdk}/TrashSdk.d.ts +2 -2
- package/build/src/sdk/TrashSdk.d.ts.map +1 -0
- package/build/src/{runtime/store → sdk}/TrashSdk.js +1 -1
- package/build/src/sdk/TrashSdk.js.map +1 -0
- package/build/src/{runtime/store → sdk}/UsersSdk.d.ts +1 -21
- package/build/src/sdk/UsersSdk.d.ts.map +1 -0
- package/build/src/sdk/UsersSdk.js +35 -0
- package/build/src/sdk/UsersSdk.js.map +1 -0
- package/build/src/sdk/WsClient.d.ts.map +1 -0
- package/build/src/sdk/WsClient.js.map +1 -0
- package/build/src/sdk/WsClientNode.d.ts.map +1 -0
- package/build/src/sdk/WsClientNode.js.map +1 -0
- package/build/src/sdk/WsClientWeb.d.ts.map +1 -0
- package/build/src/sdk/WsClientWeb.js.map +1 -0
- package/data/models/example-generator-api.json +14 -14
- package/package.json +3 -1
- package/src/proxy/HttpProjectProxy.ts +1 -1
- package/src/{runtime/store → sdk}/DataCatalogSdk.ts +7 -7
- package/src/{runtime/store → sdk}/FilesSdk.ts +8 -8
- package/src/{runtime/store → sdk}/HistorySdk.ts +3 -3
- package/src/{runtime/store → sdk}/HttpNode.ts +1 -2
- package/src/{runtime/store → sdk}/HttpWeb.ts +2 -2
- package/src/{runtime/store → sdk}/OrganizationsSdk.ts +37 -6
- package/src/{runtime/store → sdk}/ProjectExecutionsSdk.ts +2 -2
- package/src/{runtime/store → sdk}/RevisionsSdk.ts +3 -3
- package/src/{runtime/store → sdk}/Sdk.ts +1 -1
- package/src/{runtime/store → sdk}/SdkBase.ts +3 -3
- package/src/{runtime/store → sdk}/SharedSdk.ts +3 -3
- package/src/{runtime/store → sdk}/TrashSdk.ts +3 -3
- package/src/sdk/UsersSdk.ts +112 -0
- package/build/src/runtime/store/AuthSdk.d.ts.map +0 -1
- package/build/src/runtime/store/AuthSdk.js.map +0 -1
- package/build/src/runtime/store/DataCatalogSdk.d.ts.map +0 -1
- package/build/src/runtime/store/DataCatalogSdk.js.map +0 -1
- package/build/src/runtime/store/FilesSdk.d.ts.map +0 -1
- package/build/src/runtime/store/FilesSdk.js.map +0 -1
- package/build/src/runtime/store/HistorySdk.d.ts.map +0 -1
- package/build/src/runtime/store/HistorySdk.js.map +0 -1
- package/build/src/runtime/store/Http.d.ts.map +0 -1
- package/build/src/runtime/store/Http.js.map +0 -1
- package/build/src/runtime/store/HttpNode.d.ts.map +0 -1
- package/build/src/runtime/store/HttpNode.js.map +0 -1
- package/build/src/runtime/store/HttpWeb.d.ts.map +0 -1
- package/build/src/runtime/store/HttpWeb.js.map +0 -1
- package/build/src/runtime/store/OrganizationsSdk.d.ts.map +0 -1
- package/build/src/runtime/store/OrganizationsSdk.js.map +0 -1
- package/build/src/runtime/store/ProjectExecutionsSdk.d.ts.map +0 -1
- package/build/src/runtime/store/ProjectExecutionsSdk.js.map +0 -1
- package/build/src/runtime/store/RevisionsSdk.d.ts.map +0 -1
- package/build/src/runtime/store/RevisionsSdk.js.map +0 -1
- package/build/src/runtime/store/RouteBuilder.d.ts.map +0 -1
- package/build/src/runtime/store/RouteBuilder.js.map +0 -1
- package/build/src/runtime/store/Sdk.d.ts.map +0 -1
- package/build/src/runtime/store/Sdk.js.map +0 -1
- package/build/src/runtime/store/SdkBase.d.ts.map +0 -1
- package/build/src/runtime/store/SdkBase.js.map +0 -1
- package/build/src/runtime/store/SharedSdk.d.ts.map +0 -1
- package/build/src/runtime/store/SharedSdk.js.map +0 -1
- package/build/src/runtime/store/StoreSdkNode.d.ts.map +0 -1
- package/build/src/runtime/store/StoreSdkNode.js.map +0 -1
- package/build/src/runtime/store/StoreSdkWeb.d.ts.map +0 -1
- package/build/src/runtime/store/StoreSdkWeb.js.map +0 -1
- package/build/src/runtime/store/TrashSdk.d.ts.map +0 -1
- package/build/src/runtime/store/TrashSdk.js.map +0 -1
- package/build/src/runtime/store/UsersSdk.d.ts.map +0 -1
- package/build/src/runtime/store/UsersSdk.js +0 -104
- package/build/src/runtime/store/UsersSdk.js.map +0 -1
- package/build/src/runtime/store/WsClient.d.ts.map +0 -1
- package/build/src/runtime/store/WsClient.js.map +0 -1
- package/build/src/runtime/store/WsClientNode.d.ts.map +0 -1
- package/build/src/runtime/store/WsClientNode.js.map +0 -1
- package/build/src/runtime/store/WsClientWeb.d.ts.map +0 -1
- package/build/src/runtime/store/WsClientWeb.js.map +0 -1
- package/src/runtime/store/UsersSdk.ts +0 -186
- /package/build/src/{runtime/store → sdk}/AuthSdk.d.ts +0 -0
- /package/build/src/{runtime/store → sdk}/AuthSdk.js +0 -0
- /package/build/src/{runtime/store → sdk}/Http.d.ts +0 -0
- /package/build/src/{runtime/store → sdk}/Http.js +0 -0
- /package/build/src/{runtime/store → sdk}/HttpNode.d.ts +0 -0
- /package/build/src/{runtime/store → sdk}/RouteBuilder.d.ts +0 -0
- /package/build/src/{runtime/store → sdk}/RouteBuilder.js +0 -0
- /package/build/src/{runtime/store → sdk}/Sdk.js +0 -0
- /package/build/src/{runtime/store → sdk}/StoreSdkNode.d.ts +0 -0
- /package/build/src/{runtime/store → sdk}/StoreSdkNode.js +0 -0
- /package/build/src/{runtime/store → sdk}/StoreSdkWeb.d.ts +0 -0
- /package/build/src/{runtime/store → sdk}/StoreSdkWeb.js +0 -0
- /package/build/src/{runtime/store → sdk}/WsClient.d.ts +0 -0
- /package/build/src/{runtime/store → sdk}/WsClient.js +0 -0
- /package/build/src/{runtime/store → sdk}/WsClientNode.d.ts +0 -0
- /package/build/src/{runtime/store → sdk}/WsClientNode.js +0 -0
- /package/build/src/{runtime/store → sdk}/WsClientWeb.d.ts +0 -0
- /package/build/src/{runtime/store → sdk}/WsClientWeb.js +0 -0
- /package/src/{runtime/store → sdk}/AuthSdk.ts +0 -0
- /package/src/{runtime/store → sdk}/Http.ts +0 -0
- /package/src/{runtime/store → sdk}/RouteBuilder.ts +0 -0
- /package/src/{runtime/store → sdk}/StoreSdkNode.ts +0 -0
- /package/src/{runtime/store → sdk}/StoreSdkWeb.ts +0 -0
- /package/src/{runtime/store → sdk}/WsClient.ts +0 -0
- /package/src/{runtime/store → sdk}/WsClientNode.ts +0 -0
- /package/src/{runtime/store → sdk}/WsClientWeb.ts +0 -0
|
@@ -1,186 +0,0 @@
|
|
|
1
|
-
import {
|
|
2
|
-
SdkBase,
|
|
3
|
-
E_RESPONSE_STATUS,
|
|
4
|
-
E_RESPONSE_NO_VALUE,
|
|
5
|
-
E_INVALID_JSON,
|
|
6
|
-
E_RESPONSE_UNKNOWN,
|
|
7
|
-
SdkOptions,
|
|
8
|
-
} from './SdkBase.js'
|
|
9
|
-
import { RouteBuilder } from './RouteBuilder.js'
|
|
10
|
-
import { IUser } from '../../models/store/User.js'
|
|
11
|
-
import { ContextListResult, ContextListOptions } from '../../events/BaseEvents.js'
|
|
12
|
-
import { Exception } from '../../exceptions/exception.js'
|
|
13
|
-
|
|
14
|
-
export interface IJwtInfo {
|
|
15
|
-
/**
|
|
16
|
-
* The information about the user that is read from the JWT.
|
|
17
|
-
*/
|
|
18
|
-
data: IJwtUser
|
|
19
|
-
/**
|
|
20
|
-
* The name of the provider.
|
|
21
|
-
*/
|
|
22
|
-
provider: string
|
|
23
|
-
}
|
|
24
|
-
|
|
25
|
-
export interface IJwtUser {
|
|
26
|
-
/**
|
|
27
|
-
* The provider's unique ID.
|
|
28
|
-
*/
|
|
29
|
-
id: string
|
|
30
|
-
/**
|
|
31
|
-
* The user's email address.
|
|
32
|
-
*/
|
|
33
|
-
email: string
|
|
34
|
-
/**
|
|
35
|
-
* true, if the provider has verified the email address.
|
|
36
|
-
*/
|
|
37
|
-
email_verified: boolean
|
|
38
|
-
/**
|
|
39
|
-
* The user's full name.
|
|
40
|
-
*/
|
|
41
|
-
name: string
|
|
42
|
-
/**
|
|
43
|
-
* If present, a URL to user's profile picture
|
|
44
|
-
*/
|
|
45
|
-
picture?: string
|
|
46
|
-
given_name?: string
|
|
47
|
-
family_name?: string
|
|
48
|
-
/**
|
|
49
|
-
* If present, the host domain of the user's GSuite email address.
|
|
50
|
-
* Google specific.
|
|
51
|
-
*/
|
|
52
|
-
hd?: string
|
|
53
|
-
}
|
|
54
|
-
|
|
55
|
-
export interface IRegistrationInfo {
|
|
56
|
-
reason: 'new-organization' | 'existing-organization'
|
|
57
|
-
/**
|
|
58
|
-
* The decoded JWT user information.
|
|
59
|
-
* Used to create a user account.
|
|
60
|
-
*/
|
|
61
|
-
user: IJwtInfo
|
|
62
|
-
}
|
|
63
|
-
|
|
64
|
-
export interface IOrganizationRegistrationInfo extends IRegistrationInfo {
|
|
65
|
-
reason: 'new-organization'
|
|
66
|
-
/**
|
|
67
|
-
* The name of the organization to create for the user.
|
|
68
|
-
*/
|
|
69
|
-
organizationName: string
|
|
70
|
-
}
|
|
71
|
-
|
|
72
|
-
export interface IOrganizationAddUserInfo extends IRegistrationInfo {
|
|
73
|
-
reason: 'existing-organization'
|
|
74
|
-
/**
|
|
75
|
-
* Set when adding a user to an existing organization.
|
|
76
|
-
*/
|
|
77
|
-
organizationId: string
|
|
78
|
-
/**
|
|
79
|
-
* The invitation code used to invite the user.
|
|
80
|
-
*/
|
|
81
|
-
invitation: string
|
|
82
|
-
}
|
|
83
|
-
|
|
84
|
-
export class UsersSdk extends SdkBase {
|
|
85
|
-
/**
|
|
86
|
-
* Reads the current user.
|
|
87
|
-
* @param request Optional request options.
|
|
88
|
-
*/
|
|
89
|
-
async me(request: SdkOptions = {}): Promise<IUser> {
|
|
90
|
-
const { token } = request
|
|
91
|
-
const url = this.sdk.getUrl(RouteBuilder.usersMe())
|
|
92
|
-
const result = await this.sdk.http.get(url.toString(), { token })
|
|
93
|
-
this.inspectCommonStatusCodes(result)
|
|
94
|
-
const E_PREFIX = 'Unable to read a user. '
|
|
95
|
-
if (result.status !== 200) {
|
|
96
|
-
this.logInvalidResponse(result)
|
|
97
|
-
throw this.createApiError(`${E_PREFIX}${E_RESPONSE_STATUS}${result.status}`, result.body)
|
|
98
|
-
}
|
|
99
|
-
if (!result.body) {
|
|
100
|
-
throw new Exception(`${E_PREFIX}${E_RESPONSE_NO_VALUE}`, { code: 'E_RESPONSE_NO_VALUE', status: result.status })
|
|
101
|
-
}
|
|
102
|
-
let data: IUser
|
|
103
|
-
try {
|
|
104
|
-
data = JSON.parse(result.body)
|
|
105
|
-
} catch {
|
|
106
|
-
throw new Exception(`${E_PREFIX}${E_INVALID_JSON}`, { code: 'E_INVALID_JSON', status: result.status })
|
|
107
|
-
}
|
|
108
|
-
if (!data.key) {
|
|
109
|
-
throw new Exception(`${E_PREFIX}${E_RESPONSE_UNKNOWN}`, { code: 'E_RESPONSE_UNKNOWN', status: result.status })
|
|
110
|
-
}
|
|
111
|
-
return data
|
|
112
|
-
}
|
|
113
|
-
|
|
114
|
-
/**
|
|
115
|
-
* Lists users in the store
|
|
116
|
-
*
|
|
117
|
-
* @param organizationId The key of the organization we want to read the user from.
|
|
118
|
-
* @param options Optional query options.
|
|
119
|
-
* @param request Optional request options.
|
|
120
|
-
* @deprecated Use `organizations.listUsers()` instead.
|
|
121
|
-
*/
|
|
122
|
-
async list(
|
|
123
|
-
organizationId: string,
|
|
124
|
-
options?: ContextListOptions,
|
|
125
|
-
request: SdkOptions = {}
|
|
126
|
-
): Promise<ContextListResult<IUser>> {
|
|
127
|
-
// eslint-disable-next-line no-console
|
|
128
|
-
console.warn('The `users.list` method is deprecated. Use `organizations.listUsers()` instead.')
|
|
129
|
-
const { token } = request
|
|
130
|
-
const url = this.sdk.getUrl(RouteBuilder.users(organizationId))
|
|
131
|
-
this.sdk.appendListOptions(url, options)
|
|
132
|
-
const result = await this.sdk.http.get(url.toString(), { token })
|
|
133
|
-
this.inspectCommonStatusCodes(result)
|
|
134
|
-
const E_PREFIX = 'Unable to list projects. '
|
|
135
|
-
if (result.status !== 200) {
|
|
136
|
-
this.logInvalidResponse(result)
|
|
137
|
-
throw this.createApiError(`${E_PREFIX}${E_RESPONSE_STATUS}${result.status}`, result.body)
|
|
138
|
-
}
|
|
139
|
-
if (!result.body) {
|
|
140
|
-
throw new Exception(`${E_PREFIX}${E_RESPONSE_NO_VALUE}`, { code: 'E_RESPONSE_NO_VALUE', status: result.status })
|
|
141
|
-
}
|
|
142
|
-
let data: ContextListResult<IUser>
|
|
143
|
-
try {
|
|
144
|
-
data = JSON.parse(result.body)
|
|
145
|
-
} catch {
|
|
146
|
-
throw new Exception(`${E_PREFIX}${E_INVALID_JSON}`, { code: 'E_INVALID_JSON', status: result.status })
|
|
147
|
-
}
|
|
148
|
-
if (!Array.isArray(data.items)) {
|
|
149
|
-
throw new Exception(`${E_PREFIX}${E_RESPONSE_UNKNOWN}`, { code: 'E_RESPONSE_UNKNOWN', status: result.status })
|
|
150
|
-
}
|
|
151
|
-
return data
|
|
152
|
-
}
|
|
153
|
-
|
|
154
|
-
/**
|
|
155
|
-
* Reads a user information from the store.
|
|
156
|
-
*
|
|
157
|
-
* @param organizationId The key of the organization we want to read the user from.
|
|
158
|
-
* @param key The user key.
|
|
159
|
-
* @param request Optional request options.
|
|
160
|
-
* @returns The user object
|
|
161
|
-
* @deprecated Use `organizations.getUser()` instead.
|
|
162
|
-
*/
|
|
163
|
-
async read(organizationId: string, key: string, request: SdkOptions = {}): Promise<IUser> {
|
|
164
|
-
// eslint-disable-next-line no-console
|
|
165
|
-
console.warn('The `users.read` method is deprecated. Use `organizations.getUser()` instead.')
|
|
166
|
-
const { token } = request
|
|
167
|
-
const url = this.sdk.getUrl(RouteBuilder.user(organizationId, key))
|
|
168
|
-
const result = await this.sdk.http.get(url.toString(), { token })
|
|
169
|
-
this.inspectCommonStatusCodes(result)
|
|
170
|
-
const E_PREFIX = 'Unable to read the user info. '
|
|
171
|
-
if (result.status !== 200) {
|
|
172
|
-
this.logInvalidResponse(result)
|
|
173
|
-
throw this.createApiError(`${E_PREFIX}${E_RESPONSE_STATUS}${result.status}`, result.body)
|
|
174
|
-
}
|
|
175
|
-
if (!result.body) {
|
|
176
|
-
throw new Exception(`${E_PREFIX}${E_RESPONSE_NO_VALUE}`, { code: 'E_RESPONSE_NO_VALUE', status: result.status })
|
|
177
|
-
}
|
|
178
|
-
let data: IUser
|
|
179
|
-
try {
|
|
180
|
-
data = JSON.parse(result.body)
|
|
181
|
-
} catch {
|
|
182
|
-
throw new Exception(`${E_PREFIX}${E_INVALID_JSON}`, { code: 'E_INVALID_JSON', status: result.status })
|
|
183
|
-
}
|
|
184
|
-
return data
|
|
185
|
-
}
|
|
186
|
-
}
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|