attlaz-client 1.13.36 → 1.13.37
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/dist/Http/OAuthClientOptions.js +2 -2
- package/dist/Service/AdapterEndpoint.d.ts +2 -2
- package/dist/Service/AdapterEndpoint.js +10 -4
- package/dist/Service/Endpoint.d.ts +1 -1
- package/dist/Service/Endpoint.js +6 -3
- package/dist/version.d.ts +1 -1
- package/dist/version.js +1 -1
- package/package.json +1 -1
|
@@ -5,8 +5,8 @@ export class OAuthClientOptions {
|
|
|
5
5
|
accessTokenUri = 'oauth/token';
|
|
6
6
|
authorizationUri = 'oauth/authorize';
|
|
7
7
|
redirectUri = 'https://example.com/auth/github/callback';
|
|
8
|
-
scopes = [
|
|
9
|
-
state = '
|
|
8
|
+
scopes = [];
|
|
9
|
+
state = '';
|
|
10
10
|
constructor(apiEndpoint, clientId = null, clientSecret = null) {
|
|
11
11
|
this.apiEndpoint = apiEndpoint;
|
|
12
12
|
this.clientId = clientId;
|
|
@@ -7,8 +7,8 @@ import { AdapterConnectionConfigurationValue } from '../Model/Adapter/AdapterCon
|
|
|
7
7
|
import { CursorPagination } from '../Model/Pagination/CursorPagination.js';
|
|
8
8
|
import { AdapterCategory } from '../Model/Adapter/AdapterCategory.js';
|
|
9
9
|
export declare class AdapterEndpoint extends Endpoint {
|
|
10
|
-
getAdapters(pagination?: CursorPagination | null): Promise<CollectionResult<Adapter>>;
|
|
11
|
-
getAdapter(adapterId: string): Promise<Adapter | null>;
|
|
10
|
+
getAdapters(pagination?: CursorPagination | null, withMedia?: boolean): Promise<CollectionResult<Adapter>>;
|
|
11
|
+
getAdapter(adapterId: string, withMedia?: boolean): Promise<Adapter | null>;
|
|
12
12
|
getAdapterConfiguration(adapterId: string): Promise<CollectionResult<AdapterConfiguration>>;
|
|
13
13
|
getConnections(projectId: string, pagination: CursorPagination): Promise<CollectionResult<AdapterConnection>>;
|
|
14
14
|
getConnectionById(connectionId: string): Promise<AdapterConnection | null>;
|
|
@@ -5,10 +5,13 @@ import { AdapterConfiguration } from '../Model/Adapter/AdapterConfiguration.js';
|
|
|
5
5
|
import { QueryString } from '../Http/Data/QueryString.js';
|
|
6
6
|
import { AdapterCategory } from '../Model/Adapter/AdapterCategory.js';
|
|
7
7
|
export class AdapterEndpoint extends Endpoint {
|
|
8
|
-
async getAdapters(pagination = null) {
|
|
8
|
+
async getAdapters(pagination = null, withMedia = false) {
|
|
9
9
|
try {
|
|
10
10
|
const queryString = new QueryString('/adapters');
|
|
11
11
|
queryString.addPagination(pagination);
|
|
12
|
+
if (withMedia) {
|
|
13
|
+
queryString.set('with-media', true);
|
|
14
|
+
}
|
|
12
15
|
return await this.requestCollection(queryString, Adapter.parse);
|
|
13
16
|
}
|
|
14
17
|
catch (error) {
|
|
@@ -18,10 +21,13 @@ export class AdapterEndpoint extends Endpoint {
|
|
|
18
21
|
throw error;
|
|
19
22
|
}
|
|
20
23
|
}
|
|
21
|
-
async getAdapter(adapterId) {
|
|
24
|
+
async getAdapter(adapterId, withMedia = false) {
|
|
22
25
|
try {
|
|
23
|
-
const
|
|
24
|
-
|
|
26
|
+
const queryString = new QueryString('/adapters/' + adapterId);
|
|
27
|
+
if (withMedia) {
|
|
28
|
+
queryString.set('with-media', true);
|
|
29
|
+
}
|
|
30
|
+
const result = await this.requestObject(queryString, null, Adapter.parse);
|
|
25
31
|
return result.getData();
|
|
26
32
|
}
|
|
27
33
|
catch (error) {
|
|
@@ -9,7 +9,7 @@ export declare abstract class Endpoint {
|
|
|
9
9
|
private formatParameters;
|
|
10
10
|
private formatKey;
|
|
11
11
|
requestCollection<T>(action: string | QueryString, parser: (input: any) => T, parameters?: Parameters, method?: string, signWithOauthToken?: boolean): Promise<CollectionResult<T>>;
|
|
12
|
-
requestObject<T>(action: string, parameters: Parameters | undefined, parser: (input: any) => T, method?: string, signWithOauthToken?: boolean): Promise<ObjectResult<T>>;
|
|
12
|
+
requestObject<T>(action: string | QueryString, parameters: Parameters | undefined, parser: (input: any) => T, method?: string, signWithOauthToken?: boolean): Promise<ObjectResult<T>>;
|
|
13
13
|
parseCollection<T>(rawData: object[], parser: (input: any) => T): T[];
|
|
14
14
|
private parseObject;
|
|
15
15
|
}
|
package/dist/Service/Endpoint.js
CHANGED
|
@@ -86,10 +86,10 @@ export class Endpoint {
|
|
|
86
86
|
if (requestResponse === null || requestResponse === undefined) {
|
|
87
87
|
throw new Error('Unable to parse collection: response is empty for action `[' + method + '] ' + action + '`');
|
|
88
88
|
}
|
|
89
|
-
if (!
|
|
89
|
+
if (!Object.prototype.hasOwnProperty.call(requestResponse, 'data') || requestResponse.data === undefined) {
|
|
90
90
|
throw new Error('Unable to parse collection: data is not defined in response from action `[' + method + '] ' + action + '`');
|
|
91
91
|
}
|
|
92
|
-
if (!
|
|
92
|
+
if (!Object.prototype.hasOwnProperty.call(requestResponse, 'has_more') || requestResponse.has_more === undefined) {
|
|
93
93
|
throw new Error('Unable to parse collection: hasMore is not defined in response from action `[' + method + '] ' + action + '`');
|
|
94
94
|
}
|
|
95
95
|
const hasMore = Utils.isTrue(requestResponse.has_more);
|
|
@@ -98,6 +98,9 @@ export class Endpoint {
|
|
|
98
98
|
}
|
|
99
99
|
async requestObject(action, parameters = null, parser, method = 'GET', signWithOauthToken = true) {
|
|
100
100
|
parameters = this.formatParameters(parameters);
|
|
101
|
+
if (action instanceof QueryString) {
|
|
102
|
+
action = action.build();
|
|
103
|
+
}
|
|
101
104
|
const result = new ObjectResult();
|
|
102
105
|
try {
|
|
103
106
|
let requestResponse = await this.httpClient.request(action, parameters, method, signWithOauthToken);
|
|
@@ -109,7 +112,7 @@ export class Endpoint {
|
|
|
109
112
|
if (requestResponse === null || requestResponse === undefined) {
|
|
110
113
|
throw new Error('Unable to parse object: response is empty for action `[' + method + '] ' + action + '`');
|
|
111
114
|
}
|
|
112
|
-
if ((
|
|
115
|
+
if ((Object.prototype.hasOwnProperty.call(requestResponse, 'data') && !Object.prototype.hasOwnProperty.call(requestResponse, 'id')) && requestResponse.data !== undefined) {
|
|
113
116
|
console.error('Response for object "' + action + '" seem to still use old "data" property', { requestResponse });
|
|
114
117
|
requestResponse = requestResponse.data;
|
|
115
118
|
}
|
package/dist/version.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export declare const VERSION = "1.13.
|
|
1
|
+
export declare const VERSION = "1.13.37";
|
package/dist/version.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export const VERSION = "1.13.
|
|
1
|
+
export const VERSION = "1.13.37";
|