@oino-ts/blob 1.0.3 → 1.0.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.
@@ -13,8 +13,8 @@ const OINOBlobApi_js_1 = require("./OINOBlobApi.js");
13
13
  *
14
14
  * Usage:
15
15
  * ```ts
16
- * OINOBlobFactory.registerBlob("OINOBlobAzureTable", OINOBlobAzureTable)
17
- * const blob = await OINOBlobFactory.createBlob({ type: "OINOBlobAzureTable", ... })
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("OINOBlobAzureTable", OINOBlobAzureTable)
14
- * const blob = await OINOBlobFactory.createBlob({ type: "OINOBlobAzureTable", ... })
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. OINOBlobAzureTable) */
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 connection string (e.g. Azure Storage connection string or SAS URL) */
16
- connectionStr?: string;
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("OINOBlobAzureTable", OINOBlobAzureTable)
12
- * const blob = await OINOBlobFactory.createBlob({ type: "OINOBlobAzureTable", ... })
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",
3
+ "version": "1.0.4",
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.3",
22
+ "@oino-ts/common": "1.0.4",
23
23
  "oino-ts": "file:.."
24
24
  },
25
25
  "devDependencies": {
26
- "@oino-ts/types": "1.0.3",
26
+ "@oino-ts/types": "1.0.4",
27
27
  "@types/bun": "^1.1.14",
28
- "@types/node": "^21.0.30",
28
+ "@types/node": "^21.0.40",
29
29
  "typescript": "~5.9.0"
30
30
  },
31
31
  "files": [
@@ -6,7 +6,7 @@
6
6
 
7
7
  import { expect, test } from "bun:test"
8
8
 
9
- import { OINOBlobAzureTable } from "@oino-ts/blob-azure"
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: "OINOBlobAzureTable",
45
- url: "https://oinocloudtest.blob.core.windows.net",
44
+ type: "OINOBlobAzure",
46
45
  container: "northwind",
47
- connectionStr: OINOCLOUD_TEST_BLOB_AZURE_CONSTR
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
- connectionStr: OINOCLOUD_TEST_BLOB_S3_CONSTR
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("OINOBlobAzureTable", OINOBlobAzureTable)
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, connectionStr: "WRONG_CONNECTION_STRING" }
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()
@@ -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. OINOBlobAzureTable) */
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 connection string (e.g. Azure Storage connection string or SAS URL) */
24
- connectionStr?: string
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 */
@@ -16,8 +16,8 @@ import { OINOBlobDataModel } from "./OINOBlobDataModel.js"
16
16
  *
17
17
  * Usage:
18
18
  * ```ts
19
- * OINOBlobFactory.registerBlob("OINOBlobAzureTable", OINOBlobAzureTable)
20
- * const blob = await OINOBlobFactory.createBlob({ type: "OINOBlobAzureTable", ... })
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
  */