@oino-ts/types 1.0.6 → 1.0.7
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/OINOBlob.d.ts
CHANGED
|
@@ -22,6 +22,17 @@ export declare abstract class OINOBlob extends OINODataSource {
|
|
|
22
22
|
printCellAsValue(cellValue: OINODataCell, _sqlType: string): string;
|
|
23
23
|
printStringValue(s: string): string;
|
|
24
24
|
parseValueAsCell(v: OINODataCell, nativeType: string): OINODataCell;
|
|
25
|
+
/**
|
|
26
|
+
* Sanitize a blob name by replacing characters that are illegal or unsafe
|
|
27
|
+
* on this storage backend with `_`.
|
|
28
|
+
*
|
|
29
|
+
* The base implementation strips ASCII control characters (U+0000–U+001F
|
|
30
|
+
* and U+007F). Subclasses should override to apply additional
|
|
31
|
+
* platform-specific rules.
|
|
32
|
+
*
|
|
33
|
+
* @param name raw blob name (path within the container)
|
|
34
|
+
*/
|
|
35
|
+
sanitizeName(name: string): string;
|
|
25
36
|
/**
|
|
26
37
|
* Test whether a blob entry matches an `OINOQueryFilter` predicate.
|
|
27
38
|
* Used for in-memory (result) filtering when the storage backend cannot
|
|
@@ -1,37 +1,14 @@
|
|
|
1
1
|
import { OINOApi, OINOResult, OINOQueryFilter } from "@oino-ts/common";
|
|
2
2
|
import { OINOBlob, OINOBlobParams, type OINOBlobEntry, type OINOBlobFetchResult } from "@oino-ts/blob";
|
|
3
|
-
/**
|
|
4
|
-
* AWS S3 (and S3-compatible) implementation of `OINOBlob`.
|
|
5
|
-
*
|
|
6
|
-
* Authenticates using static access key credentials supplied via a JSON-encoded
|
|
7
|
-
* connection string. Connection parameters map as:
|
|
8
|
-
* - `params.url` → optional custom endpoint, e.g. `https://s3.eu-west-1.amazonaws.com`
|
|
9
|
-
* or a compatible service such as MinIO / Cloudflare R2
|
|
10
|
-
* - `params.container` → S3 bucket name
|
|
11
|
-
* - `params.connectionStr` → JSON string: `{"region":"…","accessKeyId":"…","secretAccessKey":"…"}`
|
|
12
|
-
*
|
|
13
|
-
* Register and use via the factory:
|
|
14
|
-
* ```ts
|
|
15
|
-
* import { OINOBlobFactory } from "@oino-ts/blob"
|
|
16
|
-
* import { OINOBlobAwsS3 } from "@oino-ts/blob-aws"
|
|
17
|
-
*
|
|
18
|
-
* OINOBlobFactory.registerBlob("OINOBlobAwsS3", OINOBlobAwsS3)
|
|
19
|
-
*
|
|
20
|
-
* const blob = await OINOBlobFactory.createBlob({
|
|
21
|
-
* type: "OINOBlobAwsS3",
|
|
22
|
-
* url: "", // leave empty for default AWS endpoint
|
|
23
|
-
* container: "my-bucket",
|
|
24
|
-
* connectionStr: JSON.stringify({
|
|
25
|
-
* region: "us-east-1",
|
|
26
|
-
* accessKeyId: process.env.AWS_ACCESS_KEY_ID,
|
|
27
|
-
* secretAccessKey: process.env.AWS_SECRET_ACCESS_KEY
|
|
28
|
-
* })
|
|
29
|
-
* })
|
|
30
|
-
* ```
|
|
31
|
-
*/
|
|
32
3
|
export declare class OINOBlobAwsS3 extends OINOBlob {
|
|
33
4
|
private _s3Client;
|
|
34
5
|
constructor(params: OINOBlobParams);
|
|
6
|
+
/**
|
|
7
|
+
* Replace characters that are unsafe in S3 object key names
|
|
8
|
+
* (`\`, control characters, and shell/URL-special characters
|
|
9
|
+
* `{`, `}`, `[`, `]`, `^`, `` ` ``, `|`, `<`, `>`, `#`, `%`) with `_`.
|
|
10
|
+
*/
|
|
11
|
+
sanitizeName(name: string): string;
|
|
35
12
|
/**
|
|
36
13
|
* Initialise the AWS SDK S3 client from the JSON-encoded `connectionStr`.
|
|
37
14
|
* Does not perform any network call.
|
|
@@ -1,34 +1,13 @@
|
|
|
1
1
|
import { OINOApi, OINOResult, OINOQueryFilter } from "@oino-ts/common";
|
|
2
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
3
|
export declare class OINOBlobAzure extends OINOBlob {
|
|
30
4
|
private _containerClient;
|
|
31
5
|
constructor(params: OINOBlobParams);
|
|
6
|
+
/**
|
|
7
|
+
* Replace characters that Azure Blob Storage does not permit in blob names
|
|
8
|
+
* (`\` and ASCII control characters) with `_`.
|
|
9
|
+
*/
|
|
10
|
+
sanitizeName(name: string): string;
|
|
32
11
|
/**
|
|
33
12
|
* Initialise the Azure SDK client. Does not perform any network call.
|
|
34
13
|
*/
|
|
@@ -128,4 +128,21 @@ export declare class OINONoSqlAzureTable extends OINONoSql {
|
|
|
128
128
|
* @param entity raw entity from the Azure SDK
|
|
129
129
|
*/
|
|
130
130
|
private static entityToEntry;
|
|
131
|
+
/**
|
|
132
|
+
* Encode an entry's `properties` into a flat map storable in Azure Table
|
|
133
|
+
* Storage. Nested objects/arrays are JSON-stringified with a marker
|
|
134
|
+
* prefix (Azure Table Storage stores only primitive property values), and
|
|
135
|
+
* if the serialized properties exceed the 32k per-property limit the whole
|
|
136
|
+
* map is JSON-serialized and split across numbered `chunkN` properties.
|
|
137
|
+
*
|
|
138
|
+
* @param properties entry properties to encode
|
|
139
|
+
*/
|
|
140
|
+
private static encodeProperties;
|
|
141
|
+
/**
|
|
142
|
+
* Decode stored Azure Table Storage properties back into the original
|
|
143
|
+
* `properties` map, reversing `encodeProperties`.
|
|
144
|
+
*
|
|
145
|
+
* @param properties stored properties to decode
|
|
146
|
+
*/
|
|
147
|
+
private static decodeProperties;
|
|
131
148
|
}
|