@zeniai/client-epic-state 5.0.25-betaRD1 → 5.0.25
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/lib/coreEpics.js +1 -4
- package/lib/entity/tenant/tenantPayload.d.ts +0 -2
- package/lib/entity/tenant/tenantReducer.d.ts +1 -60
- package/lib/entity/tenant/tenantReducer.js +4 -143
- package/lib/entity/tenant/tenantState.d.ts +0 -8
- package/lib/epic.js +1 -4
- package/lib/esm/coreEpics.js +1 -4
- package/lib/esm/entity/tenant/tenantReducer.js +2 -139
- package/lib/esm/epic.js +1 -4
- package/lib/esm/index.js +2 -2
- package/lib/index.d.ts +2 -2
- package/lib/index.js +30 -42
- package/lib/tsconfig.typecheck.tsbuildinfo +1 -1
- package/package.json +1 -1
- package/lib/entity/tenant/epic/deleteConnectionEpic.d.ts +0 -19
- package/lib/entity/tenant/epic/deleteConnectionEpic.js +0 -29
- package/lib/entity/tenant/epic/saveAPIKeyConnectionEpic.d.ts +0 -19
- package/lib/entity/tenant/epic/saveAPIKeyConnectionEpic.js +0 -31
- package/lib/entity/tenant/epic/saveOAuthConnectionEpic.d.ts +0 -19
- package/lib/entity/tenant/epic/saveOAuthConnectionEpic.js +0 -33
- package/lib/esm/entity/tenant/epic/deleteConnectionEpic.js +0 -25
- package/lib/esm/entity/tenant/epic/saveAPIKeyConnectionEpic.js +0 -27
- package/lib/esm/entity/tenant/epic/saveOAuthConnectionEpic.js +0 -29
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@zeniai/client-epic-state",
|
|
3
|
-
"version": "5.0.25
|
|
3
|
+
"version": "5.0.25",
|
|
4
4
|
"description": "Shared module between Web & Mobile containing required abstractions for state management, async network communication. ",
|
|
5
5
|
"main": "lib/index.js",
|
|
6
6
|
"module": "lib/esm/index.js",
|
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
import { ActionsObservable, StateObservable } from 'redux-observable';
|
|
2
|
-
import { RootState } from '../../../reducer';
|
|
3
|
-
import { ZeniAPI } from '../../../zeniAPI';
|
|
4
|
-
import { deleteConnection, deleteConnectionFailure, deleteConnectionSuccess } from '../tenantReducer';
|
|
5
|
-
export type ActionType = ReturnType<typeof deleteConnection> | ReturnType<typeof deleteConnectionSuccess> | ReturnType<typeof deleteConnectionFailure>;
|
|
6
|
-
export declare const deleteConnectionEpic: (actions$: ActionsObservable<ActionType>, _: StateObservable<RootState>, zeniAPI: ZeniAPI) => import("rxjs").Observable<{
|
|
7
|
-
payload: {
|
|
8
|
-
tenantId: string;
|
|
9
|
-
connectionId: string;
|
|
10
|
-
connectionType: "analytics" | "crm";
|
|
11
|
-
};
|
|
12
|
-
type: "tenant/deleteConnectionSuccess";
|
|
13
|
-
} | {
|
|
14
|
-
payload: {
|
|
15
|
-
tenantId: string;
|
|
16
|
-
status: import("../../../responsePayload").ZeniAPIStatus<Record<string, unknown>>;
|
|
17
|
-
};
|
|
18
|
-
type: "tenant/deleteConnectionFailure";
|
|
19
|
-
}>;
|
|
@@ -1,29 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.deleteConnectionEpic = void 0;
|
|
4
|
-
const rxjs_1 = require("rxjs");
|
|
5
|
-
const operators_1 = require("rxjs/operators");
|
|
6
|
-
const responsePayload_1 = require("../../../responsePayload");
|
|
7
|
-
const tenantReducer_1 = require("../tenantReducer");
|
|
8
|
-
const deleteConnectionEpic = (actions$, _, zeniAPI) => actions$.pipe((0, operators_1.filter)(tenantReducer_1.deleteConnection.match), (0, operators_1.switchMap)((action) => zeniAPI
|
|
9
|
-
.deleteAndGetJSON(`${zeniAPI.apiEndPoints.tenantMicroServiceBaseUrl}/1.0/connections/${action.payload.connectionId}`, undefined, Object.assign({ 'zeni-tenant-id': action.payload.tenantId }))
|
|
10
|
-
.pipe((0, operators_1.mergeMap)((response) => {
|
|
11
|
-
if ((0, responsePayload_1.isSuccessStatus)(response)) {
|
|
12
|
-
return (0, rxjs_1.from)([
|
|
13
|
-
(0, tenantReducer_1.deleteConnectionSuccess)(action.payload.tenantId, action.payload.connectionId, action.payload.connectionType),
|
|
14
|
-
]);
|
|
15
|
-
}
|
|
16
|
-
const status = response.status ??
|
|
17
|
-
(0, responsePayload_1.createZeniAPIStatus)('Failed to delete connection. Please try again.');
|
|
18
|
-
return (0, rxjs_1.from)([
|
|
19
|
-
(0, tenantReducer_1.deleteConnectionFailure)(action.payload.tenantId, status),
|
|
20
|
-
]);
|
|
21
|
-
}), (0, operators_1.catchError)((error) => {
|
|
22
|
-
const message = error instanceof Error
|
|
23
|
-
? error.message
|
|
24
|
-
: 'Unexpected error deleting connection.';
|
|
25
|
-
return (0, rxjs_1.from)([
|
|
26
|
-
(0, tenantReducer_1.deleteConnectionFailure)(action.payload.tenantId, (0, responsePayload_1.createZeniAPIStatus)(message)),
|
|
27
|
-
]);
|
|
28
|
-
}))));
|
|
29
|
-
exports.deleteConnectionEpic = deleteConnectionEpic;
|
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
import { ActionsObservable, StateObservable } from 'redux-observable';
|
|
2
|
-
import { RootState } from '../../../reducer';
|
|
3
|
-
import { ZeniAPI } from '../../../zeniAPI';
|
|
4
|
-
import { saveAPIKeyConnection, saveAPIKeyConnectionFailure, saveAPIKeyConnectionSuccess } from '../tenantReducer';
|
|
5
|
-
export type ActionType = ReturnType<typeof saveAPIKeyConnection> | ReturnType<typeof saveAPIKeyConnectionSuccess> | ReturnType<typeof saveAPIKeyConnectionFailure>;
|
|
6
|
-
export declare const saveAPIKeyConnectionEpic: (actions$: ActionsObservable<ActionType>, _: StateObservable<RootState>, zeniAPI: ZeniAPI) => import("rxjs").Observable<{
|
|
7
|
-
payload: {
|
|
8
|
-
tenantId: string;
|
|
9
|
-
connectionType: "analytics" | "crm";
|
|
10
|
-
connectionPayload: import("../tenantPayload").ConnectionDataPayload;
|
|
11
|
-
};
|
|
12
|
-
type: "tenant/saveAPIKeyConnectionSuccess";
|
|
13
|
-
} | {
|
|
14
|
-
payload: {
|
|
15
|
-
tenantId: string;
|
|
16
|
-
status: import("../../../responsePayload").ZeniAPIStatus<Record<string, unknown>>;
|
|
17
|
-
};
|
|
18
|
-
type: "tenant/saveAPIKeyConnectionFailure";
|
|
19
|
-
}>;
|
|
@@ -1,31 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.saveAPIKeyConnectionEpic = void 0;
|
|
4
|
-
const rxjs_1 = require("rxjs");
|
|
5
|
-
const operators_1 = require("rxjs/operators");
|
|
6
|
-
const responsePayload_1 = require("../../../responsePayload");
|
|
7
|
-
const tenantReducer_1 = require("../tenantReducer");
|
|
8
|
-
const saveAPIKeyConnectionEpic = (actions$, _, zeniAPI) => actions$.pipe((0, operators_1.filter)(tenantReducer_1.saveAPIKeyConnection.match), (0, operators_1.switchMap)((action) => zeniAPI
|
|
9
|
-
.putAndGetJSON(`${zeniAPI.apiEndPoints.tenantMicroServiceBaseUrl}/1.0/connections/${action.payload.connectionId}`, {
|
|
10
|
-
api_key: action.payload.credentials.api_key,
|
|
11
|
-
connection_name: action.payload.connectionName,
|
|
12
|
-
connection_type: action.payload.connectionType,
|
|
13
|
-
site: action.payload.credentials.site,
|
|
14
|
-
}, Object.assign({ 'zeni-tenant-id': action.payload.tenantId }))
|
|
15
|
-
.pipe((0, operators_1.mergeMap)((response) => {
|
|
16
|
-
if ((0, responsePayload_1.isSuccessResponse)(response)) {
|
|
17
|
-
return (0, rxjs_1.from)([
|
|
18
|
-
(0, tenantReducer_1.saveAPIKeyConnectionSuccess)(action.payload.tenantId, action.payload.connectionType, response.data // eslint-disable-line @typescript-eslint/no-non-null-assertion
|
|
19
|
-
),
|
|
20
|
-
]);
|
|
21
|
-
}
|
|
22
|
-
const status = response.status ??
|
|
23
|
-
(0, responsePayload_1.createZeniAPIStatus)('Failed to save connection. Please try again.');
|
|
24
|
-
return (0, rxjs_1.from)([(0, tenantReducer_1.saveAPIKeyConnectionFailure)(action.payload.tenantId, status)]);
|
|
25
|
-
}), (0, operators_1.catchError)((error) => {
|
|
26
|
-
const message = error instanceof Error ? error.message : 'Unexpected error saving connection.';
|
|
27
|
-
return (0, rxjs_1.from)([
|
|
28
|
-
(0, tenantReducer_1.saveAPIKeyConnectionFailure)(action.payload.tenantId, (0, responsePayload_1.createZeniAPIStatus)(message)),
|
|
29
|
-
]);
|
|
30
|
-
}))));
|
|
31
|
-
exports.saveAPIKeyConnectionEpic = saveAPIKeyConnectionEpic;
|
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
import { ActionsObservable, StateObservable } from 'redux-observable';
|
|
2
|
-
import { RootState } from '../../../reducer';
|
|
3
|
-
import { ZeniAPI } from '../../../zeniAPI';
|
|
4
|
-
import { saveOAuthConnection, saveOAuthConnectionFailure, saveOAuthConnectionSuccess } from '../tenantReducer';
|
|
5
|
-
export type ActionType = ReturnType<typeof saveOAuthConnection> | ReturnType<typeof saveOAuthConnectionSuccess> | ReturnType<typeof saveOAuthConnectionFailure>;
|
|
6
|
-
export declare const saveOAuthConnectionEpic: (actions$: ActionsObservable<ActionType>, _: StateObservable<RootState>, zeniAPI: ZeniAPI) => import("rxjs").Observable<{
|
|
7
|
-
payload: {
|
|
8
|
-
tenantId: string;
|
|
9
|
-
connectionType: "analytics" | "crm";
|
|
10
|
-
connectionPayload: import("../tenantPayload").ConnectionDataPayload;
|
|
11
|
-
};
|
|
12
|
-
type: "tenant/saveOAuthConnectionSuccess";
|
|
13
|
-
} | {
|
|
14
|
-
payload: {
|
|
15
|
-
tenantId: string;
|
|
16
|
-
status: import("../../../responsePayload").ZeniAPIStatus<Record<string, unknown>>;
|
|
17
|
-
};
|
|
18
|
-
type: "tenant/saveOAuthConnectionFailure";
|
|
19
|
-
}>;
|
|
@@ -1,33 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.saveOAuthConnectionEpic = void 0;
|
|
4
|
-
const rxjs_1 = require("rxjs");
|
|
5
|
-
const operators_1 = require("rxjs/operators");
|
|
6
|
-
const responsePayload_1 = require("../../../responsePayload");
|
|
7
|
-
const tenantReducer_1 = require("../tenantReducer");
|
|
8
|
-
const saveOAuthConnectionEpic = (actions$, _, zeniAPI) => actions$.pipe((0, operators_1.filter)(tenantReducer_1.saveOAuthConnection.match), (0, operators_1.switchMap)((action) => zeniAPI
|
|
9
|
-
.putAndGetJSON(`${zeniAPI.apiEndPoints.tenantMicroServiceBaseUrl}/1.0/connections/${action.payload.connectionId}`, {
|
|
10
|
-
authorization_code: action.payload.credentials.authorization_code,
|
|
11
|
-
client_id: action.payload.credentials.client_id,
|
|
12
|
-
client_secret: action.payload.credentials.client_secret,
|
|
13
|
-
connection_name: action.payload.connectionName,
|
|
14
|
-
connection_type: action.payload.connectionType,
|
|
15
|
-
redirect_uri: action.payload.credentials.redirect_uri,
|
|
16
|
-
}, Object.assign({ 'zeni-tenant-id': action.payload.tenantId }))
|
|
17
|
-
.pipe((0, operators_1.mergeMap)((response) => {
|
|
18
|
-
if ((0, responsePayload_1.isSuccessResponse)(response)) {
|
|
19
|
-
return (0, rxjs_1.from)([
|
|
20
|
-
(0, tenantReducer_1.saveOAuthConnectionSuccess)(action.payload.tenantId, action.payload.connectionType, response.data // eslint-disable-line @typescript-eslint/no-non-null-assertion
|
|
21
|
-
),
|
|
22
|
-
]);
|
|
23
|
-
}
|
|
24
|
-
const status = response.status ??
|
|
25
|
-
(0, responsePayload_1.createZeniAPIStatus)('Failed to save connection. Please try again.');
|
|
26
|
-
return (0, rxjs_1.from)([(0, tenantReducer_1.saveOAuthConnectionFailure)(action.payload.tenantId, status)]);
|
|
27
|
-
}), (0, operators_1.catchError)((error) => {
|
|
28
|
-
const message = error instanceof Error ? error.message : 'Unexpected error saving connection.';
|
|
29
|
-
return (0, rxjs_1.from)([
|
|
30
|
-
(0, tenantReducer_1.saveOAuthConnectionFailure)(action.payload.tenantId, (0, responsePayload_1.createZeniAPIStatus)(message)),
|
|
31
|
-
]);
|
|
32
|
-
}))));
|
|
33
|
-
exports.saveOAuthConnectionEpic = saveOAuthConnectionEpic;
|
|
@@ -1,25 +0,0 @@
|
|
|
1
|
-
import { from } from 'rxjs';
|
|
2
|
-
import { catchError, filter, mergeMap, switchMap } from 'rxjs/operators';
|
|
3
|
-
import { createZeniAPIStatus, isSuccessStatus, } from '../../../responsePayload';
|
|
4
|
-
import { deleteConnection, deleteConnectionFailure, deleteConnectionSuccess, } from '../tenantReducer';
|
|
5
|
-
export const deleteConnectionEpic = (actions$, _, zeniAPI) => actions$.pipe(filter(deleteConnection.match), switchMap((action) => zeniAPI
|
|
6
|
-
.deleteAndGetJSON(`${zeniAPI.apiEndPoints.tenantMicroServiceBaseUrl}/1.0/connections/${action.payload.connectionId}`, undefined, Object.assign({ 'zeni-tenant-id': action.payload.tenantId }))
|
|
7
|
-
.pipe(mergeMap((response) => {
|
|
8
|
-
if (isSuccessStatus(response)) {
|
|
9
|
-
return from([
|
|
10
|
-
deleteConnectionSuccess(action.payload.tenantId, action.payload.connectionId, action.payload.connectionType),
|
|
11
|
-
]);
|
|
12
|
-
}
|
|
13
|
-
const status = response.status ??
|
|
14
|
-
createZeniAPIStatus('Failed to delete connection. Please try again.');
|
|
15
|
-
return from([
|
|
16
|
-
deleteConnectionFailure(action.payload.tenantId, status),
|
|
17
|
-
]);
|
|
18
|
-
}), catchError((error) => {
|
|
19
|
-
const message = error instanceof Error
|
|
20
|
-
? error.message
|
|
21
|
-
: 'Unexpected error deleting connection.';
|
|
22
|
-
return from([
|
|
23
|
-
deleteConnectionFailure(action.payload.tenantId, createZeniAPIStatus(message)),
|
|
24
|
-
]);
|
|
25
|
-
}))));
|
|
@@ -1,27 +0,0 @@
|
|
|
1
|
-
import { from } from 'rxjs';
|
|
2
|
-
import { catchError, filter, mergeMap, switchMap } from 'rxjs/operators';
|
|
3
|
-
import { createZeniAPIStatus, isSuccessResponse } from '../../../responsePayload';
|
|
4
|
-
import { saveAPIKeyConnection, saveAPIKeyConnectionFailure, saveAPIKeyConnectionSuccess, } from '../tenantReducer';
|
|
5
|
-
export const saveAPIKeyConnectionEpic = (actions$, _, zeniAPI) => actions$.pipe(filter(saveAPIKeyConnection.match), switchMap((action) => zeniAPI
|
|
6
|
-
.putAndGetJSON(`${zeniAPI.apiEndPoints.tenantMicroServiceBaseUrl}/1.0/connections/${action.payload.connectionId}`, {
|
|
7
|
-
api_key: action.payload.credentials.api_key,
|
|
8
|
-
connection_name: action.payload.connectionName,
|
|
9
|
-
connection_type: action.payload.connectionType,
|
|
10
|
-
site: action.payload.credentials.site,
|
|
11
|
-
}, Object.assign({ 'zeni-tenant-id': action.payload.tenantId }))
|
|
12
|
-
.pipe(mergeMap((response) => {
|
|
13
|
-
if (isSuccessResponse(response)) {
|
|
14
|
-
return from([
|
|
15
|
-
saveAPIKeyConnectionSuccess(action.payload.tenantId, action.payload.connectionType, response.data // eslint-disable-line @typescript-eslint/no-non-null-assertion
|
|
16
|
-
),
|
|
17
|
-
]);
|
|
18
|
-
}
|
|
19
|
-
const status = response.status ??
|
|
20
|
-
createZeniAPIStatus('Failed to save connection. Please try again.');
|
|
21
|
-
return from([saveAPIKeyConnectionFailure(action.payload.tenantId, status)]);
|
|
22
|
-
}), catchError((error) => {
|
|
23
|
-
const message = error instanceof Error ? error.message : 'Unexpected error saving connection.';
|
|
24
|
-
return from([
|
|
25
|
-
saveAPIKeyConnectionFailure(action.payload.tenantId, createZeniAPIStatus(message)),
|
|
26
|
-
]);
|
|
27
|
-
}))));
|
|
@@ -1,29 +0,0 @@
|
|
|
1
|
-
import { from } from 'rxjs';
|
|
2
|
-
import { catchError, filter, mergeMap, switchMap } from 'rxjs/operators';
|
|
3
|
-
import { createZeniAPIStatus, isSuccessResponse } from '../../../responsePayload';
|
|
4
|
-
import { saveOAuthConnection, saveOAuthConnectionFailure, saveOAuthConnectionSuccess, } from '../tenantReducer';
|
|
5
|
-
export const saveOAuthConnectionEpic = (actions$, _, zeniAPI) => actions$.pipe(filter(saveOAuthConnection.match), switchMap((action) => zeniAPI
|
|
6
|
-
.putAndGetJSON(`${zeniAPI.apiEndPoints.tenantMicroServiceBaseUrl}/1.0/connections/${action.payload.connectionId}`, {
|
|
7
|
-
authorization_code: action.payload.credentials.authorization_code,
|
|
8
|
-
client_id: action.payload.credentials.client_id,
|
|
9
|
-
client_secret: action.payload.credentials.client_secret,
|
|
10
|
-
connection_name: action.payload.connectionName,
|
|
11
|
-
connection_type: action.payload.connectionType,
|
|
12
|
-
redirect_uri: action.payload.credentials.redirect_uri,
|
|
13
|
-
}, Object.assign({ 'zeni-tenant-id': action.payload.tenantId }))
|
|
14
|
-
.pipe(mergeMap((response) => {
|
|
15
|
-
if (isSuccessResponse(response)) {
|
|
16
|
-
return from([
|
|
17
|
-
saveOAuthConnectionSuccess(action.payload.tenantId, action.payload.connectionType, response.data // eslint-disable-line @typescript-eslint/no-non-null-assertion
|
|
18
|
-
),
|
|
19
|
-
]);
|
|
20
|
-
}
|
|
21
|
-
const status = response.status ??
|
|
22
|
-
createZeniAPIStatus('Failed to save connection. Please try again.');
|
|
23
|
-
return from([saveOAuthConnectionFailure(action.payload.tenantId, status)]);
|
|
24
|
-
}), catchError((error) => {
|
|
25
|
-
const message = error instanceof Error ? error.message : 'Unexpected error saving connection.';
|
|
26
|
-
return from([
|
|
27
|
-
saveOAuthConnectionFailure(action.payload.tenantId, createZeniAPIStatus(message)),
|
|
28
|
-
]);
|
|
29
|
-
}))));
|