@pi-r/oci 0.8.3 → 0.9.1

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,7 +1,7 @@
1
- Copyright 2024 An Pham
2
-
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
-
5
- The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
6
-
7
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
1
+ Copyright 2024 An Pham
2
+
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
+
5
+ The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
6
+
7
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
package/README.md CHANGED
@@ -4,4 +4,4 @@ https://e-mc.readthedocs.io/en/latest/cloud/oci.html
4
4
 
5
5
  ### LICENSE
6
6
 
7
- MIT
7
+ MIT
package/client/index.js CHANGED
@@ -9,19 +9,20 @@ exports.setBucketPolicy = setBucketPolicy;
9
9
  exports.setBucketWebsite = setBucketWebsite;
10
10
  exports.deleteObjects = deleteObjects;
11
11
  exports.deleteObjectsV2 = deleteObjectsV2;
12
+ exports.deleteObjectsV3 = deleteObjectsV3;
12
13
  exports.executeQuery = executeQuery;
13
14
  exports.executeBatchQuery = executeBatchQuery;
14
15
  const oracledb = require("oracledb");
15
16
  const Cloud = require("@e-mc/cloud");
16
- const util_1 = require("@e-mc/cloud/util");
17
17
  const types_1 = require("@e-mc/types");
18
- const aws_1 = require("@pi-r/aws");
19
- const oracle_1 = require("@pi-r/oracle");
18
+ const util_1 = require("@e-mc/cloud/util");
19
+ const oracle = require("@pi-r/oracle");
20
+ const aws = require("@pi-r/aws");
20
21
  function validateStorage(credential) {
21
22
  return !!(credential.accessKeyId && credential.secretAccessKey && (credential.region && credential.namespace || credential.endpoint));
22
23
  }
23
24
  function validateDatabase(credential, data) {
24
- return !!(data.table && (credential.user && credential.password && (credential.connectString || credential.connectionString) || credential.poolAlias || (0, oracle_1.getConfigObject)(credential.connectionString || credential.connectionString)));
25
+ return !!(data.table && (credential.user && credential.password && (credential.connectString || credential.connectionString) || credential.poolAlias || oracle.getConfigObject(credential.connectionString || credential.connectionString)));
25
26
  }
26
27
  function setStorageCredential(credential) {
27
28
  const { endpoint, namespace, region } = credential;
@@ -38,27 +39,30 @@ function setStorageCredential(credential) {
38
39
  credential.signatureVersion = 'v4';
39
40
  }
40
41
  async function createDatabaseClient(credential) {
41
- oracle_1.initOracleClient.call(this, credential, this.logType.CLOUD);
42
+ oracle.initOracleClient.call(this, credential, this.logType.CLOUD);
42
43
  return oracledb.getConnection(credential);
43
44
  }
44
45
  async function createBucket(credential, bucket, publicRead) {
45
- return aws_1.createBucketV2.call(this, credential, bucket, publicRead ? 'public-read' : undefined, undefined, 'oci');
46
+ return createBucketV2.call(this, credential, bucket, publicRead ? 'public-read' : undefined);
46
47
  }
47
48
  async function createBucketV2(credential, bucket, ACL, options) {
48
- return aws_1.createBucketV2.call(this, credential, bucket, ACL, options, 'oci');
49
+ return aws.createBucketV2.call(this, credential, bucket, ACL, options, 'oci');
49
50
  }
50
51
  async function setBucketPolicy(credential, bucket, options) {
51
- return aws_1.setBucketPolicy.call(this, credential, bucket, options, 'oci');
52
+ return aws.setBucketPolicy.call(this, credential, bucket, options, 'oci');
52
53
  }
53
54
  async function setBucketWebsite(credential, bucket, options) {
54
- return aws_1.setBucketWebsite.call(this, credential, bucket, options, 'oci');
55
+ return aws.setBucketWebsite.call(this, credential, bucket, options, 'oci');
56
+ }
57
+ async function deleteObjects(credential, Bucket, service, sdk, recursive = true) {
58
+ return deleteObjectsV2.call(this, credential, Bucket, recursive);
55
59
  }
56
- async function deleteObjects(credential, bucket) {
57
- return deleteObjectsV2.call(this, credential, bucket, true);
60
+ async function deleteObjectsV2(credential, Bucket, recursive = true) {
61
+ return deleteObjectsV3.call(this, credential, Bucket, { recursive, Bucket });
58
62
  }
59
- async function deleteObjectsV2(credential, bucket, recursive = true) {
63
+ async function deleteObjectsV3(credential, bucket, options = {}) {
60
64
  setStorageCredential(credential);
61
- return aws_1.deleteObjectsV2.call(this, credential, bucket, recursive, 'oci');
65
+ return aws.deleteObjectsV3.call(this, credential, bucket, options, 'oci');
62
66
  }
63
67
  async function executeQuery(credential, data, sessionKey) {
64
68
  return (await executeBatchQuery.call(this, credential, [data], sessionKey))[0] || [];
@@ -208,7 +212,7 @@ async function executeBatchQuery(credential, batch, sessionKey) {
208
212
  if (item.streamRow) {
209
213
  rows = [];
210
214
  await new Promise((resolve, reject) => {
211
- let error;
215
+ let error = false;
212
216
  const stream = client.queryStream(query, params || [], executeOptions);
213
217
  stream
214
218
  .on('data', row => {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@pi-r/oci",
3
- "version": "0.8.3",
3
+ "version": "0.9.1",
4
4
  "description": "Oracle (OCI) cloud functions for E-mc.",
5
5
  "main": "client/index.js",
6
6
  "publishConfig": {
@@ -13,19 +13,18 @@
13
13
  },
14
14
  "keywords": [
15
15
  "squared",
16
- "e-mc",
17
- "squared-functions"
16
+ "e-mc"
18
17
  ],
19
18
  "author": "An Pham <anpham6@gmail.com>",
20
19
  "license": "MIT",
21
20
  "homepage": "https://github.com/anpham6/pi-r#readme",
22
21
  "dependencies": {
23
- "@e-mc/cloud": "^0.10.3",
24
- "@e-mc/module": "^0.10.3",
25
- "@e-mc/types": "^0.10.3",
26
- "@pi-r/aws": "^0.8.3",
27
- "@pi-r/oracle": "^0.8.3",
28
- "aws-sdk": "^2.1691.0",
29
- "oracledb": "^6.6.0"
22
+ "@e-mc/cloud": "^0.11.2",
23
+ "@e-mc/module": "^0.11.2",
24
+ "@e-mc/types": "^0.11.2",
25
+ "@pi-r/aws": "^0.9.1",
26
+ "@pi-r/oracle": "^0.9.1",
27
+ "aws-sdk": "^2.1692.0",
28
+ "oracledb": "^6.7.1"
30
29
  }
31
30
  }
package/types/index.d.ts CHANGED
@@ -13,7 +13,7 @@ export interface OCIStorageCredential extends ConfigurationOptions {
13
13
  export interface OCIDatabaseQuery extends Omit<CloudDatabase<PlainObject | string, ExecuteOptions, StandardMap, BindParameters, OCIDatabaseCredential>, "id"> {
14
14
  source: "cloud";
15
15
  service: "oci";
16
- id?: ArrayOf<string>;
16
+ id?: string | string[];
17
17
  updateType?: 0 | 1 | 2;
18
18
  streamRow?: boolean;
19
19
  }