@pi-r/oci 0.3.0 → 0.5.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/client/index.js +10 -15
- package/package.json +7 -7
package/client/index.js
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.executeBatchQuery = exports.executeQuery = exports.deleteObjectsV2 = exports.deleteObjects = exports.setBucketWebsite = exports.setBucketPolicy = exports.createBucketV2 = exports.createBucket = exports.createDatabaseClient = exports.setStorageCredential = exports.validateDatabase = exports.validateStorage = void 0;
|
|
4
|
+
const oracledb = require("oracledb");
|
|
4
5
|
const types_1 = require("@e-mc/types");
|
|
5
6
|
const aws_1 = require("@pi-r/aws");
|
|
6
7
|
const util_1 = require("@e-mc/cloud/util");
|
|
@@ -14,29 +15,23 @@ function validateDatabase(credential, data) {
|
|
|
14
15
|
}
|
|
15
16
|
exports.validateDatabase = validateDatabase;
|
|
16
17
|
function setStorageCredential(credential) {
|
|
17
|
-
|
|
18
|
-
|
|
18
|
+
const { endpoint, namespace, region } = credential;
|
|
19
|
+
if (endpoint) {
|
|
20
|
+
credential.region || (credential.region = /([^.]+)\.oraclecloud\.com$/.exec(endpoint)?.[1]);
|
|
19
21
|
}
|
|
20
|
-
else {
|
|
21
|
-
credential.endpoint || (credential.endpoint = `https://${
|
|
22
|
+
else if (namespace && region) {
|
|
23
|
+
credential.endpoint || (credential.endpoint = `https://${namespace}.compat.objectstorage.${region}.oraclecloud.com`);
|
|
22
24
|
}
|
|
23
25
|
credential.s3ForcePathStyle = true;
|
|
24
26
|
credential.signatureVersion = 'v4';
|
|
25
27
|
}
|
|
26
28
|
exports.setStorageCredential = setStorageCredential;
|
|
27
29
|
function createDatabaseClient(credential) {
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
delete credential.username;
|
|
32
|
-
}
|
|
33
|
-
const { getConnection } = require('oracledb');
|
|
34
|
-
return getConnection(credential);
|
|
35
|
-
}
|
|
36
|
-
catch (err) {
|
|
37
|
-
this.checkPackage(err, 'oracledb', { passThrough: true });
|
|
38
|
-
throw err;
|
|
30
|
+
if (credential.username) {
|
|
31
|
+
credential.user || (credential.user = credential.username);
|
|
32
|
+
delete credential.username;
|
|
39
33
|
}
|
|
34
|
+
return oracledb.getConnection(credential);
|
|
40
35
|
}
|
|
41
36
|
exports.createDatabaseClient = createDatabaseClient;
|
|
42
37
|
function createBucket(credential, bucket, publicRead) {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@pi-r/oci",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.5.0",
|
|
4
4
|
"description": "Oracle (OCI) cloud functions for E-mc.",
|
|
5
5
|
"main": "client/index.js",
|
|
6
6
|
"publishConfig": {
|
|
@@ -20,11 +20,11 @@
|
|
|
20
20
|
"license": "MIT",
|
|
21
21
|
"homepage": "https://github.com/anpham6/pi-r#readme",
|
|
22
22
|
"dependencies": {
|
|
23
|
-
"@e-mc/cloud": "^0.
|
|
24
|
-
"@e-mc/module": "^0.
|
|
25
|
-
"@e-mc/types": "^0.
|
|
26
|
-
"@pi-r/aws": "^0.
|
|
27
|
-
"aws-sdk": "^2.
|
|
28
|
-
"oracledb": "^6.
|
|
23
|
+
"@e-mc/cloud": "^0.7.0",
|
|
24
|
+
"@e-mc/module": "^0.7.0",
|
|
25
|
+
"@e-mc/types": "^0.7.0",
|
|
26
|
+
"@pi-r/aws": "^0.5.0",
|
|
27
|
+
"aws-sdk": "^2.1514.0",
|
|
28
|
+
"oracledb": "^6.2.0"
|
|
29
29
|
}
|
|
30
30
|
}
|