@pi-r/oci 0.5.2 → 0.5.3
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/LICENSE +1 -1
- package/README.md +4 -2
- package/client/index.js +5 -22
- package/download/index.js +7 -3
- package/package.json +8 -8
- package/upload/index.js +7 -3
package/LICENSE
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
Copyright 2023
|
|
1
|
+
Copyright 2023 Wit Studio
|
|
2
2
|
|
|
3
3
|
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
|
|
4
4
|
|
package/README.md
CHANGED
package/client/index.js
CHANGED
|
@@ -31,23 +31,6 @@ function createDatabaseClient(credential) {
|
|
|
31
31
|
credential.user || (credential.user = credential.username);
|
|
32
32
|
delete credential.username;
|
|
33
33
|
}
|
|
34
|
-
if (oracledb.thin && credential.libDir) {
|
|
35
|
-
try {
|
|
36
|
-
oracledb.initOracleClient({ libDir: credential.libDir, driverName: credential.driverName, errorUrl: credential.errorUrl });
|
|
37
|
-
}
|
|
38
|
-
catch (err) {
|
|
39
|
-
if (err instanceof Error) {
|
|
40
|
-
switch (err.code) {
|
|
41
|
-
case 'NJS-090':
|
|
42
|
-
this.addLog(this.statusType.WARN, err, 'oracledb', credential.libDir);
|
|
43
|
-
break;
|
|
44
|
-
default:
|
|
45
|
-
this.writeFail(["Unable to configure client" /* ERR_DB.CLIENT */, 'oracledb'], err, { type: this.logType.CLOUD, fatal: false });
|
|
46
|
-
break;
|
|
47
|
-
}
|
|
48
|
-
}
|
|
49
|
-
}
|
|
50
|
-
}
|
|
51
34
|
return oracledb.getConnection(credential);
|
|
52
35
|
}
|
|
53
36
|
exports.createDatabaseClient = createDatabaseClient;
|
|
@@ -93,7 +76,7 @@ async function executeBatchQuery(credential, batch, sessionKey) {
|
|
|
93
76
|
const { service, table, id, query, ignoreCache } = item;
|
|
94
77
|
if (!table) {
|
|
95
78
|
closeClient();
|
|
96
|
-
throw (0, util_1.formatError)(item, "Missing database table"
|
|
79
|
+
throw (0, util_1.formatError)(item, "Missing database table");
|
|
97
80
|
}
|
|
98
81
|
const renewCache = ignoreCache === 0;
|
|
99
82
|
const getCache = (value) => {
|
|
@@ -117,7 +100,7 @@ async function executeBatchQuery(credential, batch, sessionKey) {
|
|
|
117
100
|
const db = await (client || (client = await createClient())).getSodaDatabase().openCollection(table);
|
|
118
101
|
if (!db) {
|
|
119
102
|
closeClient();
|
|
120
|
-
throw (0, util_1.formatError)(item, "Missing database table"
|
|
103
|
+
throw (0, util_1.formatError)(item, "Missing database table");
|
|
121
104
|
}
|
|
122
105
|
const row = db.find().key(id);
|
|
123
106
|
let document = await row.getOne();
|
|
@@ -165,7 +148,7 @@ async function executeBatchQuery(credential, batch, sessionKey) {
|
|
|
165
148
|
const db = await (client || (client = await createClient())).getSodaDatabase().openCollection(table);
|
|
166
149
|
if (!db) {
|
|
167
150
|
closeClient();
|
|
168
|
-
throw (0, util_1.formatError)(item, "Missing database table"
|
|
151
|
+
throw (0, util_1.formatError)(item, "Missing database table");
|
|
169
152
|
}
|
|
170
153
|
let operation = db.find().filter(query);
|
|
171
154
|
if (maxRows) {
|
|
@@ -179,12 +162,12 @@ async function executeBatchQuery(credential, batch, sessionKey) {
|
|
|
179
162
|
result[i] = rows;
|
|
180
163
|
continue;
|
|
181
164
|
}
|
|
182
|
-
({ rows } = await (client || (client = await createClient())).execute(query, params || [], { ...options, outFormat: 4002
|
|
165
|
+
({ rows } = await (client || (client = await createClient())).execute(query, params || [], { ...options, outFormat: 4002, maxRows, resultSet: false, autoCommit: true }));
|
|
183
166
|
}
|
|
184
167
|
}
|
|
185
168
|
else {
|
|
186
169
|
closeClient();
|
|
187
|
-
throw (0, util_1.formatError)(item, "Missing database query"
|
|
170
|
+
throw (0, util_1.formatError)(item, "Missing database query");
|
|
188
171
|
}
|
|
189
172
|
}
|
|
190
173
|
result[i] = this.setQueryResult(service, credential, queryString, rows, cacheValue);
|
package/download/index.js
CHANGED
|
@@ -1,9 +1,13 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
const client_1 = require("
|
|
3
|
+
const client_1 = require("@pi-r/oci");
|
|
4
4
|
function download(credential, service = 'oci') {
|
|
5
5
|
(0, client_1.setStorageCredential)(credential);
|
|
6
|
-
return require(
|
|
6
|
+
return require("@pi-r/aws/download").call(this, credential, service);
|
|
7
7
|
}
|
|
8
|
+
exports.default = download;
|
|
8
9
|
|
|
9
|
-
|
|
10
|
+
if (exports.default) {
|
|
11
|
+
module.exports = exports.default;
|
|
12
|
+
module.exports.default = exports.default;
|
|
13
|
+
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@pi-r/oci",
|
|
3
|
-
"version": "0.5.
|
|
3
|
+
"version": "0.5.3",
|
|
4
4
|
"description": "Oracle (OCI) cloud functions for E-mc.",
|
|
5
5
|
"main": "client/index.js",
|
|
6
6
|
"publishConfig": {
|
|
@@ -8,7 +8,7 @@
|
|
|
8
8
|
},
|
|
9
9
|
"repository": {
|
|
10
10
|
"type": "git",
|
|
11
|
-
"url": "https://github.com/anpham6/pi-r.git",
|
|
11
|
+
"url": "git+https://github.com/anpham6/pi-r.git",
|
|
12
12
|
"directory": "src/cloud/oci"
|
|
13
13
|
},
|
|
14
14
|
"keywords": [
|
|
@@ -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.7.
|
|
24
|
-
"@e-mc/module": "^0.7.
|
|
25
|
-
"@e-mc/types": "^0.7.
|
|
26
|
-
"@pi-r/aws": "^0.5.
|
|
27
|
-
"aws-sdk": "^2.
|
|
28
|
-
"oracledb": "^6.
|
|
23
|
+
"@e-mc/cloud": "^0.7.2",
|
|
24
|
+
"@e-mc/module": "^0.7.2",
|
|
25
|
+
"@e-mc/types": "^0.7.2",
|
|
26
|
+
"@pi-r/aws": "^0.5.2",
|
|
27
|
+
"aws-sdk": "^2.1570.0",
|
|
28
|
+
"oracledb": "^6.3.0"
|
|
29
29
|
}
|
|
30
30
|
}
|
package/upload/index.js
CHANGED
|
@@ -1,9 +1,13 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
const client_1 = require("
|
|
3
|
+
const client_1 = require("@pi-r/oci");
|
|
4
4
|
function upload(credential, service = 'oci') {
|
|
5
5
|
(0, client_1.setStorageCredential)(credential);
|
|
6
|
-
return require(
|
|
6
|
+
return require("@pi-r/aws/upload").call(this, credential, service);
|
|
7
7
|
}
|
|
8
|
+
exports.default = upload;
|
|
8
9
|
|
|
9
|
-
|
|
10
|
+
if (exports.default) {
|
|
11
|
+
module.exports = exports.default;
|
|
12
|
+
module.exports.default = exports.default;
|
|
13
|
+
}
|