@pi-r/oci 0.6.3 → 0.6.6
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 +6 -3
- package/client/index.js +7 -8
- package/download/index.js +4 -7
- package/package.json +8 -8
- package/upload/index.js +4 -7
package/LICENSE
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
Copyright
|
|
1
|
+
Copyright 2024 An Pham
|
|
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
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
2
|
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
3
|
const oracledb = require("oracledb");
|
|
5
4
|
const types_1 = require("@e-mc/types");
|
|
@@ -88,7 +87,7 @@ async function executeBatchQuery(credential, batch, sessionKey) {
|
|
|
88
87
|
if (id) {
|
|
89
88
|
if (!table) {
|
|
90
89
|
closeClient();
|
|
91
|
-
throw (0, util_1.formatError)(item, "Missing database table"
|
|
90
|
+
throw (0, util_1.formatError)(item, "Missing database table");
|
|
92
91
|
}
|
|
93
92
|
const update = item.update;
|
|
94
93
|
if (queryString) {
|
|
@@ -101,7 +100,7 @@ async function executeBatchQuery(credential, batch, sessionKey) {
|
|
|
101
100
|
const db = await (client || (client = await createClient())).getSodaDatabase().openCollection(table);
|
|
102
101
|
if (!db) {
|
|
103
102
|
closeClient();
|
|
104
|
-
throw (0, util_1.formatError)(item, "Missing database table"
|
|
103
|
+
throw (0, util_1.formatError)(item, "Missing database table");
|
|
105
104
|
}
|
|
106
105
|
const row = db.find().key(id);
|
|
107
106
|
let document = await row.getOne();
|
|
@@ -144,7 +143,7 @@ async function executeBatchQuery(credential, batch, sessionKey) {
|
|
|
144
143
|
if ((0, types_1.isPlainObject)(query)) {
|
|
145
144
|
if (!table) {
|
|
146
145
|
closeClient();
|
|
147
|
-
throw (0, util_1.formatError)(item, "Missing database table"
|
|
146
|
+
throw (0, util_1.formatError)(item, "Missing database table");
|
|
148
147
|
}
|
|
149
148
|
if (queryString && (rows = getCache(queryString += Module.asString(query, true) + (maxRows > 0 ? maxRows : '')))) {
|
|
150
149
|
result[i] = rows;
|
|
@@ -153,7 +152,7 @@ async function executeBatchQuery(credential, batch, sessionKey) {
|
|
|
153
152
|
const db = await (client || (client = await createClient())).getSodaDatabase().openCollection(table);
|
|
154
153
|
if (!db) {
|
|
155
154
|
closeClient();
|
|
156
|
-
throw (0, util_1.formatError)(item, "Missing database table"
|
|
155
|
+
throw (0, util_1.formatError)(item, "Missing database table");
|
|
157
156
|
}
|
|
158
157
|
const tryQuery = async () => {
|
|
159
158
|
let operation = db.find().filter(query);
|
|
@@ -193,7 +192,7 @@ async function executeBatchQuery(credential, batch, sessionKey) {
|
|
|
193
192
|
continue;
|
|
194
193
|
}
|
|
195
194
|
client || (client = await createClient());
|
|
196
|
-
const executeOptions = { ...options, outFormat: 4002
|
|
195
|
+
const executeOptions = { ...options, outFormat: 4002, maxRows, resultSet: false, autoCommit: true };
|
|
197
196
|
if (item.streamRow) {
|
|
198
197
|
rows = [];
|
|
199
198
|
await new Promise((resolve, reject) => {
|
|
@@ -218,7 +217,7 @@ async function executeBatchQuery(credential, batch, sessionKey) {
|
|
|
218
217
|
})
|
|
219
218
|
.catch(err => {
|
|
220
219
|
closeClient();
|
|
221
|
-
throw (0, util_1.formatError)(item, err instanceof Error ? err.message : "Missing database query"
|
|
220
|
+
throw (0, util_1.formatError)(item, err instanceof Error ? err.message : "Missing database query");
|
|
222
221
|
});
|
|
223
222
|
}
|
|
224
223
|
else {
|
|
@@ -228,7 +227,7 @@ async function executeBatchQuery(credential, batch, sessionKey) {
|
|
|
228
227
|
}
|
|
229
228
|
else {
|
|
230
229
|
closeClient();
|
|
231
|
-
throw (0, util_1.formatError)(item, "Missing database query"
|
|
230
|
+
throw (0, util_1.formatError)(item, "Missing database query");
|
|
232
231
|
}
|
|
233
232
|
}
|
|
234
233
|
result[i] = this.setQueryResult(service, credential, queryString, rows, cacheValue);
|
package/download/index.js
CHANGED
|
@@ -1,9 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
function download(credential, service = 'oci') {
|
|
2
|
+
const client_1 = require("@pi-r/oci");
|
|
3
|
+
module.exports = function download(credential, service = 'oci') {
|
|
5
4
|
(0, client_1.setStorageCredential)(credential);
|
|
6
|
-
return require(
|
|
7
|
-
}
|
|
8
|
-
|
|
9
|
-
module.exports = download;
|
|
5
|
+
return require("@pi-r/aws/download").call(this, credential, service);
|
|
6
|
+
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@pi-r/oci",
|
|
3
|
-
"version": "0.6.
|
|
3
|
+
"version": "0.6.6",
|
|
4
4
|
"description": "Oracle (OCI) cloud functions for E-mc.",
|
|
5
5
|
"main": "client/index.js",
|
|
6
6
|
"publishConfig": {
|
|
@@ -20,12 +20,12 @@
|
|
|
20
20
|
"license": "MIT",
|
|
21
21
|
"homepage": "https://github.com/anpham6/pi-r#readme",
|
|
22
22
|
"dependencies": {
|
|
23
|
-
"@e-mc/cloud": "^0.8.
|
|
24
|
-
"@e-mc/module": "^0.8.
|
|
25
|
-
"@e-mc/types": "^0.8.
|
|
26
|
-
"@pi-r/aws": "^0.6.
|
|
27
|
-
"@pi-r/oracle": "^0.6.
|
|
28
|
-
"aws-sdk": "^2.
|
|
29
|
-
"oracledb": "^6.
|
|
23
|
+
"@e-mc/cloud": "^0.8.7",
|
|
24
|
+
"@e-mc/module": "^0.8.7",
|
|
25
|
+
"@e-mc/types": "^0.8.7",
|
|
26
|
+
"@pi-r/aws": "^0.6.6",
|
|
27
|
+
"@pi-r/oracle": "^0.6.6",
|
|
28
|
+
"aws-sdk": "^2.1591.0",
|
|
29
|
+
"oracledb": "^6.4.0"
|
|
30
30
|
}
|
|
31
31
|
}
|
package/upload/index.js
CHANGED
|
@@ -1,9 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
function upload(credential, service = 'oci') {
|
|
2
|
+
const client_1 = require("@pi-r/oci");
|
|
3
|
+
module.exports = function upload(credential, service = 'oci') {
|
|
5
4
|
(0, client_1.setStorageCredential)(credential);
|
|
6
|
-
return require(
|
|
7
|
-
}
|
|
8
|
-
|
|
9
|
-
module.exports = upload;
|
|
5
|
+
return require("@pi-r/aws/upload").call(this, credential, service);
|
|
6
|
+
};
|