attlaz-client 1.18.0 → 1.18.2
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/OAuthClient.js
CHANGED
|
@@ -155,15 +155,15 @@ export class OAuthClient {
|
|
|
155
155
|
return typeof process !== 'undefined' && process.versions != null && process.versions.node != null;
|
|
156
156
|
}
|
|
157
157
|
tokenToOauthClientToken(oauthToken) {
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
158
|
+
let scopes = '';
|
|
159
|
+
if (Object.prototype.hasOwnProperty.call(oauthToken, 'scopes') && oauthToken.scopes !== undefined) {
|
|
160
|
+
scopes = oauthToken.scopes;
|
|
161
|
+
}
|
|
162
|
+
else if (Object.prototype.hasOwnProperty.call(oauthToken, 'scope') && oauthToken.scope !== undefined) {
|
|
163
|
+
scopes = oauthToken.scope;
|
|
164
|
+
}
|
|
165
165
|
const refreshToken = oauthToken.refresh_token === undefined || oauthToken.refresh_token === null ? null : oauthToken.refresh_token;
|
|
166
|
-
const token = new OAuthClientToken(oauthToken.access_token, oauthToken.token_type, refreshToken,
|
|
166
|
+
const token = new OAuthClientToken(oauthToken.access_token, oauthToken.token_type, refreshToken, scopes);
|
|
167
167
|
const t = new Date();
|
|
168
168
|
t.setSeconds(t.getSeconds() + oauthToken.expires_in);
|
|
169
169
|
token.expires = t;
|
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
import { Endpoint } from './Endpoint.js';
|
|
2
2
|
import { Subscriber } from '../Model/Messaging/Subscriber.js';
|
|
3
3
|
import { CollectionResult } from '../Model/Result/CollectionResult.js';
|
|
4
|
+
import { CursorPagination } from '../Model/Pagination/CursorPagination.js';
|
|
4
5
|
export declare class SubscriberEndpoint extends Endpoint {
|
|
5
|
-
getSubscribersByFlow(flowId: string, projectEnvironmentId?: string | null): Promise<CollectionResult<Subscriber>>;
|
|
6
|
-
getSubscribersByChannel(channelId: string): Promise<CollectionResult<Subscriber>>;
|
|
6
|
+
getSubscribersByFlow(flowId: string, projectEnvironmentId?: string | null, pagination?: CursorPagination | null): Promise<CollectionResult<Subscriber>>;
|
|
7
|
+
getSubscribersByChannel(channelId: string, pagination?: CursorPagination | null): Promise<CollectionResult<Subscriber>>;
|
|
7
8
|
save(subscriber: Subscriber): Promise<Subscriber>;
|
|
8
9
|
}
|
|
@@ -1,17 +1,20 @@
|
|
|
1
1
|
import { Endpoint } from './Endpoint.js';
|
|
2
2
|
import { Subscriber } from '../Model/Messaging/Subscriber.js';
|
|
3
|
-
import {
|
|
3
|
+
import { QueryString } from '../Http/Data/QueryString.js';
|
|
4
4
|
export class SubscriberEndpoint extends Endpoint {
|
|
5
|
-
async getSubscribersByFlow(flowId, projectEnvironmentId = null) {
|
|
6
|
-
|
|
7
|
-
if (
|
|
8
|
-
|
|
5
|
+
async getSubscribersByFlow(flowId, projectEnvironmentId = null, pagination = null) {
|
|
6
|
+
const qu = new QueryString('/flows/' + flowId + '/subscribers');
|
|
7
|
+
if (projectEnvironmentId !== null && projectEnvironmentId !== undefined) {
|
|
8
|
+
qu.set('environment', projectEnvironmentId);
|
|
9
9
|
}
|
|
10
|
-
|
|
10
|
+
qu.addPagination(pagination);
|
|
11
|
+
const result = await this.requestCollection(qu, Subscriber.parseRaw);
|
|
11
12
|
return result;
|
|
12
13
|
}
|
|
13
|
-
async getSubscribersByChannel(channelId) {
|
|
14
|
-
const
|
|
14
|
+
async getSubscribersByChannel(channelId, pagination = null) {
|
|
15
|
+
const qu = new QueryString('/channels/' + channelId + '/subscribers');
|
|
16
|
+
qu.addPagination(pagination);
|
|
17
|
+
const result = await this.requestCollection(qu, Subscriber.parseRaw);
|
|
15
18
|
return result;
|
|
16
19
|
}
|
|
17
20
|
async save(subscriber) {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "attlaz-client",
|
|
3
|
-
"version": "1.18.
|
|
3
|
+
"version": "1.18.2",
|
|
4
4
|
"description": "Javascript Client to access Attlaz API",
|
|
5
5
|
"types": "./dist/index.d.ts",
|
|
6
6
|
"main": "./dist/index.js",
|
|
@@ -47,15 +47,16 @@
|
|
|
47
47
|
"devDependencies": {
|
|
48
48
|
"@types/jest": "^29.5.2",
|
|
49
49
|
"@types/node": "^22.1.0",
|
|
50
|
-
"@typescript-eslint/eslint-plugin": "^8.12.2",
|
|
51
|
-
"@typescript-eslint/parser": "^8.12.2",
|
|
52
50
|
"dotenv": "^16.3.1",
|
|
53
|
-
"eslint": "^
|
|
54
|
-
"eslint
|
|
51
|
+
"eslint-config-attlaz-base": "^1.0.17",
|
|
52
|
+
"eslint": "^9.14.0",
|
|
53
|
+
"eslint-import-resolver-typescript": "^3.6.1",
|
|
55
54
|
"eslint-plugin-import": "^2.27.5",
|
|
56
|
-
"eslint-plugin-jsdoc": "^50.
|
|
55
|
+
"eslint-plugin-jsdoc": "^50.1.0",
|
|
57
56
|
"eslint-plugin-prefer-arrow": "^1.2.3",
|
|
58
|
-
"eslint-plugin-promise": "^7.
|
|
57
|
+
"eslint-plugin-promise": "^7.1.0",
|
|
58
|
+
"@typescript-eslint/eslint-plugin": "^8.1.0",
|
|
59
|
+
"@typescript-eslint/parser": "^8.1.0",
|
|
59
60
|
"jest": "^29.5.0",
|
|
60
61
|
"rimraf": "^6.0.1",
|
|
61
62
|
"rollup-plugin-commonjs": "^10.1.0",
|