@heathmont/lab-flask
Advanced tools
Comparing version 0.1.25 to 0.1.26
@@ -6,2 +6,3 @@ "use strict"; | ||
const node_logger_1 = require("@heathmont/node-logger"); | ||
const _1 = require("./"); | ||
const bindImplementations = (labConfig, substance, actKindEnum, implementations) => { | ||
@@ -13,3 +14,3 @@ const { expressServer } = labConfig; | ||
const implementation = implementations[actEnumInt]; | ||
expressServer.post(`${labConfig.flaskPathname}/${actPath}`, async (req, res) => { | ||
expressServer.post(`${labConfig.flaskPathname}/${_1.PROTOBUF_URL_PREFIX}/${actPath}`, async (req, res) => { | ||
const isSignatureValid = labConfig.hmCrypto.isValid(req.body, req.headers['x-lab-signature']); | ||
@@ -16,0 +17,0 @@ const context = createUrls_1.getContextFromQueryString(req.query.c, actKindEnum); |
@@ -6,2 +6,3 @@ import 'source-map-support/register'; | ||
import * as Long from 'long'; | ||
export declare const PROTOBUF_URL_PREFIX = "protobuf"; | ||
export declare const implementFlaskMeta: (metaFunction: any) => Proto.Substance.Flask.Reaction.HealthCheck.Request; | ||
@@ -8,0 +9,0 @@ export interface InitOptions { |
@@ -21,2 +21,3 @@ "use strict"; | ||
const bigNumberToString_1 = require("./bigNumberToString"); | ||
exports.PROTOBUF_URL_PREFIX = 'protobuf'; | ||
exports.implementFlaskMeta = (metaFunction) => { | ||
@@ -54,3 +55,3 @@ return new coingaming_protobuf_1.Proto.Substance.Flask.Reaction.HealthCheck.Request({}); | ||
if (expressServer) { | ||
expressServer.post(`${flaskPathname}`, bodyParser.raw({ | ||
expressServer.post(`${flaskPathname}/${exports.PROTOBUF_URL_PREFIX}`, bodyParser.raw({ | ||
type: 'application/*', | ||
@@ -57,0 +58,0 @@ limit: '10mb', |
{ | ||
"name": "@heathmont/lab-flask", | ||
"version": "0.1.25", | ||
"version": "0.1.26", | ||
"author": "Margus Lamp", | ||
@@ -5,0 +5,0 @@ "main": "./dist/index.js", |
@@ -6,3 +6,3 @@ import { Proto } from '@heathmont/coingaming-protobuf'; | ||
import express = require('express'); | ||
import { LabConfig } from './'; | ||
import { LabConfig, PROTOBUF_URL_PREFIX } from './'; | ||
@@ -19,3 +19,3 @@ const bindImplementations = ( | ||
const implementation = implementations[actEnumInt]; | ||
expressServer.post(`${labConfig.flaskPathname}/${actPath}`, async (req: express.Request, res) => { | ||
expressServer.post(`${labConfig.flaskPathname}/${PROTOBUF_URL_PREFIX}/${actPath}`, async (req: express.Request, res) => { | ||
const isSignatureValid = labConfig.hmCrypto.isValid(req.body, req.headers['x-lab-signature']); | ||
@@ -22,0 +22,0 @@ const context: Context = getContextFromQueryString(req.query.c, actKindEnum); |
@@ -55,6 +55,6 @@ import axios from 'axios'; | ||
labUrl: 'http://localhost', | ||
flaskUrl: 'http://localhost/protobuf', | ||
flaskUrl: 'http://localhost/lab-implementation', | ||
flaskName: 'test_flask', | ||
instanceUuid: 'test-uuid', | ||
instanceUrl: 'http://localhost', | ||
instanceUrl: 'http://localhost-instance/lab-implementation', | ||
healthCheckFunction: () => Proto.Substance.Lab.Reaction.Heartbeat.Request.Status.RUNNING, | ||
@@ -77,3 +77,3 @@ autoStartHealthChecks: false, | ||
it('should have know how to show instance url', () => { | ||
expect(lab.getInstanceUrl()).toBe('http://localhost'); | ||
expect(lab.getInstanceUrl()).toBe('http://localhost-instance/lab-implementation'); | ||
}); | ||
@@ -142,6 +142,6 @@ it('should know how to call reaction', async () => { | ||
expect(expressServer.post).toBeCalledTimes(2); | ||
expect(expressServer.post.mock.calls[0][0]).toBe('/protobuf'); | ||
expect(expressServer.post.mock.calls[0][0]).toBe('/lab-implementation/protobuf'); | ||
const substanceCall = expressServer.post.mock.calls[0][1]; | ||
expect(typeof substanceCall).toBe('function'); | ||
expect(expressServer.post.mock.calls[1][0]).toBe('/protobuf/users/reaction/create_user'); | ||
expect(expressServer.post.mock.calls[1][0]).toBe('/lab-implementation/protobuf/users/reaction/create_user'); | ||
expect(typeof expressServer.post.mock.calls[1][1]).toBe('function'); | ||
@@ -148,0 +148,0 @@ }); |
@@ -22,2 +22,4 @@ import 'source-map-support/register'; | ||
export const PROTOBUF_URL_PREFIX = 'protobuf'; | ||
export const implementFlaskMeta = (metaFunction): Proto.Substance.Flask.Reaction.HealthCheck.Request => { | ||
@@ -122,3 +124,3 @@ return new Proto.Substance.Flask.Reaction.HealthCheck.Request({}); | ||
if (expressServer) { | ||
expressServer.post(`${flaskPathname}`, bodyParser.raw({ | ||
expressServer.post(`${flaskPathname}/${PROTOBUF_URL_PREFIX}`, bodyParser.raw({ | ||
type: 'application/*', | ||
@@ -125,0 +127,0 @@ limit: '10mb', |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
97705
1768