@oino-ts/blob 1.0.3 → 1.0.5
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/dist/cjs/OINOBlobFactory.js +2 -2
- package/dist/esm/OINOBlobFactory.js +2 -2
- package/dist/types/OINOBlobConstants.d.ts +3 -5
- package/dist/types/OINOBlobFactory.d.ts +2 -2
- package/package.json +4 -4
- package/src/OINOBlobApi.test.ts +8 -8
- package/src/OINOBlobConstants.ts +3 -5
- package/src/OINOBlobFactory.ts +2 -2
|
@@ -13,8 +13,8 @@ const OINOBlobApi_js_1 = require("./OINOBlobApi.js");
|
|
|
13
13
|
*
|
|
14
14
|
* Usage:
|
|
15
15
|
* ```ts
|
|
16
|
-
* OINOBlobFactory.registerBlob("
|
|
17
|
-
* const blob = await OINOBlobFactory.createBlob({ type: "
|
|
16
|
+
* OINOBlobFactory.registerBlob("OINOBlobAzure", OINOBlobAzure)
|
|
17
|
+
* const blob = await OINOBlobFactory.createBlob({ type: "OINOBlobAzure", ... })
|
|
18
18
|
* const api = await OINOBlobFactory.createApi(blob, { apiName: "files", tableName: "uploads/" })
|
|
19
19
|
* ```
|
|
20
20
|
*/
|
|
@@ -10,8 +10,8 @@ import { OINOBlobApi } from "./OINOBlobApi.js";
|
|
|
10
10
|
*
|
|
11
11
|
* Usage:
|
|
12
12
|
* ```ts
|
|
13
|
-
* OINOBlobFactory.registerBlob("
|
|
14
|
-
* const blob = await OINOBlobFactory.createBlob({ type: "
|
|
13
|
+
* OINOBlobFactory.registerBlob("OINOBlobAzure", OINOBlobAzure)
|
|
14
|
+
* const blob = await OINOBlobFactory.createBlob({ type: "OINOBlobAzure", ... })
|
|
15
15
|
* const api = await OINOBlobFactory.createApi(blob, { apiName: "files", tableName: "uploads/" })
|
|
16
16
|
* ```
|
|
17
17
|
*/
|
|
@@ -6,14 +6,12 @@ import type { OINOBlob } from "./OINOBlob.js";
|
|
|
6
6
|
export type OINOBlobConstructor = new (params: OINOBlobParams) => OINOBlob;
|
|
7
7
|
/** Blob storage connection parameters */
|
|
8
8
|
export type OINOBlobParams = {
|
|
9
|
-
/** Name of the blob class (e.g.
|
|
9
|
+
/** Name of the blob class (e.g. OINOBlobAzure) */
|
|
10
10
|
type: string;
|
|
11
|
-
/** Blob service endpoint URL */
|
|
12
|
-
url: string;
|
|
13
11
|
/** Container / bucket name */
|
|
14
12
|
container: string;
|
|
15
|
-
/** Provider-specific
|
|
16
|
-
|
|
13
|
+
/** Provider-specific credentials (e.g. Azure Storage connection string or SAS URL) */
|
|
14
|
+
credentials?: any;
|
|
17
15
|
};
|
|
18
16
|
/** A single blob entry returned by a listing operation */
|
|
19
17
|
export type OINOBlobEntry = {
|
|
@@ -8,8 +8,8 @@ import { OINOBlobApi } from "./OINOBlobApi.js";
|
|
|
8
8
|
*
|
|
9
9
|
* Usage:
|
|
10
10
|
* ```ts
|
|
11
|
-
* OINOBlobFactory.registerBlob("
|
|
12
|
-
* const blob = await OINOBlobFactory.createBlob({ type: "
|
|
11
|
+
* OINOBlobFactory.registerBlob("OINOBlobAzure", OINOBlobAzure)
|
|
12
|
+
* const blob = await OINOBlobFactory.createBlob({ type: "OINOBlobAzure", ... })
|
|
13
13
|
* const api = await OINOBlobFactory.createApi(blob, { apiName: "files", tableName: "uploads/" })
|
|
14
14
|
* ```
|
|
15
15
|
*/
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@oino-ts/blob",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.5",
|
|
4
4
|
"description": "OINO TS library package for publishing blob storage as a REST API.",
|
|
5
5
|
"author": "Matias Kiviniemi (pragmatta)",
|
|
6
6
|
"license": "MPL-2.0",
|
|
@@ -19,13 +19,13 @@
|
|
|
19
19
|
"module": "./dist/esm/index.js",
|
|
20
20
|
"types": "./dist/types/index.d.ts",
|
|
21
21
|
"dependencies": {
|
|
22
|
-
"@oino-ts/common": "1.0.
|
|
22
|
+
"@oino-ts/common": "1.0.5",
|
|
23
23
|
"oino-ts": "file:.."
|
|
24
24
|
},
|
|
25
25
|
"devDependencies": {
|
|
26
|
-
"@oino-ts/types": "1.0.
|
|
26
|
+
"@oino-ts/types": "1.0.5",
|
|
27
27
|
"@types/bun": "^1.1.14",
|
|
28
|
-
"@types/node": "^21.0.
|
|
28
|
+
"@types/node": "^21.0.50",
|
|
29
29
|
"typescript": "~5.9.0"
|
|
30
30
|
},
|
|
31
31
|
"files": [
|
package/src/OINOBlobApi.test.ts
CHANGED
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
|
|
7
7
|
import { expect, test } from "bun:test"
|
|
8
8
|
|
|
9
|
-
import {
|
|
9
|
+
import { OINOBlobAzure } from "@oino-ts/blob-azure"
|
|
10
10
|
import { OINOBlobAwsS3 } from "@oino-ts/blob-aws"
|
|
11
11
|
import { OINOQueryFilter, OINOQuerySelect, OINOApiRequest, OINOConsoleLog, OINOLogLevel, OINOLog, OINOBenchmark, OINOContentType } from "@oino-ts/common"
|
|
12
12
|
|
|
@@ -41,10 +41,11 @@ type OINOBlobTestParams = {
|
|
|
41
41
|
const BLOB_STORAGES: OINOBlobStorageParams[] = [
|
|
42
42
|
{
|
|
43
43
|
blobParams: {
|
|
44
|
-
type: "
|
|
45
|
-
url: "https://oinocloudtest.blob.core.windows.net",
|
|
44
|
+
type: "OINOBlobAzure",
|
|
46
45
|
container: "northwind",
|
|
47
|
-
|
|
46
|
+
credentials: {
|
|
47
|
+
connectionStr: OINOCLOUD_TEST_BLOB_AZURE_CONSTR
|
|
48
|
+
}
|
|
48
49
|
},
|
|
49
50
|
apiName: "azure-northwind",
|
|
50
51
|
prefix: "northwind-azure/"
|
|
@@ -52,9 +53,8 @@ const BLOB_STORAGES: OINOBlobStorageParams[] = [
|
|
|
52
53
|
{
|
|
53
54
|
blobParams: {
|
|
54
55
|
type: "OINOBlobAwsS3",
|
|
55
|
-
url: "",
|
|
56
56
|
container: "oinocloud-test-northwind",
|
|
57
|
-
|
|
57
|
+
credentials: JSON.parse(OINOCLOUD_TEST_BLOB_S3_CONSTR)
|
|
58
58
|
},
|
|
59
59
|
apiName: "s3-northwind",
|
|
60
60
|
prefix: "northwind-s3/"
|
|
@@ -112,7 +112,7 @@ OINOLog.setInstance(new OINOConsoleLog(OINOLogLevel.warning))
|
|
|
112
112
|
OINOBenchmark.setEnabled(["doApiRequest"])
|
|
113
113
|
OINOBenchmark.reset()
|
|
114
114
|
|
|
115
|
-
OINOBlobFactory.registerBlob("
|
|
115
|
+
OINOBlobFactory.registerBlob("OINOBlobAzure", OINOBlobAzure)
|
|
116
116
|
OINOBlobFactory.registerBlob("OINOBlobAwsS3", OINOBlobAwsS3)
|
|
117
117
|
|
|
118
118
|
function encodeResult(o: unknown): string {
|
|
@@ -151,7 +151,7 @@ export async function OINOTestBlob(storageParams: OINOBlobStorageParams, testPar
|
|
|
151
151
|
|
|
152
152
|
let target_group = "[CONNECTION]"
|
|
153
153
|
|
|
154
|
-
const wrong_constr_params: OINOBlobParams = { ...storageParams.blobParams,
|
|
154
|
+
const wrong_constr_params: OINOBlobParams = { ...storageParams.blobParams, container: "wrongcontainer" } // azure does not allow uppercase for containers
|
|
155
155
|
const wrong_blob: OINOBlob = await OINOBlobFactory.createBlob(wrong_constr_params, false, false)
|
|
156
156
|
await test(target_name + target_storage + target_group + " connection error", async () => {
|
|
157
157
|
expect(wrong_blob).toBeDefined()
|
package/src/OINOBlobConstants.ts
CHANGED
|
@@ -14,14 +14,12 @@ export type OINOBlobConstructor = new (params: OINOBlobParams) => OINOBlob
|
|
|
14
14
|
|
|
15
15
|
/** Blob storage connection parameters */
|
|
16
16
|
export type OINOBlobParams = {
|
|
17
|
-
/** Name of the blob class (e.g.
|
|
17
|
+
/** Name of the blob class (e.g. OINOBlobAzure) */
|
|
18
18
|
type: string
|
|
19
|
-
/** Blob service endpoint URL */
|
|
20
|
-
url: string
|
|
21
19
|
/** Container / bucket name */
|
|
22
20
|
container: string
|
|
23
|
-
/** Provider-specific
|
|
24
|
-
|
|
21
|
+
/** Provider-specific credentials (e.g. Azure Storage connection string or SAS URL) */
|
|
22
|
+
credentials?: any
|
|
25
23
|
}
|
|
26
24
|
|
|
27
25
|
/** A single blob entry returned by a listing operation */
|
package/src/OINOBlobFactory.ts
CHANGED
|
@@ -16,8 +16,8 @@ import { OINOBlobDataModel } from "./OINOBlobDataModel.js"
|
|
|
16
16
|
*
|
|
17
17
|
* Usage:
|
|
18
18
|
* ```ts
|
|
19
|
-
* OINOBlobFactory.registerBlob("
|
|
20
|
-
* const blob = await OINOBlobFactory.createBlob({ type: "
|
|
19
|
+
* OINOBlobFactory.registerBlob("OINOBlobAzure", OINOBlobAzure)
|
|
20
|
+
* const blob = await OINOBlobFactory.createBlob({ type: "OINOBlobAzure", ... })
|
|
21
21
|
* const api = await OINOBlobFactory.createApi(blob, { apiName: "files", tableName: "uploads/" })
|
|
22
22
|
* ```
|
|
23
23
|
*/
|