@routr/sdk 2.0.20 → 2.1.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/client.js +11 -1
- package/dist/types.d.ts +1 -0
- package/package.json +3 -3
package/dist/client.js
CHANGED
|
@@ -22,6 +22,9 @@ var __importStar = (this && this.__importStar) || function (mod) {
|
|
|
22
22
|
__setModuleDefault(result, mod);
|
|
23
23
|
return result;
|
|
24
24
|
};
|
|
25
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
26
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
27
|
+
};
|
|
25
28
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
26
29
|
exports.APIClient = void 0;
|
|
27
30
|
/*
|
|
@@ -46,15 +49,22 @@ exports.APIClient = void 0;
|
|
|
46
49
|
const grpc = __importStar(require("@grpc/grpc-js"));
|
|
47
50
|
const grpc_js_1 = require("@grpc/grpc-js");
|
|
48
51
|
const common_1 = require("@routr/common");
|
|
52
|
+
const fs_1 = __importDefault(require("fs"));
|
|
49
53
|
class APIClient {
|
|
50
54
|
constructor(options) {
|
|
51
55
|
const metadata = new grpc_js_1.Metadata();
|
|
52
56
|
if (options.username && options.password) {
|
|
53
57
|
metadata.set("authorization", `Basic ${Buffer.from(`${options.username}:${options.password}`).toString("base64")}`);
|
|
54
58
|
}
|
|
59
|
+
if (options.cacert) {
|
|
60
|
+
common_1.Assertions.assertFileExist(options.cacert);
|
|
61
|
+
}
|
|
62
|
+
const cacert = fs_1.default.existsSync(options.cacert)
|
|
63
|
+
? fs_1.default.readFileSync(options.cacert)
|
|
64
|
+
: null;
|
|
55
65
|
const credentials = process.env.ALLOW_INSECURE === "true" || options.insecure === true
|
|
56
66
|
? grpc.credentials.createInsecure()
|
|
57
|
-
: grpc.credentials.createSsl();
|
|
67
|
+
: grpc.credentials.createSsl(cacert);
|
|
58
68
|
this.client = common_1.CommonConnect.apiClient({
|
|
59
69
|
apiAddr: options.endpoint,
|
|
60
70
|
metadata,
|
package/dist/types.d.ts
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@routr/sdk",
|
|
3
|
-
"version": "2.0
|
|
3
|
+
"version": "2.1.0",
|
|
4
4
|
"description": "The Routr SDK for Node.js",
|
|
5
5
|
"author": "Pedro Sanders <psanders@fonoster.com>",
|
|
6
6
|
"homepage": "https://github.com/fonoster/routr#readme",
|
|
@@ -26,7 +26,7 @@
|
|
|
26
26
|
"@opentelemetry/sdk-trace-base": "^1.0.4",
|
|
27
27
|
"@opentelemetry/sdk-trace-node": "^1.0.4",
|
|
28
28
|
"@opentelemetry/semantic-conventions": "^1.0.4",
|
|
29
|
-
"@routr/common": "^2.0
|
|
29
|
+
"@routr/common": "^2.1.0",
|
|
30
30
|
"google-protobuf": "^3.9.2",
|
|
31
31
|
"pb-util": "^1.0.3"
|
|
32
32
|
},
|
|
@@ -46,5 +46,5 @@
|
|
|
46
46
|
"devDependencies": {
|
|
47
47
|
"@types/google-protobuf": "^3.15.6"
|
|
48
48
|
},
|
|
49
|
-
"gitHead": "
|
|
49
|
+
"gitHead": "0e75c7950157dcb7701082655259a87da322c29d"
|
|
50
50
|
}
|