@pi-r/oci 0.5.2 → 0.5.4

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 CHANGED
@@ -1,4 +1,4 @@
1
- Copyright 2023 An Pham
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
@@ -1,5 +1,7 @@
1
- ### @pi-r/oci
1
+ # @pi-r/oci
2
2
 
3
- ### LICENSE
3
+ PEP 402 - Forever
4
+
5
+ ## LICENSE
4
6
 
5
7
  MIT
package/client/index.js CHANGED
@@ -15,9 +15,10 @@ function validateDatabase(credential, data) {
15
15
  }
16
16
  exports.validateDatabase = validateDatabase;
17
17
  function setStorageCredential(credential) {
18
+ var _a;
18
19
  const { endpoint, namespace, region } = credential;
19
20
  if (endpoint) {
20
- credential.region || (credential.region = /([^.]+)\.oraclecloud\.com$/.exec(endpoint)?.[1]);
21
+ credential.region || (credential.region = (_a = /([^.]+)\.oraclecloud\.com$/.exec(endpoint)) === null || _a === void 0 ? void 0 : _a[1]);
21
22
  }
22
23
  else if (namespace && region) {
23
24
  credential.endpoint || (credential.endpoint = `https://${namespace}.compat.objectstorage.${region}.oraclecloud.com`);
@@ -31,23 +32,6 @@ function createDatabaseClient(credential) {
31
32
  credential.user || (credential.user = credential.username);
32
33
  delete credential.username;
33
34
  }
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
35
  return oracledb.getConnection(credential);
52
36
  }
53
37
  exports.createDatabaseClient = createDatabaseClient;
@@ -87,13 +71,13 @@ async function executeBatchQuery(credential, batch, sessionKey) {
87
71
  const cacheValue = { value: this.valueOfKey(credential, 'cache'), sessionKey };
88
72
  let client;
89
73
  const createClient = () => createDatabaseClient.call(this, length === 1 ? credential : { ...credential });
90
- const closeClient = () => client?.close();
74
+ const closeClient = () => client === null || client === void 0 ? void 0 : client.close();
91
75
  for (let i = 0; i < length; ++i) {
92
76
  const item = batch[i];
93
77
  const { service, table, id, query, ignoreCache } = item;
94
78
  if (!table) {
95
79
  closeClient();
96
- throw (0, util_1.formatError)(item, "Missing database table" /* ERR_DB.TABLE */);
80
+ throw (0, util_1.formatError)(item, "Missing database table");
97
81
  }
98
82
  const renewCache = ignoreCache === 0;
99
83
  const getCache = (value) => {
@@ -117,7 +101,7 @@ async function executeBatchQuery(credential, batch, sessionKey) {
117
101
  const db = await (client || (client = await createClient())).getSodaDatabase().openCollection(table);
118
102
  if (!db) {
119
103
  closeClient();
120
- throw (0, util_1.formatError)(item, "Missing database table" /* ERR_DB.TABLE */);
104
+ throw (0, util_1.formatError)(item, "Missing database table");
121
105
  }
122
106
  const row = db.find().key(id);
123
107
  let document = await row.getOne();
@@ -165,7 +149,7 @@ async function executeBatchQuery(credential, batch, sessionKey) {
165
149
  const db = await (client || (client = await createClient())).getSodaDatabase().openCollection(table);
166
150
  if (!db) {
167
151
  closeClient();
168
- throw (0, util_1.formatError)(item, "Missing database table" /* ERR_DB.TABLE */);
152
+ throw (0, util_1.formatError)(item, "Missing database table");
169
153
  }
170
154
  let operation = db.find().filter(query);
171
155
  if (maxRows) {
@@ -179,12 +163,12 @@ async function executeBatchQuery(credential, batch, sessionKey) {
179
163
  result[i] = rows;
180
164
  continue;
181
165
  }
182
- ({ rows } = await (client || (client = await createClient())).execute(query, params || [], { ...options, outFormat: 4002 /* OUT_FORMAT.OBJECT */, maxRows, resultSet: false, autoCommit: true }));
166
+ ({ rows } = await (client || (client = await createClient())).execute(query, params || [], { ...options, outFormat: 4002, maxRows, resultSet: false, autoCommit: true }));
183
167
  }
184
168
  }
185
169
  else {
186
170
  closeClient();
187
- throw (0, util_1.formatError)(item, "Missing database query" /* ERR_DB.QUERY */);
171
+ throw (0, util_1.formatError)(item, "Missing database query");
188
172
  }
189
173
  }
190
174
  result[i] = this.setQueryResult(service, credential, queryString, rows, cacheValue);
package/download/index.js CHANGED
@@ -1,9 +1,8 @@
1
1
  "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- const client_1 = require("../client");
2
+ const client_1 = require("@pi-r/oci");
4
3
  function download(credential, service = 'oci') {
5
4
  (0, client_1.setStorageCredential)(credential);
6
- return require('../../aws/download').call(this, credential, service);
5
+ return require("@pi-r/aws/download").call(this, credential, service);
7
6
  }
8
7
 
9
8
  module.exports = download;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@pi-r/oci",
3
- "version": "0.5.2",
3
+ "version": "0.5.4",
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.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"
23
+ "@e-mc/cloud": "^0.7.5",
24
+ "@e-mc/module": "^0.7.5",
25
+ "@e-mc/types": "^0.7.5",
26
+ "@pi-r/aws": "^0.5.4",
27
+ "aws-sdk": "^2.1591.0",
28
+ "oracledb": "^6.4.0"
29
29
  }
30
30
  }
package/upload/index.js CHANGED
@@ -1,9 +1,8 @@
1
1
  "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- const client_1 = require("../client");
2
+ const client_1 = require("@pi-r/oci");
4
3
  function upload(credential, service = 'oci') {
5
4
  (0, client_1.setStorageCredential)(credential);
6
- return require('../../aws/upload').call(this, credential, service);
5
+ return require("@pi-r/aws/upload").call(this, credential, service);
7
6
  }
8
7
 
9
8
  module.exports = upload;