@boostercloud/framework-provider-azure 2.15.0 → 2.17.0
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/constants.d.ts
CHANGED
|
@@ -27,6 +27,7 @@ export declare const environmentVarNames: {
|
|
|
27
27
|
readonly eventHubName: "EVENTHUB_NAME";
|
|
28
28
|
readonly eventHubMaxRetries: "EVENTHUB_MAX_RETRIES";
|
|
29
29
|
readonly eventHubMode: "EVENTHUB_MODE";
|
|
30
|
+
readonly rocketFunctionAppNames: "ROCKET_FUNCTION_APP_NAMES";
|
|
30
31
|
};
|
|
31
32
|
export declare const AZURE_CONFLICT_ERROR_CODE = 409;
|
|
32
33
|
export declare const AZURE_PRECONDITION_FAILED_ERROR = 412;
|
package/dist/constants.js
CHANGED
|
@@ -29,6 +29,7 @@ exports.environmentVarNames = {
|
|
|
29
29
|
eventHubName: 'EVENTHUB_NAME',
|
|
30
30
|
eventHubMaxRetries: 'EVENTHUB_MAX_RETRIES',
|
|
31
31
|
eventHubMode: 'EVENTHUB_MODE',
|
|
32
|
+
rocketFunctionAppNames: 'ROCKET_FUNCTION_APP_NAMES',
|
|
32
33
|
};
|
|
33
34
|
// Azure special error codes
|
|
34
35
|
exports.AZURE_CONFLICT_ERROR_CODE = 409;
|
package/dist/index.js
CHANGED
|
@@ -120,6 +120,7 @@ const Provider = (rockets) => ({
|
|
|
120
120
|
graphQLFunctionUrl: health_adapter_1.graphqlFunctionUrl,
|
|
121
121
|
isGraphQLFunctionUp: health_adapter_1.isGraphQLFunctionUp,
|
|
122
122
|
rawRequestToHealthEnvelope: health_adapter_1.rawRequestToSensorHealth,
|
|
123
|
+
areRocketFunctionsUp: health_adapter_1.areRocketFunctionsUp,
|
|
123
124
|
},
|
|
124
125
|
// ProviderInfrastructureGetter
|
|
125
126
|
infrastructure: () => {
|
|
@@ -7,9 +7,14 @@ export declare function isContainerUp(cosmosDb: CosmosClient, config: BoosterCon
|
|
|
7
7
|
export declare function countAll(container: Container): Promise<number>;
|
|
8
8
|
export declare function databaseEventsHealthDetails(cosmosDb: CosmosClient, config: BoosterConfig): Promise<unknown>;
|
|
9
9
|
export declare function graphqlFunctionUrl(): Promise<string>;
|
|
10
|
+
export declare function rocketFunctionAppUrl(functionAppName: string): Promise<string>;
|
|
10
11
|
export declare function isDatabaseEventUp(cosmosDb: CosmosClient, config: BoosterConfig): Promise<boolean>;
|
|
11
12
|
export declare function areDatabaseReadModelsUp(cosmosDb: CosmosClient, config: BoosterConfig): Promise<boolean>;
|
|
12
13
|
export declare function isGraphQLFunctionUp(): Promise<boolean>;
|
|
14
|
+
export declare function isRocketFunctionUp(rocketFunctionAppName: string): Promise<boolean>;
|
|
15
|
+
export declare function areRocketFunctionsUp(): Promise<{
|
|
16
|
+
[key: string]: boolean;
|
|
17
|
+
}>;
|
|
13
18
|
export declare function rawRequestToSensorHealthComponentPath(rawRequest: Context): string;
|
|
14
19
|
export declare function rawRequestToSensorHealth(context: Context): HealthEnvelope;
|
|
15
20
|
export declare function databaseReadModelsHealthDetails(cosmosDb: CosmosClient, config: BoosterConfig): Promise<unknown>;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.databaseReadModelsHealthDetails = exports.rawRequestToSensorHealth = exports.rawRequestToSensorHealthComponentPath = exports.isGraphQLFunctionUp = exports.areDatabaseReadModelsUp = exports.isDatabaseEventUp = exports.graphqlFunctionUrl = exports.databaseEventsHealthDetails = exports.countAll = exports.isContainerUp = exports.getContainer = exports.databaseUrl = void 0;
|
|
3
|
+
exports.databaseReadModelsHealthDetails = exports.rawRequestToSensorHealth = exports.rawRequestToSensorHealthComponentPath = exports.areRocketFunctionsUp = exports.isRocketFunctionUp = exports.isGraphQLFunctionUp = exports.areDatabaseReadModelsUp = exports.isDatabaseEventUp = exports.rocketFunctionAppUrl = exports.graphqlFunctionUrl = exports.databaseEventsHealthDetails = exports.countAll = exports.isContainerUp = exports.getContainer = exports.databaseUrl = void 0;
|
|
4
4
|
const constants_1 = require("../constants");
|
|
5
5
|
const framework_common_helpers_1 = require("@boostercloud/framework-common-helpers");
|
|
6
6
|
async function databaseUrl(cosmosDb, config) {
|
|
@@ -43,6 +43,10 @@ async function graphqlFunctionUrl() {
|
|
|
43
43
|
}
|
|
44
44
|
}
|
|
45
45
|
exports.graphqlFunctionUrl = graphqlFunctionUrl;
|
|
46
|
+
async function rocketFunctionAppUrl(functionAppName) {
|
|
47
|
+
return `https://${functionAppName}.azurewebsites.net`;
|
|
48
|
+
}
|
|
49
|
+
exports.rocketFunctionAppUrl = rocketFunctionAppUrl;
|
|
46
50
|
async function isDatabaseEventUp(cosmosDb, config) {
|
|
47
51
|
return await isContainerUp(cosmosDb, config, config.resourceNames.eventsStore);
|
|
48
52
|
}
|
|
@@ -68,6 +72,27 @@ async function isGraphQLFunctionUp() {
|
|
|
68
72
|
}
|
|
69
73
|
}
|
|
70
74
|
exports.isGraphQLFunctionUp = isGraphQLFunctionUp;
|
|
75
|
+
async function isRocketFunctionUp(rocketFunctionAppName) {
|
|
76
|
+
try {
|
|
77
|
+
const functionAppUrl = await rocketFunctionAppUrl(rocketFunctionAppName);
|
|
78
|
+
const response = await (0, framework_common_helpers_1.request)(functionAppUrl, 'GET');
|
|
79
|
+
return response.status === 200;
|
|
80
|
+
}
|
|
81
|
+
catch (e) {
|
|
82
|
+
return false;
|
|
83
|
+
}
|
|
84
|
+
}
|
|
85
|
+
exports.isRocketFunctionUp = isRocketFunctionUp;
|
|
86
|
+
async function areRocketFunctionsUp() {
|
|
87
|
+
var _a;
|
|
88
|
+
const functionAppNames = ((_a = process.env[constants_1.environmentVarNames.rocketFunctionAppNames]) === null || _a === void 0 ? void 0 : _a.split(',').filter((str) => str.trim() !== '')) || [];
|
|
89
|
+
const results = await Promise.all(functionAppNames.map(async (functionAppName) => {
|
|
90
|
+
const isUp = await isRocketFunctionUp(functionAppName);
|
|
91
|
+
return { [functionAppName]: isUp };
|
|
92
|
+
}));
|
|
93
|
+
return results.reduce((acc, result) => ({ ...acc, ...result }), {});
|
|
94
|
+
}
|
|
95
|
+
exports.areRocketFunctionsUp = areRocketFunctionsUp;
|
|
71
96
|
function rawRequestToSensorHealthComponentPath(rawRequest) {
|
|
72
97
|
var _a;
|
|
73
98
|
const parameters = (_a = rawRequest.req) === null || _a === void 0 ? void 0 : _a.url.replace(/^.*sensor\/health\/?/, '');
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@boostercloud/framework-provider-azure",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.17.0",
|
|
4
4
|
"description": "Handle Booster's integration with Azure",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"framework-provider-azure"
|
|
@@ -27,14 +27,14 @@
|
|
|
27
27
|
"@azure/functions": "^1.2.2",
|
|
28
28
|
"@azure/identity": "~2.1.0",
|
|
29
29
|
"@azure/event-hubs": "5.11.1",
|
|
30
|
-
"@boostercloud/framework-common-helpers": "^2.
|
|
31
|
-
"@boostercloud/framework-types": "^2.
|
|
30
|
+
"@boostercloud/framework-common-helpers": "^2.17.0",
|
|
31
|
+
"@boostercloud/framework-types": "^2.17.0",
|
|
32
32
|
"tslib": "^2.4.0",
|
|
33
33
|
"@effect-ts/core": "^0.60.4",
|
|
34
34
|
"@azure/web-pubsub": "~1.1.0"
|
|
35
35
|
},
|
|
36
36
|
"devDependencies": {
|
|
37
|
-
"@boostercloud/eslint-config": "^2.
|
|
37
|
+
"@boostercloud/eslint-config": "^2.17.0",
|
|
38
38
|
"@types/chai": "4.2.18",
|
|
39
39
|
"@types/chai-as-promised": "7.1.4",
|
|
40
40
|
"@types/faker": "5.1.5",
|