Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[#172724206] upgrade dependencies #41

Merged
merged 3 commits into from
May 8, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 3 additions & 12 deletions CreateService/__tests__/handler.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -36,10 +36,7 @@ describe("CreateServiceHandler", () => {
})
};

const createServiceHandler = CreateServiceHandler(
undefined as any,
mockServiceModel as any
);
const createServiceHandler = CreateServiceHandler(mockServiceModel as any);

const response = await createServiceHandler(
undefined as any, // Not used
Expand All @@ -64,10 +61,7 @@ describe("CreateServiceHandler", () => {
})
};

const createServiceHandler = CreateServiceHandler(
undefined as any,
mockServiceModel as any
);
const createServiceHandler = CreateServiceHandler(mockServiceModel as any);

const response = await createServiceHandler(
undefined as any, // Not used
Expand Down Expand Up @@ -99,10 +93,7 @@ describe("CreateServiceHandler", () => {
log: jest.fn()
};

const createServiceHandler = CreateServiceHandler(
undefined as any,
mockServiceModel as any
);
const createServiceHandler = CreateServiceHandler(mockServiceModel as any);

await createServiceHandler(
contextMock as any, // Not used
Expand Down
5 changes: 1 addition & 4 deletions CreateService/handler.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@ import {

import { Service as ApiService } from "io-functions-commons/dist/generated/definitions/Service";
import { ServiceModel } from "io-functions-commons/dist/src/models/service";
import { CustomTelemetryClientFactory } from "io-functions-commons/dist/src/utils/application_insights";
import {
AzureApiAuthMiddleware,
IAzureApiAuthorization,
Expand Down Expand Up @@ -48,7 +47,6 @@ type ICreateServiceHandler = (
>;

export function CreateServiceHandler(
_GCTC: CustomTelemetryClientFactory,
serviceModel: ServiceModel
): ICreateServiceHandler {
return async (context, _, servicePayload) => {
Expand Down Expand Up @@ -88,10 +86,9 @@ export function CreateServiceHandler(
* Wraps a CreateService handler inside an Express request handler.
*/
export function CreateService(
getCustomTelemetryClient: CustomTelemetryClientFactory,
serviceModel: ServiceModel
): express.RequestHandler {
const handler = CreateServiceHandler(getCustomTelemetryClient, serviceModel);
const handler = CreateServiceHandler(serviceModel);

const middlewaresWrap = withRequestMiddlewares(
// Extract Azure Functions bindings
Expand Down
17 changes: 1 addition & 16 deletions CreateService/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,6 @@ import {
ServiceModel
} from "io-functions-commons/dist/src/models/service";

import {
TelemetryClient,
wrapCustomTelemetryClient
} from "io-functions-commons/dist/src/utils/application_insights";
import * as documentDbUtils from "io-functions-commons/dist/src/utils/documentdb";
import { getRequiredStringEnv } from "io-functions-commons/dist/src/utils/env";
import { secureExpressApp } from "io-functions-commons/dist/src/utils/express";
Expand All @@ -24,14 +20,6 @@ import createAzureFunctionHandler from "io-functions-express/dist/src/createAzur

import { CreateService } from "./handler";

// Whether we're in a production environment
const isProduction = process.env.NODE_ENV === "production";

const getCustomTelemetryClient = wrapCustomTelemetryClient(
isProduction,
new TelemetryClient()
);

const cosmosDbUri = getRequiredStringEnv("COSMOSDB_URI");
const cosmosDbKey = getRequiredStringEnv("COSMOSDB_KEY");
const cosmosDbName = getRequiredStringEnv("COSMOSDB_NAME");
Expand Down Expand Up @@ -60,10 +48,7 @@ const app = express();
secureExpressApp(app);

// Add express route
app.post(
"/adm/services",
CreateService(getCustomTelemetryClient, serviceModel)
);
app.post("/adm/services", CreateService(serviceModel));

const azureFunctionHandler = createAzureFunctionHandler(app);

Expand Down
15 changes: 3 additions & 12 deletions GetService/__tests__/handler.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,10 +18,7 @@ describe("GetServiceHandler", () => {
})
};

const getServiceHandler = GetServiceHandler(
undefined as any,
mockServiceModel as any
);
const getServiceHandler = GetServiceHandler(mockServiceModel as any);
const response = await getServiceHandler(
undefined as any, // Not used
undefined as any, // Not used
Expand All @@ -42,10 +39,7 @@ describe("GetServiceHandler", () => {
})
};

const getServiceHandler = GetServiceHandler(
undefined as any,
mockServiceModel as any
);
const getServiceHandler = GetServiceHandler(mockServiceModel as any);
const response = await getServiceHandler(
undefined as any, // Not used
undefined as any, // Not used
Expand All @@ -66,10 +60,7 @@ describe("GetServiceHandler", () => {
})
};

const getServiceHandler = GetServiceHandler(
undefined as any,
mockServiceModel as any
);
const getServiceHandler = GetServiceHandler(mockServiceModel as any);
const response = await getServiceHandler(
undefined as any, // Not used
undefined as any, // Not used
Expand Down
9 changes: 2 additions & 7 deletions GetService/handler.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@ import {
import { Service as ApiService } from "io-functions-commons/dist/generated/definitions/Service";
import { ServiceId } from "io-functions-commons/dist/generated/definitions/ServiceId";
import { ServiceModel } from "io-functions-commons/dist/src/models/service";
import { CustomTelemetryClientFactory } from "io-functions-commons/dist/src/utils/application_insights";
import {
AzureApiAuthMiddleware,
IAzureApiAuthorization,
Expand Down Expand Up @@ -45,7 +44,6 @@ type IGetServiceHandler = (
>;

export function GetServiceHandler(
_GCTC: CustomTelemetryClientFactory,
serviceModel: ServiceModel
): IGetServiceHandler {
return async (_, __, serviceId) => {
Expand Down Expand Up @@ -77,11 +75,8 @@ export function GetServiceHandler(
/**
* Wraps a GetService handler inside an Express request handler.
*/
export function GetService(
getCustomTelemetryClient: CustomTelemetryClientFactory,
serviceModel: ServiceModel
): express.RequestHandler {
const handler = GetServiceHandler(getCustomTelemetryClient, serviceModel);
export function GetService(serviceModel: ServiceModel): express.RequestHandler {
const handler = GetServiceHandler(serviceModel);

const middlewaresWrap = withRequestMiddlewares(
// Extract Azure Functions bindings
Expand Down
17 changes: 1 addition & 16 deletions GetService/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,6 @@ import {
ServiceModel
} from "io-functions-commons/dist/src/models/service";

import {
TelemetryClient,
wrapCustomTelemetryClient
} from "io-functions-commons/dist/src/utils/application_insights";
import * as documentDbUtils from "io-functions-commons/dist/src/utils/documentdb";
import { getRequiredStringEnv } from "io-functions-commons/dist/src/utils/env";
import { secureExpressApp } from "io-functions-commons/dist/src/utils/express";
Expand All @@ -24,14 +20,6 @@ import createAzureFunctionHandler from "io-functions-express/dist/src/createAzur

import { GetService } from "./handler";

// Whether we're in a production environment
const isProduction = process.env.NODE_ENV === "production";

const getCustomTelemetryClient = wrapCustomTelemetryClient(
isProduction,
new TelemetryClient()
);

const cosmosDbUri = getRequiredStringEnv("COSMOSDB_URI");
const cosmosDbKey = getRequiredStringEnv("COSMOSDB_KEY");
const cosmosDbName = getRequiredStringEnv("COSMOSDB_NAME");
Expand Down Expand Up @@ -60,10 +48,7 @@ const app = express();
secureExpressApp(app);

// Add express route
app.get(
"/adm/services/:serviceid",
GetService(getCustomTelemetryClient, serviceModel)
);
app.get("/adm/services/:serviceid", GetService(serviceModel));

const azureFunctionHandler = createAzureFunctionHandler(app);

Expand Down
35 changes: 7 additions & 28 deletions UpdateService/__tests__/handler.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -43,10 +43,7 @@ describe("UpdateServiceHandler", () => {
})
};

const updateServiceHandler = UpdateServiceHandler(
undefined as any, // Not used
serviceModelMock as any
);
const updateServiceHandler = UpdateServiceHandler(serviceModelMock as any);

const response = await updateServiceHandler(
undefined as any, // Not used
Expand All @@ -71,10 +68,7 @@ describe("UpdateServiceHandler", () => {
})
};

const updateServiceHandler = UpdateServiceHandler(
undefined as any, // Not used
serviceModelMock as any
);
const updateServiceHandler = UpdateServiceHandler(serviceModelMock as any);

const response = await updateServiceHandler(
undefined as any, // Not used
Expand All @@ -100,10 +94,7 @@ describe("UpdateServiceHandler", () => {
})
};

const updateServiceHandler = UpdateServiceHandler(
undefined as any, // Not used
serviceModelMock as any
);
const updateServiceHandler = UpdateServiceHandler(serviceModelMock as any);

const response = await updateServiceHandler(
undefined as any, // Not used
Expand Down Expand Up @@ -132,10 +123,7 @@ describe("UpdateServiceHandler", () => {
})
};

const updateServiceHandler = UpdateServiceHandler(
undefined as any, // Not used
serviceModelMock as any
);
const updateServiceHandler = UpdateServiceHandler(serviceModelMock as any);

const response = await updateServiceHandler(
undefined as any, // Not used
Expand Down Expand Up @@ -165,10 +153,7 @@ describe("UpdateServiceHandler", () => {
})
};

const updateServiceHandler = UpdateServiceHandler(
undefined as any, // Not used
serviceModelMock as any
);
const updateServiceHandler = UpdateServiceHandler(serviceModelMock as any);

const response = await updateServiceHandler(
undefined as any, // Not used
Expand Down Expand Up @@ -199,10 +184,7 @@ describe("UpdateServiceHandler", () => {
})
};

const updateServiceHandler = UpdateServiceHandler(
undefined as any, // Not used
serviceModelMock as any
);
const updateServiceHandler = UpdateServiceHandler(serviceModelMock as any);

const response = await updateServiceHandler(
undefined as any, // Not used
Expand Down Expand Up @@ -243,10 +225,7 @@ describe("UpdateServiceHandler", () => {
log: jest.fn()
};

const updateServiceHandler = UpdateServiceHandler(
undefined as any,
serviceModelMock as any
);
const updateServiceHandler = UpdateServiceHandler(serviceModelMock as any);

await updateServiceHandler(
contextMock as any, // Not used
Expand Down
5 changes: 1 addition & 4 deletions UpdateService/handler.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@ import {
import { Service as ApiService } from "io-functions-commons/dist/generated/definitions/Service";
import { ServiceId } from "io-functions-commons/dist/generated/definitions/ServiceId";
import { ServiceModel } from "io-functions-commons/dist/src/models/service";
import { CustomTelemetryClientFactory } from "io-functions-commons/dist/src/utils/application_insights";
import {
AzureApiAuthMiddleware,
IAzureApiAuthorization,
Expand Down Expand Up @@ -60,7 +59,6 @@ type IUpdateServiceHandler = (
>;

export function UpdateServiceHandler(
_GCTC: CustomTelemetryClientFactory,
serviceModel: ServiceModel
): IUpdateServiceHandler {
return async (context, _, serviceId, servicePayload) => {
Expand Down Expand Up @@ -140,10 +138,9 @@ export function UpdateServiceHandler(
* Wraps a UpdateService handler inside an Express request handler.
*/
export function UpdateService(
getCustomTelemetryClient: CustomTelemetryClientFactory,
serviceModel: ServiceModel
): express.RequestHandler {
const handler = UpdateServiceHandler(getCustomTelemetryClient, serviceModel);
const handler = UpdateServiceHandler(serviceModel);

const middlewaresWrap = withRequestMiddlewares(
// Extract Azure Functions bindings
Expand Down
17 changes: 1 addition & 16 deletions UpdateService/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,6 @@ import {
ServiceModel
} from "io-functions-commons/dist/src/models/service";

import {
TelemetryClient,
wrapCustomTelemetryClient
} from "io-functions-commons/dist/src/utils/application_insights";
import * as documentDbUtils from "io-functions-commons/dist/src/utils/documentdb";
import { getRequiredStringEnv } from "io-functions-commons/dist/src/utils/env";
import { secureExpressApp } from "io-functions-commons/dist/src/utils/express";
Expand All @@ -24,14 +20,6 @@ import createAzureFunctionHandler from "io-functions-express/dist/src/createAzur

import { UpdateService } from "./handler";

// Whether we're in a production environment
const isProduction = process.env.NODE_ENV === "production";

const getCustomTelemetryClient = wrapCustomTelemetryClient(
isProduction,
new TelemetryClient()
);

const cosmosDbUri = getRequiredStringEnv("COSMOSDB_URI");
const cosmosDbKey = getRequiredStringEnv("COSMOSDB_KEY");
const cosmosDbName = getRequiredStringEnv("COSMOSDB_NAME");
Expand Down Expand Up @@ -60,10 +48,7 @@ const app = express();
secureExpressApp(app);

// Add express route
app.put(
"/adm/services/:serviceid",
UpdateService(getCustomTelemetryClient, serviceModel)
);
app.put("/adm/services/:serviceid", UpdateService(serviceModel));

const azureFunctionHandler = createAzureFunctionHandler(app);

Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@
"durable-functions": "^1.2.4",
"express": "^4.15.3",
"fp-ts": "1.17.0",
"io-functions-commons": "^4.0.1",
"io-functions-commons": "^9.0.0",
"io-functions-express": "^0.1.0",
"io-ts": "1.8.5",
"italia-ts-commons": "^5.1.11",
Expand Down
Loading