@pi-r/azure 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 +1 -1
- package/README.md +1 -1
- package/client/index.js +4 -3
- package/download/index.js +1 -6
- package/package.json +4 -4
- package/upload/index.js +3 -8
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
|
@@ -22,14 +22,15 @@ function validateDatabase(credential, data) {
|
|
|
22
22
|
}
|
|
23
23
|
exports.validateDatabase = validateDatabase;
|
|
24
24
|
function createStorageClient(credential) {
|
|
25
|
+
var _a, _b;
|
|
25
26
|
const { BlobServiceClient, StorageSharedKeyCredential } = storage;
|
|
26
27
|
const { accountName, accountKey, connectionString, sharedAccessSignature } = credential;
|
|
27
28
|
if (connectionString) {
|
|
28
|
-
credential.accountName || (credential.accountName = /AccountName=([^;]+);/.exec(connectionString)
|
|
29
|
+
credential.accountName || (credential.accountName = (_a = /AccountName=([^;]+);/.exec(connectionString)) === null || _a === void 0 ? void 0 : _a[1]);
|
|
29
30
|
return BlobServiceClient.fromConnectionString(connectionString);
|
|
30
31
|
}
|
|
31
32
|
if (sharedAccessSignature) {
|
|
32
|
-
credential.accountName || (credential.accountName = /^https:\/\/([a-z\d]+)\./.exec(sharedAccessSignature)
|
|
33
|
+
credential.accountName || (credential.accountName = (_b = /^https:\/\/([a-z\d]+)\./.exec(sharedAccessSignature)) === null || _b === void 0 ? void 0 : _b[1]);
|
|
33
34
|
return new BlobServiceClient(sharedAccessSignature);
|
|
34
35
|
}
|
|
35
36
|
let azureCredential;
|
|
@@ -160,7 +161,7 @@ async function executeBatchQuery(credential, batch, sessionKey) {
|
|
|
160
161
|
client || (client = createDatabaseClient.call(this, length === 1 ? credential : { ...credential }));
|
|
161
162
|
return client.database(name).container(table);
|
|
162
163
|
};
|
|
163
|
-
const closeClient = () => client
|
|
164
|
+
const closeClient = () => client === null || client === void 0 ? void 0 : client.dispose();
|
|
164
165
|
for (let i = 0; i < length; ++i) {
|
|
165
166
|
const item = batch[i];
|
|
166
167
|
const { service, name, table, id, query, storedProcedureId, partitionKey = null, params, limit = 0, update, ignoreCache } = item;
|
package/download/index.js
CHANGED
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
2
|
const types_1 = require("@e-mc/types");
|
|
4
3
|
const Module = require("@e-mc/module");
|
|
5
4
|
const Cloud = require("@e-mc/cloud");
|
|
@@ -32,9 +31,5 @@ function download(credential, service = 'azure') {
|
|
|
32
31
|
.catch(err => callback(err));
|
|
33
32
|
};
|
|
34
33
|
}
|
|
35
|
-
exports.default = download;
|
|
36
34
|
|
|
37
|
-
|
|
38
|
-
module.exports = exports.default;
|
|
39
|
-
module.exports.default = exports.default;
|
|
40
|
-
}
|
|
35
|
+
module.exports = download;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@pi-r/azure",
|
|
3
|
-
"version": "0.5.
|
|
3
|
+
"version": "0.5.4",
|
|
4
4
|
"description": "Azure cloud functions for E-mc.",
|
|
5
5
|
"main": "client/index.js",
|
|
6
6
|
"publishConfig": {
|
|
@@ -20,9 +20,9 @@
|
|
|
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.
|
|
23
|
+
"@e-mc/cloud": "^0.7.5",
|
|
24
|
+
"@e-mc/module": "^0.7.5",
|
|
25
|
+
"@e-mc/types": "^0.7.5",
|
|
26
26
|
"@azure/cosmos": "^4.0.0",
|
|
27
27
|
"@azure/identity": "^4.0.1",
|
|
28
28
|
"@azure/storage-blob": "^12.17.0"
|
package/upload/index.js
CHANGED
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
2
|
const path = require("path");
|
|
4
3
|
const fs = require("fs");
|
|
5
4
|
const util_1 = require("@e-mc/cloud/util");
|
|
@@ -32,14 +31,14 @@ function upload(credential, service = 'azure') {
|
|
|
32
31
|
const configBucket = admin.configBucket;
|
|
33
32
|
if (!BUCKET_SESSION.has(bucket)) {
|
|
34
33
|
const bucketAcl = admin.publicRead ? 'blob' : admin.acl;
|
|
35
|
-
const response = BUCKET_RESPONSE[_a = bucketKey = getBucketKey(credential, bucket, bucketAcl)] || (BUCKET_RESPONSE[_a] = client_1.createBucketV2.call(this, credential, bucket, bucketAcl, configBucket
|
|
34
|
+
const response = BUCKET_RESPONSE[_a = bucketKey = getBucketKey(credential, bucket, bucketAcl)] || (BUCKET_RESPONSE[_a] = client_1.createBucketV2.call(this, credential, bucket, bucketAcl, configBucket === null || configBucket === void 0 ? void 0 : configBucket.create));
|
|
36
35
|
if (!await response) {
|
|
37
36
|
errorResponse(null);
|
|
38
37
|
return;
|
|
39
38
|
}
|
|
40
39
|
BUCKET_SESSION.add(bucket);
|
|
41
40
|
}
|
|
42
|
-
let retentionPolicy = configBucket
|
|
41
|
+
let retentionPolicy = configBucket === null || configBucket === void 0 ? void 0 : configBucket.retentionPolicy;
|
|
43
42
|
if (retentionPolicy) {
|
|
44
43
|
if (!Array.isArray(retentionPolicy)) {
|
|
45
44
|
retentionPolicy = [retentionPolicy];
|
|
@@ -134,9 +133,5 @@ function upload(credential, service = 'azure') {
|
|
|
134
133
|
}
|
|
135
134
|
};
|
|
136
135
|
}
|
|
137
|
-
exports.default = upload;
|
|
138
136
|
|
|
139
|
-
|
|
140
|
-
module.exports = exports.default;
|
|
141
|
-
module.exports.default = exports.default;
|
|
142
|
-
}
|
|
137
|
+
module.exports = upload;
|