@oino-ts/types 1.0.2 → 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.
- package/blob/src/OINOBlobConstants.d.ts +3 -5
- package/blob/src/OINOBlobFactory.d.ts +2 -2
- package/blob-aws/src/OINOBlobAwsS3.d.ts +2 -2
- package/blob-azure/src/OINOBlobAzure.d.ts +85 -0
- package/blob-azure/src/index.d.ts +1 -1
- package/nosql/src/OINONoSqlConstants.d.ts +2 -4
- package/nosql-aws/src/OINONoSqlAwsDynamo.d.ts +2 -1
- package/nosql-azure/src/OINONoSqlAzureTable.d.ts +2 -1
- package/package.json +1 -1
|
@@ -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
|
*/
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import { OINOApi, OINOResult, OINOQueryFilter } from "@oino-ts/common";
|
|
2
|
-
import { OINOBlob } from "@oino-ts/blob";
|
|
3
|
-
import { type OINOBlobEntry, type OINOBlobFetchResult } from "@oino-ts/blob";
|
|
2
|
+
import { OINOBlob, OINOBlobParams, type OINOBlobEntry, type OINOBlobFetchResult } from "@oino-ts/blob";
|
|
4
3
|
/**
|
|
5
4
|
* AWS S3 (and S3-compatible) implementation of `OINOBlob`.
|
|
6
5
|
*
|
|
@@ -32,6 +31,7 @@ import { type OINOBlobEntry, type OINOBlobFetchResult } from "@oino-ts/blob";
|
|
|
32
31
|
*/
|
|
33
32
|
export declare class OINOBlobAwsS3 extends OINOBlob {
|
|
34
33
|
private _s3Client;
|
|
34
|
+
constructor(params: OINOBlobParams);
|
|
35
35
|
/**
|
|
36
36
|
* Initialise the AWS SDK S3 client from the JSON-encoded `connectionStr`.
|
|
37
37
|
* Does not perform any network call.
|
|
@@ -0,0 +1,85 @@
|
|
|
1
|
+
import { OINOApi, OINOResult, OINOQueryFilter } from "@oino-ts/common";
|
|
2
|
+
import { OINOBlob, OINOBlobParams, type OINOBlobEntry, type OINOBlobFetchResult } from "@oino-ts/blob";
|
|
3
|
+
/**
|
|
4
|
+
* Azure Blob Storage implementation of `OINOBlob`.
|
|
5
|
+
*
|
|
6
|
+
* Authenticates using an Azure Storage connection string. Connection parameters map as:
|
|
7
|
+
* - `params.url` → blob service endpoint, e.g. `https://<account>.blob.core.windows.net`
|
|
8
|
+
* - `params.container` → container name
|
|
9
|
+
* - `params.connectionStr` → Azure Storage connection string (e.g. `DefaultEndpointsProtocol=https;AccountName=...`)
|
|
10
|
+
*
|
|
11
|
+
* Register and use via the factory:
|
|
12
|
+
* ```ts
|
|
13
|
+
* import { OINOBlobFactory } from "@oino-ts/blob"
|
|
14
|
+
* import { OINOBlobAzure } from "@oino-ts/blob-azure"
|
|
15
|
+
*
|
|
16
|
+
* OINOBlobFactory.registerBlob("OINOBlobAzure", OINOBlobAzure)
|
|
17
|
+
*
|
|
18
|
+
* const blob = await OINOBlobFactory.createBlob({
|
|
19
|
+
* type: "OINOBlobAzure",
|
|
20
|
+
* container: "my-container",
|
|
21
|
+
* credentials: either connectionStr or url and clientId
|
|
22
|
+
* })
|
|
23
|
+
* const api = await OINOBlobFactory.createApi(blob, {
|
|
24
|
+
* apiName: "files",
|
|
25
|
+
* tableName: "uploads/" // blob prefix / folder
|
|
26
|
+
* })
|
|
27
|
+
* ```
|
|
28
|
+
*/
|
|
29
|
+
export declare class OINOBlobAzure extends OINOBlob {
|
|
30
|
+
private _containerClient;
|
|
31
|
+
constructor(params: OINOBlobParams);
|
|
32
|
+
/**
|
|
33
|
+
* Initialise the Azure SDK client. Does not perform any network call.
|
|
34
|
+
*/
|
|
35
|
+
connect(): Promise<OINOResult>;
|
|
36
|
+
/**
|
|
37
|
+
* Verify that the target container exists and is accessible.
|
|
38
|
+
*/
|
|
39
|
+
validate(): Promise<OINOResult>;
|
|
40
|
+
/**
|
|
41
|
+
* Release the client reference (Azure SDK is stateless per-request so nothing to close).
|
|
42
|
+
*/
|
|
43
|
+
disconnect(): Promise<void>;
|
|
44
|
+
/**
|
|
45
|
+
* List all blobs, applying native Azure query filtering where possible and
|
|
46
|
+
* in-memory result filtering for predicates that cannot be expressed as a
|
|
47
|
+
* native query.
|
|
48
|
+
*
|
|
49
|
+
* - The `name` field supports server-side prefix filtering via the Azure
|
|
50
|
+
* `listBlobsFlat` `prefix` option (query filtering).
|
|
51
|
+
* - All other field predicates (`etag`, `lastModified`, `contentLength`,
|
|
52
|
+
* `contentType`) are evaluated in-memory after the listing (result
|
|
53
|
+
* filtering).
|
|
54
|
+
*
|
|
55
|
+
* @param filter optional query filter to apply
|
|
56
|
+
*/
|
|
57
|
+
listEntries(filter?: OINOQueryFilter): Promise<OINOBlobEntry[]>;
|
|
58
|
+
/**
|
|
59
|
+
* Download the raw content of a named blob.
|
|
60
|
+
*
|
|
61
|
+
* @param name full blob name (path within the container)
|
|
62
|
+
*/
|
|
63
|
+
fetchEntry(name: string): Promise<OINOBlobFetchResult>;
|
|
64
|
+
/**
|
|
65
|
+
* Upload (create or replace) a blob with the given binary content.
|
|
66
|
+
*
|
|
67
|
+
* @param name full blob name (path within the container)
|
|
68
|
+
* @param content binary content to store
|
|
69
|
+
* @param contentType MIME type of the content (e.g. `"image/jpeg"`)
|
|
70
|
+
*/
|
|
71
|
+
uploadEntry(name: string, content: Uint8Array, contentType: string): Promise<void>;
|
|
72
|
+
/**
|
|
73
|
+
* Delete a named blob.
|
|
74
|
+
*
|
|
75
|
+
* @param name full blob name (path within the container)
|
|
76
|
+
*/
|
|
77
|
+
deleteEntry(name: string): Promise<void>;
|
|
78
|
+
/**
|
|
79
|
+
* Attach a static `OINOBlobDataModel` to the given API, adding all five
|
|
80
|
+
* standard fields that Azure Blob Storage returns in a listing.
|
|
81
|
+
*
|
|
82
|
+
* @param api the `OINOBlobApi` whose data model is to be initialised
|
|
83
|
+
*/
|
|
84
|
+
initializeApiDatamodel(api: OINOApi): Promise<void>;
|
|
85
|
+
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export {
|
|
1
|
+
export { OINOBlobAzure } from "./OINOBlobAzure.js";
|
|
@@ -8,12 +8,10 @@ export type OINONoSqlConstructor = new (params: OINONoSqlParams) => OINONoSql;
|
|
|
8
8
|
export type OINONoSqlParams = {
|
|
9
9
|
/** Name of the nosql class (e.g. OINONoSqlAzureTable) */
|
|
10
10
|
type: string;
|
|
11
|
-
/** Service endpoint URL */
|
|
12
|
-
url: string;
|
|
13
11
|
/** Table name */
|
|
14
12
|
table: string;
|
|
15
|
-
/** Provider-specific
|
|
16
|
-
|
|
13
|
+
/** Provider-specific credentials (e.g. Azure: { url, connectionStr } / AWS: { region, accessKeyId, secretAccessKey, url? }) */
|
|
14
|
+
credentials?: any;
|
|
17
15
|
/**
|
|
18
16
|
* Optional static partition key. When set, all read/write operations are
|
|
19
17
|
* automatically scoped to this partition key, allowing multiple logical
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { OINOApi, OINOResult, OINOQueryFilter } from "@oino-ts/common";
|
|
2
|
-
import { OINONoSql } from "@oino-ts/nosql";
|
|
2
|
+
import { OINONoSql, OINONoSqlParams } from "@oino-ts/nosql";
|
|
3
3
|
import { type OINONoSqlEntry } from "@oino-ts/nosql";
|
|
4
4
|
/**
|
|
5
5
|
* Mutable accumulator used while building a DynamoDB expression string.
|
|
@@ -96,6 +96,7 @@ export declare class OINONoSqlAwsDynamo extends OINONoSql {
|
|
|
96
96
|
private _hashKeyAttr;
|
|
97
97
|
/** Actual DynamoDB RANGE key attribute name, discovered during validate(). */
|
|
98
98
|
private _rangeKeyAttr;
|
|
99
|
+
constructor(params: OINONoSqlParams);
|
|
99
100
|
/**
|
|
100
101
|
* Walk the `OINOQueryFilter` tree and attempt to build a DynamoDB
|
|
101
102
|
* `FilterExpression` string, accumulating placeholder names and values
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { OINOApi, OINOResult, OINOQueryFilter } from "@oino-ts/common";
|
|
2
|
-
import { OINONoSql } from "@oino-ts/nosql";
|
|
2
|
+
import { OINONoSql, OINONoSqlParams } from "@oino-ts/nosql";
|
|
3
3
|
import { type OINONoSqlEntry } from "@oino-ts/nosql";
|
|
4
4
|
/**
|
|
5
5
|
* Azure Table Storage implementation of `OINONoSql`.
|
|
@@ -54,6 +54,7 @@ import { type OINONoSqlEntry } from "@oino-ts/nosql";
|
|
|
54
54
|
*/
|
|
55
55
|
export declare class OINONoSqlAzureTable extends OINONoSql {
|
|
56
56
|
private _tableClient;
|
|
57
|
+
constructor(params: OINONoSqlParams);
|
|
57
58
|
/**
|
|
58
59
|
* Attempt to translate an `OINOQueryFilter` tree to an Azure Table Storage
|
|
59
60
|
* OData v3 filter expression string.
|