node-server-engine 1.1.6 → 1.1.8
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/.env.example +0 -38
- package/.nycrc +9 -3
- package/README.md +2 -3
- package/dist/const/tokenIssuer.d.ts +2 -4
- package/dist/const/tokenIssuer.js +0 -1
- package/dist/const/tokenIssuer.js.map +1 -1
- package/dist/entities/Endpoint/Endpoint.types.d.ts +2 -19
- package/dist/entities/Endpoint/Endpoint.types.js +1 -8
- package/dist/entities/Endpoint/Endpoint.types.js.map +1 -1
- package/dist/entities/Server/Server.js +5 -0
- package/dist/entities/Server/Server.js.map +1 -1
- package/dist/middleware/index.d.ts +0 -1
- package/dist/middleware/index.js +0 -11
- package/dist/middleware/index.js.map +1 -1
- package/dist/utils/index.d.ts +0 -1
- package/dist/utils/index.js +0 -11
- package/dist/utils/index.js.map +1 -1
- package/dist/utils/jwt/jwt.d.ts +0 -1
- package/dist/utils/jwt/jwt.js +2 -23
- package/dist/utils/jwt/jwt.js.map +1 -1
- package/dist/utils/report/report.js +1 -2
- package/dist/utils/report/report.js.map +1 -1
- package/package.json +9 -7
- package/src/const/tokenIssuer.ts +1 -3
- package/src/entities/Endpoint/Endpoint.test.ts +0 -89
- package/src/entities/Endpoint/Endpoint.types.ts +3 -30
- package/src/entities/KeySet/KeySet.test.ts +1 -1
- package/src/entities/Server/Server.ts +9 -0
- package/src/middleware/index.ts +0 -1
- package/src/utils/index.ts +0 -1
- package/src/utils/jwt/jwt.test.ts +0 -13
- package/src/utils/jwt/jwt.ts +2 -25
- package/src/utils/report/report.ts +1 -2
- package/test/env.ts +0 -5
- package/test/hooks.ts +0 -2
- package/dist/middleware/authAdmin/authAdmin.d.ts +0 -4
- package/dist/middleware/authAdmin/authAdmin.js +0 -105
- package/dist/middleware/authAdmin/authAdmin.js.map +0 -1
- package/dist/middleware/authAdmin/authAdmin.types.d.ts +0 -16
- package/dist/middleware/authAdmin/authAdmin.types.js +0 -2
- package/dist/middleware/authAdmin/authAdmin.types.js.map +0 -1
- package/dist/middleware/authAdmin/index.d.ts +0 -2
- package/dist/middleware/authAdmin/index.js +0 -28
- package/dist/middleware/authAdmin/index.js.map +0 -1
- package/dist/utils/getDynamicLink/getDynamicLink.d.ts +0 -3
- package/dist/utils/getDynamicLink/getDynamicLink.js +0 -28
- package/dist/utils/getDynamicLink/getDynamicLink.js.map +0 -1
- package/dist/utils/getDynamicLink/getDynamicLink.types.d.ts +0 -10
- package/dist/utils/getDynamicLink/getDynamicLink.types.js +0 -2
- package/dist/utils/getDynamicLink/getDynamicLink.types.js.map +0 -1
- package/dist/utils/getDynamicLink/getDynamicLink.validate.d.ts +0 -2
- package/dist/utils/getDynamicLink/getDynamicLink.validate.js +0 -14
- package/dist/utils/getDynamicLink/getDynamicLink.validate.js.map +0 -1
- package/dist/utils/getDynamicLink/index.d.ts +0 -2
- package/dist/utils/getDynamicLink/index.js +0 -28
- package/dist/utils/getDynamicLink/index.js.map +0 -1
- package/src/middleware/authAdmin/authAdmin.test.ts +0 -199
- package/src/middleware/authAdmin/authAdmin.ts +0 -114
- package/src/middleware/authAdmin/authAdmin.types.ts +0 -19
- package/src/middleware/authAdmin/index.ts +0 -2
- package/src/utils/getDynamicLink/getDynamicLink.test.ts +0 -51
- package/src/utils/getDynamicLink/getDynamicLink.ts +0 -28
- package/src/utils/getDynamicLink/getDynamicLink.types.ts +0 -11
- package/src/utils/getDynamicLink/getDynamicLink.validate.ts +0 -6
- package/src/utils/getDynamicLink/index.ts +0 -2
|
@@ -1,51 +0,0 @@
|
|
|
1
|
-
import { AxiosRequestConfig, AxiosResponse } from 'axios';
|
|
2
|
-
import chai, { expect } from 'chai';
|
|
3
|
-
import { faker } from '@faker-js/faker';
|
|
4
|
-
import { stub, SinonStub, match } from 'sinon';
|
|
5
|
-
import sinonChai from 'sinon-chai';
|
|
6
|
-
import { getDynamicLink } from './getDynamicLink';
|
|
7
|
-
import { DynamicLinkResponseBody } from './getDynamicLink.types';
|
|
8
|
-
import * as tlsRequest from 'utils/tlsRequest/tlsRequest';
|
|
9
|
-
|
|
10
|
-
chai.use(sinonChai);
|
|
11
|
-
|
|
12
|
-
describe('Utils - Get Dynamic Link', () => {
|
|
13
|
-
let expectedPayload: AxiosRequestConfig;
|
|
14
|
-
let path: string;
|
|
15
|
-
let requestStub: SinonStub;
|
|
16
|
-
let link: string;
|
|
17
|
-
|
|
18
|
-
beforeEach(() => {
|
|
19
|
-
link = faker.internet.url();
|
|
20
|
-
requestStub = stub(tlsRequest, 'tlsRequest').resolves({
|
|
21
|
-
data: { link }
|
|
22
|
-
} as AxiosResponse<DynamicLinkResponseBody>);
|
|
23
|
-
path = faker.system.directoryPath();
|
|
24
|
-
expectedPayload = {
|
|
25
|
-
method: 'get',
|
|
26
|
-
url: '/link',
|
|
27
|
-
baseURL: process.env.LINKS_SERVICE_URL,
|
|
28
|
-
params: {
|
|
29
|
-
path
|
|
30
|
-
}
|
|
31
|
-
};
|
|
32
|
-
});
|
|
33
|
-
|
|
34
|
-
it('should get a dynamic link', async () => {
|
|
35
|
-
// should return a link from the res
|
|
36
|
-
const dynamicLink = await getDynamicLink(path);
|
|
37
|
-
expect(dynamicLink).to.equal(link);
|
|
38
|
-
expect(requestStub).to.have.been.calledOnceWithExactly(
|
|
39
|
-
match(expectedPayload)
|
|
40
|
-
);
|
|
41
|
-
});
|
|
42
|
-
|
|
43
|
-
it('should get a dynamic link with custom settings', async () => {
|
|
44
|
-
// should return a link from the res
|
|
45
|
-
const dynamicLink = await getDynamicLink(path, { short: false });
|
|
46
|
-
expect(dynamicLink).to.equal(link);
|
|
47
|
-
expect(requestStub).to.have.been.calledOnceWithExactly(
|
|
48
|
-
match({ ...expectedPayload, params: { path, short: false } })
|
|
49
|
-
);
|
|
50
|
-
});
|
|
51
|
-
});
|
|
@@ -1,28 +0,0 @@
|
|
|
1
|
-
import { AxiosRequestConfig } from 'axios';
|
|
2
|
-
import {
|
|
3
|
-
getDynamicLinksOptions,
|
|
4
|
-
DynamicLinkResponseBody
|
|
5
|
-
} from './getDynamicLink.types';
|
|
6
|
-
import { validateDynamicLinkEnvironment } from './getDynamicLink.validate';
|
|
7
|
-
import { tlsRequest } from 'utils/tlsRequest';
|
|
8
|
-
|
|
9
|
-
/** Fetch a dynamic link from the links service */
|
|
10
|
-
export async function getDynamicLink(
|
|
11
|
-
path: string,
|
|
12
|
-
options: getDynamicLinksOptions = {}
|
|
13
|
-
): Promise<string> {
|
|
14
|
-
validateDynamicLinkEnvironment();
|
|
15
|
-
const option: AxiosRequestConfig = {
|
|
16
|
-
method: 'get',
|
|
17
|
-
url: '/link',
|
|
18
|
-
baseURL: process.env.LINKS_SERVICE_URL,
|
|
19
|
-
params: {
|
|
20
|
-
path,
|
|
21
|
-
short: options.short ?? true
|
|
22
|
-
}
|
|
23
|
-
};
|
|
24
|
-
const {
|
|
25
|
-
data: { link }
|
|
26
|
-
} = await tlsRequest<DynamicLinkResponseBody>(option);
|
|
27
|
-
return link;
|
|
28
|
-
}
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
/** Options to fetch dynamic links */
|
|
2
|
-
export interface getDynamicLinksOptions {
|
|
3
|
-
/** Make a shortened link */
|
|
4
|
-
short?: boolean;
|
|
5
|
-
}
|
|
6
|
-
|
|
7
|
-
/** Dynamic link query server response */
|
|
8
|
-
export interface DynamicLinkResponseBody {
|
|
9
|
-
/** The generated dynamic link */
|
|
10
|
-
link: string;
|
|
11
|
-
}
|