@bitblit/ratchet-epsilon-common 4.0.109-alpha → 4.0.110-alpha
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/epsilon-constants.js
CHANGED
|
@@ -12,7 +12,7 @@ export class EpsilonConstants {
|
|
|
12
12
|
static BACKGROUND_SNS_IMMEDIATE_RUN_FLAG = 'BACKGROUND_IMMEDIATE_RUN_FLAG';
|
|
13
13
|
static INTER_API_SNS_EVENT = 'EPSILON_INTER_API_EVENT';
|
|
14
14
|
static load(filePath, className) {
|
|
15
|
-
Logger.info('Searching for %s : %s : %s', filePath, className, EsmRatchet.fetchDirName());
|
|
15
|
+
Logger.info('Searching for %s : %s : %s', filePath, className, EsmRatchet.fetchDirName(import.meta.url));
|
|
16
16
|
let rval = null;
|
|
17
17
|
const val = require(filePath);
|
|
18
18
|
if (val) {
|
|
@@ -138,16 +138,20 @@ describe('#eventUtil', function () {
|
|
|
138
138
|
expect(basic.password).toEqual('testpass');
|
|
139
139
|
});
|
|
140
140
|
it('should add a token to an event, along with downstream stuff', function () {
|
|
141
|
-
const evt = JSON.parse(fs
|
|
141
|
+
const evt = JSON.parse(fs
|
|
142
|
+
.readFileSync(path.join(EsmRatchet.fetchDirName(import.meta.url), '../../../../test-data/epsilon/sample-json/sample-request-1.json'))
|
|
143
|
+
.toString());
|
|
142
144
|
const jwtToken = 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJleHAiOjE1ODg1MzY3NzU4ODcsImlzcyI6Im5lb24uYWRvbW5pLmNvbSIsInN1YiI6ImJpdGJsaXRAZ21haWwuY29tIiwiaWF0IjoxNTg4NTMzMTc1ODg3LCJ1c2VyIjp7ImlkIjo2LCJmaXJzdE5hbWUiOiJDaHJpcyIsImxhc3ROYW1lIjoiV2Vpc3MiLCJjb21wYW55IjoiQWRvbW5pIiwiZW1haWwiOiJiaXRibGl0QGdtYWlsLmNvbSIsImN1c3RvbWVyVHlwZSI6IkFETUlOIn0sImFjdGluZ1VzZXJJZCI6NiwiZ2xvYmFsIjp0cnVlLCJhZG1pbiI6eyJpZCI6NiwiZmlyc3ROYW1lIjoiQ2hyaXMiLCJsYXN0TmFtZSI6IldlaXNzIiwiY29tcGFueSI6IkFkb21uaSIsImVtYWlsIjoiYml0YmxpdEBnbWFpbC5jb20iLCJjdXN0b21lclR5cGUiOiJBRE1JTiJ9LCJzdWJVc2VycyI6W119.mwRSek5GwkvxpN44UTp49W6_9U_ARsFXThAyiqaF-eQ';
|
|
143
145
|
EventUtil.applyTokenToEventForTesting(evt, jwtToken);
|
|
144
146
|
const roundTripTokenString = EventUtil.extractBearerTokenFromEvent(evt);
|
|
145
147
|
expect(roundTripTokenString).toEqual(jwtToken);
|
|
146
148
|
});
|
|
147
149
|
it('should check if an event is a graphql introspection', function () {
|
|
148
|
-
const evt1 = JSON.parse(fs
|
|
150
|
+
const evt1 = JSON.parse(fs
|
|
151
|
+
.readFileSync(path.join(EsmRatchet.fetchDirName(import.meta.url), '../../../../test-data/epsilon/sample-json/sample-request-1.json'))
|
|
152
|
+
.toString());
|
|
149
153
|
const evt2 = JSON.parse(fs
|
|
150
|
-
.readFileSync(path.join(EsmRatchet.fetchDirName(), '../../../../test-data/epsilon/sample-json/sample-gql-introspection.json'))
|
|
154
|
+
.readFileSync(path.join(EsmRatchet.fetchDirName(import.meta.url), '../../../../test-data/epsilon/sample-json/sample-gql-introspection.json'))
|
|
151
155
|
.toString());
|
|
152
156
|
const res1 = EventUtil.eventIsAGraphQLIntrospection(evt1);
|
|
153
157
|
const res2 = EventUtil.eventIsAGraphQLIntrospection(evt2);
|
|
@@ -36,7 +36,7 @@ describe('#responseUtil', function () {
|
|
|
36
36
|
});
|
|
37
37
|
it('should leave already encoded stuff alone', async () => {
|
|
38
38
|
const singlePixel = fs
|
|
39
|
-
.readFileSync(path.join(EsmRatchet.fetchDirName(), '../../../../test-data/epsilon/test.png'))
|
|
39
|
+
.readFileSync(path.join(EsmRatchet.fetchDirName(import.meta.url), '../../../../test-data/epsilon/test.png'))
|
|
40
40
|
.toString('base64');
|
|
41
41
|
const temp = {
|
|
42
42
|
body: singlePixel,
|
|
@@ -53,7 +53,9 @@ describe('#responseUtil', function () {
|
|
|
53
53
|
expect(cast.body).toEqual(gzip.body);
|
|
54
54
|
});
|
|
55
55
|
it('should add cors to proxy result MATCH 1', async () => {
|
|
56
|
-
const evt = JSON.parse(fs
|
|
56
|
+
const evt = JSON.parse(fs
|
|
57
|
+
.readFileSync(path.join(EsmRatchet.fetchDirName(import.meta.url), '../../../../test-data/epsilon/sample-json/sample-request-1.json'))
|
|
58
|
+
.toString());
|
|
57
59
|
const proxy = {};
|
|
58
60
|
const fCtx = {
|
|
59
61
|
event: evt,
|
|
@@ -71,7 +73,9 @@ describe('#responseUtil', function () {
|
|
|
71
73
|
expect(proxy.headers['Access-Control-Allow-Headers']).toEqual(EpsilonConstants.AUTH_HEADER_NAME.toLowerCase());
|
|
72
74
|
});
|
|
73
75
|
it('should add cors to proxy result MATCH 2', async () => {
|
|
74
|
-
const evt = JSON.parse(fs
|
|
76
|
+
const evt = JSON.parse(fs
|
|
77
|
+
.readFileSync(path.join(EsmRatchet.fetchDirName(import.meta.url), '../../../../test-data/epsilon/sample-json/sample-request-2.json'))
|
|
78
|
+
.toString());
|
|
75
79
|
const proxy = {};
|
|
76
80
|
const fCtx = {
|
|
77
81
|
event: evt,
|
|
@@ -5,8 +5,8 @@ import { EsmRatchet } from '@bitblit/ratchet-common/lib/lang/esm-ratchet.js';
|
|
|
5
5
|
describe('#yamlCombiner', function () {
|
|
6
6
|
it('should combine yamls', async () => {
|
|
7
7
|
const files = [
|
|
8
|
-
path.join(EsmRatchet.fetchDirName(), '../../../../test-data/epsilon/sample-yaml/test1.yaml'),
|
|
9
|
-
path.join(EsmRatchet.fetchDirName(), '../../../../test-data/epsilon/sample-yaml/test2.yaml'),
|
|
8
|
+
path.join(EsmRatchet.fetchDirName(import.meta.url), '../../../../test-data/epsilon/sample-yaml/test1.yaml'),
|
|
9
|
+
path.join(EsmRatchet.fetchDirName(import.meta.url), '../../../../test-data/epsilon/sample-yaml/test2.yaml'),
|
|
10
10
|
];
|
|
11
11
|
const root = ['components', 'schemas'];
|
|
12
12
|
const result = YamlCombiner.combine(files, root);
|
|
@@ -5,7 +5,7 @@ import { EsmRatchet } from '@bitblit/ratchet-common/lib/lang/esm-ratchet.js';
|
|
|
5
5
|
describe('#cronUtil', function () {
|
|
6
6
|
it('should test matching event to entry', async () => {
|
|
7
7
|
const sEvent = JSON.parse(fs
|
|
8
|
-
.readFileSync(path.join(EsmRatchet.fetchDirName(), '../../../../test-data/epsilon/sample-json/sample-schedule-event-1.json'))
|
|
8
|
+
.readFileSync(path.join(EsmRatchet.fetchDirName(import.meta.url), '../../../../test-data/epsilon/sample-json/sample-schedule-event-1.json'))
|
|
9
9
|
.toString());
|
|
10
10
|
const cfg = {
|
|
11
11
|
context: 'prod',
|
|
@@ -35,7 +35,7 @@ describe('#cronUtil', function () {
|
|
|
35
35
|
});
|
|
36
36
|
it('should match times', async () => {
|
|
37
37
|
const sEvent = JSON.parse(fs
|
|
38
|
-
.readFileSync(path.join(EsmRatchet.fetchDirName(), '../../../../test-data/epsilon/sample-json/sample-schedule-event-1.json'))
|
|
38
|
+
.readFileSync(path.join(EsmRatchet.fetchDirName(import.meta.url), '../../../../test-data/epsilon/sample-json/sample-schedule-event-1.json'))
|
|
39
39
|
.toString());
|
|
40
40
|
const cfg = {
|
|
41
41
|
context: 'prod',
|
|
@@ -66,7 +66,7 @@ describe('#cronUtil', function () {
|
|
|
66
66
|
});
|
|
67
67
|
it('should match time with override', async () => {
|
|
68
68
|
const sEvent = JSON.parse(fs
|
|
69
|
-
.readFileSync(path.join(EsmRatchet.fetchDirName(), '../../../../test-data/epsilon/sample-json/sample-schedule-event-1.json'))
|
|
69
|
+
.readFileSync(path.join(EsmRatchet.fetchDirName(import.meta.url), '../../../../test-data/epsilon/sample-json/sample-schedule-event-1.json'))
|
|
70
70
|
.toString());
|
|
71
71
|
const cfg = {
|
|
72
72
|
context: 'prod',
|
|
@@ -89,7 +89,7 @@ describe('#cronUtil', function () {
|
|
|
89
89
|
});
|
|
90
90
|
it('should match day of month filters', async () => {
|
|
91
91
|
const sEvent = JSON.parse(fs
|
|
92
|
-
.readFileSync(path.join(EsmRatchet.fetchDirName(), '../../../../test-data/epsilon/sample-json/sample-schedule-event-1.json'))
|
|
92
|
+
.readFileSync(path.join(EsmRatchet.fetchDirName(import.meta.url), '../../../../test-data/epsilon/sample-json/sample-schedule-event-1.json'))
|
|
93
93
|
.toString());
|
|
94
94
|
const cfg = {
|
|
95
95
|
context: 'prod',
|
|
@@ -106,7 +106,7 @@ describe('#cronUtil', function () {
|
|
|
106
106
|
});
|
|
107
107
|
it('should match month of year filter', async () => {
|
|
108
108
|
const sEvent = JSON.parse(fs
|
|
109
|
-
.readFileSync(path.join(EsmRatchet.fetchDirName(), '../../../../test-data/epsilon/sample-json/sample-schedule-event-1.json'))
|
|
109
|
+
.readFileSync(path.join(EsmRatchet.fetchDirName(import.meta.url), '../../../../test-data/epsilon/sample-json/sample-schedule-event-1.json'))
|
|
110
110
|
.toString());
|
|
111
111
|
const cfg = {
|
|
112
112
|
context: 'prod',
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@bitblit/ratchet-epsilon-common",
|
|
3
|
-
"version": "4.0.
|
|
3
|
+
"version": "4.0.110-alpha",
|
|
4
4
|
"description": "Tiny adapter to simplify building API gateway Lambda APIS",
|
|
5
5
|
"sideEffects": false,
|
|
6
6
|
"bin": {
|
|
@@ -65,10 +65,10 @@
|
|
|
65
65
|
"@aws-sdk/client-s3": "3.315.0",
|
|
66
66
|
"@aws-sdk/client-sns": "3.315.0",
|
|
67
67
|
"@aws-sdk/client-sqs": "3.315.0",
|
|
68
|
-
"@bitblit/ratchet-aws": "4.0.
|
|
69
|
-
"@bitblit/ratchet-common": "4.0.
|
|
70
|
-
"@bitblit/ratchet-misc": "4.0.
|
|
71
|
-
"@bitblit/ratchet-node-only": "4.0.
|
|
68
|
+
"@bitblit/ratchet-aws": "4.0.110-alpha",
|
|
69
|
+
"@bitblit/ratchet-common": "4.0.110-alpha",
|
|
70
|
+
"@bitblit/ratchet-misc": "4.0.110-alpha",
|
|
71
|
+
"@bitblit/ratchet-node-only": "4.0.110-alpha",
|
|
72
72
|
"clear": "0.1.0",
|
|
73
73
|
"commander": "10.0.1",
|
|
74
74
|
"cross-fetch": "3.1.5",
|
|
@@ -110,8 +110,8 @@
|
|
|
110
110
|
"peerDependencies": {
|
|
111
111
|
"@aws-sdk/client-sns": "3.303.0",
|
|
112
112
|
"@aws-sdk/client-sqs": "3.303.0",
|
|
113
|
-
"@bitblit/ratchet-aws": "4.0.
|
|
114
|
-
"@bitblit/ratchet-common": "4.0.
|
|
113
|
+
"@bitblit/ratchet-aws": "4.0.110-alpha",
|
|
114
|
+
"@bitblit/ratchet-common": "4.0.110-alpha",
|
|
115
115
|
"@types/aws-lambda": "8.10.111",
|
|
116
116
|
"graphql": "16.6.0"
|
|
117
117
|
},
|
|
@@ -121,7 +121,7 @@
|
|
|
121
121
|
}
|
|
122
122
|
},
|
|
123
123
|
"devDependencies": {
|
|
124
|
-
"@bitblit/ratchet-jest": "4.0.
|
|
124
|
+
"@bitblit/ratchet-jest": "4.0.110-alpha",
|
|
125
125
|
"@types/aws-lambda": "8.10.114",
|
|
126
126
|
"apollo-server-lambda": "3.12.0",
|
|
127
127
|
"aws-sdk-client-mock": "2.1.1",
|