@abyss-project/reflex 6.9.0 → 6.9.1
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/types/interface/api/responses/reflex-admin.admin.response.d.ts +4 -1
- package/dist/types/interface/models/reflex-admin-hold.model.d.ts +6 -0
- package/dist/types/interface/models/reflex-admin-hold.model.js.map +1 -1
- package/package.json +1 -1
- package/src/api/reflex-admin.admin.api.test.ts +27 -1
- package/src/types/interface/api/responses/reflex-admin.admin.response.ts +8 -1
- package/src/types/interface/models/reflex-admin-hold.model.ts +9 -0
|
@@ -1,15 +1,18 @@
|
|
|
1
|
-
import type { IReflexAdminUsageRow, IReflexServiceDeployment } from '../../models';
|
|
1
|
+
import type { IReflexAdminServiceContext, IReflexAdminUsageRow, IReflexServiceDeployment } from '../../models';
|
|
2
2
|
import type { IResponse } from '../response';
|
|
3
3
|
export interface ISetServiceHoldAdminData {
|
|
4
4
|
deployment: IReflexServiceDeployment;
|
|
5
|
+
service: IReflexAdminServiceContext;
|
|
5
6
|
}
|
|
6
7
|
export type ISetServiceHoldAdminResponse = IResponse<ISetServiceHoldAdminData>;
|
|
7
8
|
export interface ILiftServiceHoldAdminData {
|
|
8
9
|
deployment: IReflexServiceDeployment;
|
|
10
|
+
service: IReflexAdminServiceContext;
|
|
9
11
|
}
|
|
10
12
|
export type ILiftServiceHoldAdminResponse = IResponse<ILiftServiceHoldAdminData>;
|
|
11
13
|
export interface IWithdrawServiceHoldAdminData {
|
|
12
14
|
withdrawn: true;
|
|
15
|
+
service: IReflexAdminServiceContext;
|
|
13
16
|
}
|
|
14
17
|
export type IWithdrawServiceHoldAdminResponse = IResponse<IWithdrawServiceHoldAdminData>;
|
|
15
18
|
export interface IListUsageAdminData {
|
|
@@ -4,6 +4,12 @@ export interface IReflexAdminHold {
|
|
|
4
4
|
environmentId: string;
|
|
5
5
|
createdAt: Date;
|
|
6
6
|
}
|
|
7
|
+
export interface IReflexAdminServiceContext {
|
|
8
|
+
id: string;
|
|
9
|
+
name: string;
|
|
10
|
+
applicationId: string;
|
|
11
|
+
projectId: string;
|
|
12
|
+
}
|
|
7
13
|
export declare const REFLEX_ABUSE_THRESHOLDS: {
|
|
8
14
|
readonly windowMinutes: 60;
|
|
9
15
|
readonly failureRate: {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"reflex-admin-hold.model.js","sourceRoot":"","sources":["../../../../src/types/interface/models/reflex-admin-hold.model.ts"],"names":[],"mappings":";;;
|
|
1
|
+
{"version":3,"file":"reflex-admin-hold.model.js","sourceRoot":"","sources":["../../../../src/types/interface/models/reflex-admin-hold.model.ts"],"names":[],"mappings":";;;AA6Ba,QAAA,uBAAuB,GAAG;IACrC,aAAa,EAAE,EAAE;IACjB,WAAW,EAAE,EAAE,OAAO,EAAE,GAAG,EAAE,QAAQ,EAAE,GAAG,EAAE;IAC5C,SAAS,EAAE,EAAE,YAAY,EAAE,CAAC,EAAE,MAAM,EAAE,EAAE,EAAE,eAAe,EAAE,OAAO,EAAE;IACpE,MAAM,EAAE,EAAE,QAAQ,EAAE,aAAa,EAAE;IACnC,kBAAkB,EAAE,EAAE;CACd,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,5 +1,10 @@
|
|
|
1
1
|
import { AxiosAdapter, InternalAxiosRequestConfig } from 'axios';
|
|
2
|
-
import {
|
|
2
|
+
import {
|
|
3
|
+
ADMIN_TOKEN_HEADER,
|
|
4
|
+
AbyssReflexCore,
|
|
5
|
+
IReflexAdminServiceContext,
|
|
6
|
+
ReflexAdminHoldKind,
|
|
7
|
+
} from '..';
|
|
3
8
|
|
|
4
9
|
const BASE = 'api/reflex/admin/service/svc-1/environment/env-1';
|
|
5
10
|
const PARAMS = { serviceId: 'svc-1', environmentId: 'env-1' };
|
|
@@ -41,6 +46,27 @@ describe('AbyssReflexCore admin hold and usage routes (back-office of abyss-main
|
|
|
41
46
|
expect(sent().url).toBe(`${BASE}/withdraw`);
|
|
42
47
|
});
|
|
43
48
|
|
|
49
|
+
it('answers the context of the Service next to what the gesture did', async () => {
|
|
50
|
+
const context: IReflexAdminServiceContext = {
|
|
51
|
+
id: 'svc-1',
|
|
52
|
+
name: 'Orders',
|
|
53
|
+
applicationId: 'app-1',
|
|
54
|
+
projectId: 'project-1',
|
|
55
|
+
};
|
|
56
|
+
adapter.mockImplementationOnce(async (config) => ({
|
|
57
|
+
data: { data: { withdrawn: true, service: context } },
|
|
58
|
+
status: 200,
|
|
59
|
+
statusText: '',
|
|
60
|
+
headers: {},
|
|
61
|
+
config,
|
|
62
|
+
}));
|
|
63
|
+
|
|
64
|
+
const response = await AbyssReflexCore.sdk.serviceHold.admin.withdraw(PARAMS);
|
|
65
|
+
|
|
66
|
+
expect(response.data.service).toEqual(context);
|
|
67
|
+
expect(response.data.withdrawn).toBe(true);
|
|
68
|
+
});
|
|
69
|
+
|
|
44
70
|
it('usage list gets /usage with window, sort and page as query', async () => {
|
|
45
71
|
await AbyssReflexCore.sdk.usage.admin.list({ window: '7d', sort: 'netOut', page: 2 });
|
|
46
72
|
|
|
@@ -1,18 +1,25 @@
|
|
|
1
|
-
import type {
|
|
1
|
+
import type {
|
|
2
|
+
IReflexAdminServiceContext,
|
|
3
|
+
IReflexAdminUsageRow,
|
|
4
|
+
IReflexServiceDeployment,
|
|
5
|
+
} from '../../models';
|
|
2
6
|
import type { IResponse } from '../response';
|
|
3
7
|
|
|
4
8
|
export interface ISetServiceHoldAdminData {
|
|
5
9
|
deployment: IReflexServiceDeployment;
|
|
10
|
+
service: IReflexAdminServiceContext;
|
|
6
11
|
}
|
|
7
12
|
export type ISetServiceHoldAdminResponse = IResponse<ISetServiceHoldAdminData>;
|
|
8
13
|
|
|
9
14
|
export interface ILiftServiceHoldAdminData {
|
|
10
15
|
deployment: IReflexServiceDeployment;
|
|
16
|
+
service: IReflexAdminServiceContext;
|
|
11
17
|
}
|
|
12
18
|
export type ILiftServiceHoldAdminResponse = IResponse<ILiftServiceHoldAdminData>;
|
|
13
19
|
|
|
14
20
|
export interface IWithdrawServiceHoldAdminData {
|
|
15
21
|
withdrawn: true;
|
|
22
|
+
service: IReflexAdminServiceContext;
|
|
16
23
|
}
|
|
17
24
|
export type IWithdrawServiceHoldAdminResponse = IResponse<IWithdrawServiceHoldAdminData>;
|
|
18
25
|
|
|
@@ -14,6 +14,15 @@ export interface IReflexAdminHold {
|
|
|
14
14
|
createdAt: Date;
|
|
15
15
|
}
|
|
16
16
|
|
|
17
|
+
/** Which Service an admin gesture acted on: what abyss-main needs to audit it and to tell the project's members. */
|
|
18
|
+
export interface IReflexAdminServiceContext {
|
|
19
|
+
id: string;
|
|
20
|
+
name: string;
|
|
21
|
+
applicationId: string;
|
|
22
|
+
/** The project of the application (`reflexApplications.projectId`). */
|
|
23
|
+
projectId: string;
|
|
24
|
+
}
|
|
25
|
+
|
|
17
26
|
/**
|
|
18
27
|
* Thresholds of the abuse detector, over a sliding window. Money is in millicredits: 1 credit = 1000 millicredits
|
|
19
28
|
* (as the price list), so `minMillicredits: 100_000` is 100 credits.
|