@twin.org/blob-storage-rest-client 0.0.3-next.1 → 0.0.3-next.11
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/README.md +2 -2
- package/dist/es/blobStorageRestClient.js +13 -2
- package/dist/es/blobStorageRestClient.js.map +1 -1
- package/dist/types/blobStorageRestClient.d.ts +9 -1
- package/docs/changelog.md +184 -36
- package/docs/examples.md +98 -1
- package/docs/reference/classes/BlobStorageRestClient.md +30 -12
- package/package.json +5 -5
package/README.md
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
# TWIN Blob Storage
|
|
1
|
+
# TWIN Blob Storage REST Client
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
This package provides client utilities for consuming blob storage service endpoints over HTTP. It helps applications call blob APIs with consistent request construction and response handling.
|
|
4
4
|
|
|
5
5
|
## Installation
|
|
6
6
|
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
import { BaseRestClient } from "@twin.org/api-core";
|
|
4
4
|
import { HttpParameterHelper } from "@twin.org/api-models";
|
|
5
5
|
import { Coerce, Guards, Is, StringHelper, Urn } from "@twin.org/core";
|
|
6
|
-
import { HeaderTypes, MimeTypes } from "@twin.org/web";
|
|
6
|
+
import { HeaderHelper, HeaderTypes, MimeTypes } from "@twin.org/web";
|
|
7
7
|
/**
|
|
8
8
|
* Client for performing blob storage through to REST endpoints.
|
|
9
9
|
*/
|
|
@@ -102,6 +102,13 @@ export class BlobStorageRestClient extends BaseRestClient {
|
|
|
102
102
|
}
|
|
103
103
|
});
|
|
104
104
|
}
|
|
105
|
+
/**
|
|
106
|
+
* Remove all blobs from the storage.
|
|
107
|
+
* @returns Nothing.
|
|
108
|
+
*/
|
|
109
|
+
async empty() {
|
|
110
|
+
await this.fetch("/", "DELETE");
|
|
111
|
+
}
|
|
105
112
|
/**
|
|
106
113
|
* Remove the blob.
|
|
107
114
|
* @param id The id of the blob to remove in urn format.
|
|
@@ -138,7 +145,11 @@ export class BlobStorageRestClient extends BaseRestClient {
|
|
|
138
145
|
cursor
|
|
139
146
|
}
|
|
140
147
|
});
|
|
141
|
-
return
|
|
148
|
+
return {
|
|
149
|
+
entries: response.body,
|
|
150
|
+
cursor: HeaderHelper.extractLinkHeaderRelation(response.headers?.[HeaderTypes.Link], "next")
|
|
151
|
+
?.urlQueryParams?.cursor
|
|
152
|
+
};
|
|
142
153
|
}
|
|
143
154
|
/**
|
|
144
155
|
* Create a download link for the blob.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"blobStorageRestClient.js","sourceRoot":"","sources":["../../src/blobStorageRestClient.ts"],"names":[],"mappings":"AAAA,gCAAgC;AAChC,uCAAuC;AACvC,OAAO,EAAE,cAAc,EAAE,MAAM,oBAAoB,CAAC;AACpD,OAAO,EACN,mBAAmB,EAInB,MAAM,sBAAsB,CAAC;AAa9B,OAAO,EAAE,MAAM,EAAE,MAAM,EAAE,EAAE,EAAE,YAAY,EAAE,GAAG,EAAE,MAAM,gBAAgB,CAAC;AAIvE,OAAO,EAAE,WAAW,EAAE,SAAS,EAAE,MAAM,eAAe,CAAC;AAEvD;;GAEG;AACH,MAAM,OAAO,qBAAsB,SAAQ,cAAc;IACxD;;OAEG;IACI,MAAM,CAAU,UAAU,2BAA2C;IAE5E;;;OAGG;IACH,YAAY,MAA6B;QACxC,KAAK,CAAC,qBAAqB,CAAC,UAAU,EAAE,MAAM,EAAE,MAAM,CAAC,CAAC;IACzD,CAAC;IAED;;;OAGG;IACI,SAAS;QACf,OAAO,qBAAqB,CAAC,UAAU,CAAC;IACzC,CAAC;IAED;;;;;;;;;;;OAWG;IACI,KAAK,CAAC,MAAM,CAClB,IAAY,EACZ,cAAuB,EACvB,aAAsB,EACtB,QAA4B,EAC5B,OAIC;QAED,MAAM,CAAC,YAAY,CAAC,qBAAqB,CAAC,UAAU,UAAgB,IAAI,CAAC,CAAC;QAE1E,MAAM,QAAQ,GAAG,MAAM,IAAI,CAAC,K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,EAAE,CAAC,WAAW,CAAC,QAAQ,CAAC,EAAE,CAAC;YAC9B,aAAa,CAAC,IAAI,CAAC,YAAY,kBAAkB,CAAC,QAAQ,CAAC,EAAE,CAAC,CAAC;QAChE,CAAC;QACD,IAAI,aAAa,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC;YAC9B,IAAI,IAAI,IAAI,aAAa,CAAC,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC;QACvC,CAAC;QAED,OAAO,IAAI,CAAC;IACb,CAAC","sourcesContent":["// Copyright 2024 IOTA Stiftung.\n// SPDX-License-Identifier: Apache-2.0.\nimport { BaseRestClient } from \"@twin.org/api-core\";\nimport {\n\tHttpParameterHelper,\n\ttype IBaseRestClientConfig,\n\ttype ICreatedResponse,\n\ttype INoContentResponse\n} from \"@twin.org/api-models\";\nimport type {\n\tIBlobStorageComponent,\n\tIBlobStorageCreateRequest,\n\tIBlobStorageEntry,\n\tIBlobStorageEntryList,\n\tIBlobStorageGetRequest,\n\tIBlobStorageGetResponse,\n\tIBlobStorageListRequest,\n\tIBlobStorageListResponse,\n\tIBlobStorageRemoveRequest,\n\tIBlobStorageUpdateRequest\n} from \"@twin.org/blob-storage-models\";\nimport { Coerce, Guards, Is, StringHelper, Urn } from \"@twin.org/core\";\nimport type { IJsonLdNodeObject } from \"@twin.org/data-json-ld\";\nimport type { EntityCondition, SortDirection } from \"@twin.org/entity\";\nimport { nameof } from \"@twin.org/nameof\";\nimport { HeaderTypes, MimeTypes } from \"@twin.org/web\";\n\n/**\n * Client for performing blob storage through to REST endpoints.\n */\nexport class BlobStorageRestClient extends BaseRestClient implements IBlobStorageComponent {\n\t/**\n\t * Runtime name for the class.\n\t */\n\tpublic static readonly CLASS_NAME: string = nameof<BlobStorageRestClient>();\n\n\t/**\n\t * Create a new instance of BlobStorageRestClient.\n\t * @param config The configuration for the client.\n\t */\n\tconstructor(config: IBaseRestClientConfig) {\n\t\tsuper(BlobStorageRestClient.CLASS_NAME, config, \"blob\");\n\t}\n\n\t/**\n\t * Returns the class name of the component.\n\t * @returns The class name of the component.\n\t */\n\tpublic className(): string {\n\t\treturn BlobStorageRestClient.CLASS_NAME;\n\t}\n\n\t/**\n\t * Create the blob with some metadata.\n\t * @param blob The data for the blob in base64 format.\n\t * @param encodingFormat Mime type for the blob, will be detected if left undefined.\n\t * @param fileExtension Extension for the blob, will be detected if left undefined.\n\t * @param metadata Data for the custom metadata as JSON-LD.\n\t * @param options Optional options for the creation of the blob.\n\t * @param options.disableEncryption Disables encryption if enabled by default.\n\t * @param options.overrideVaultKeyId Use a different vault key id for encryption, if not provided the default vault key id will be used.\n\t * @param options.namespace The namespace to use for storing, defaults to component configured namespace.\n\t * @returns The id of the stored blob in urn format.\n\t */\n\tpublic async create(\n\t\tblob: string,\n\t\tencodingFormat?: string,\n\t\tfileExtension?: string,\n\t\tmetadata?: IJsonLdNodeObject,\n\t\toptions?: {\n\t\t\tdisableEncryption?: boolean;\n\t\t\toverrideVaultKeyId?: string;\n\t\t\tnamespace?: string;\n\t\t}\n\t): Promise<string> {\n\t\tGuards.stringBase64(BlobStorageRestClient.CLASS_NAME, nameof(blob), blob);\n\n\t\tconst response = await this.fetch<IBlobStorageCreateRequest, ICreatedResponse>(\"/\", \"POST\", {\n\t\t\tbody: {\n\t\t\t\tblob,\n\t\t\t\tencodingFormat,\n\t\t\t\tfileExtension,\n\t\t\t\tmetadata,\n\t\t\t\tdisableEncryption: options?.disableEncryption,\n\t\t\t\toverrideVaultKeyId: options?.overrideVaultKeyId,\n\t\t\t\tnamespace: options?.namespace\n\t\t\t}\n\t\t});\n\n\t\treturn response.headers[HeaderTypes.Location];\n\t}\n\n\t/**\n\t * Get the blob and metadata.\n\t * @param id The id of the blob to get in urn format.\n\t * @param options Optional options for the retrieval of the blob.\n\t * @param options.includeContent Include the content, or just get the metadata.\n\t * @param options.overrideVaultKeyId Use a different vault key id for decryption, if not provided the default vault key id will be used.\n\t * @param options.decompress If the content should be decompressed, if it was compressed when stored, defaults to true.\n\t * @returns The metadata and data for the blob if it can be found.\n\t * @throws Not found error if the blob cannot be found.\n\t */\n\tpublic async get(\n\t\tid: string,\n\t\toptions?: {\n\t\t\tincludeContent?: boolean;\n\t\t\tdecompress?: boolean;\n\t\t\toverrideVaultKeyId?: string;\n\t\t}\n\t): Promise<IBlobStorageEntry> {\n\t\tUrn.guard(BlobStorageRestClient.CLASS_NAME, nameof(id), id);\n\n\t\tconst response = await this.fetch<IBlobStorageGetRequest, IBlobStorageGetResponse>(\n\t\t\t\"/:id\",\n\t\t\t\"GET\",\n\t\t\t{\n\t\t\t\theaders: {\n\t\t\t\t\t[HeaderTypes.Accept]: MimeTypes.JsonLd\n\t\t\t\t},\n\t\t\t\tpathParams: {\n\t\t\t\t\tid\n\t\t\t\t},\n\t\t\t\tquery: {\n\t\t\t\t\tincludeContent: Coerce.string(options?.includeContent),\n\t\t\t\t\tdecompress: Coerce.string(options?.decompress),\n\t\t\t\t\toverrideVaultKeyId: options?.overrideVaultKeyId\n\t\t\t\t}\n\t\t\t}\n\t\t);\n\n\t\treturn response.body;\n\t}\n\n\t/**\n\t * Update the blob with metadata.\n\t * @param id The id of the blob metadata to update.\n\t * @param encodingFormat Mime type for the blob, will be detected if left undefined.\n\t * @param fileExtension Extension for the blob, will be detected if left undefined.\n\t * @param metadata Data for the custom metadata as JSON-LD.\n\t * @returns Nothing.\n\t * @throws Not found error if the blob cannot be found.\n\t */\n\tpublic async update(\n\t\tid: string,\n\t\tencodingFormat?: string,\n\t\tfileExtension?: string,\n\t\tmetadata?: IJsonLdNodeObject\n\t): Promise<void> {\n\t\tUrn.guard(BlobStorageRestClient.CLASS_NAME, nameof(id), id);\n\n\t\tawait this.fetch<IBlobStorageUpdateRequest, INoContentResponse>(\"/:id\", \"PUT\", {\n\t\t\tpathParams: {\n\t\t\t\tid\n\t\t\t},\n\t\t\tbody: {\n\t\t\t\tencodingFormat,\n\t\t\t\tfileExtension,\n\t\t\t\tmetadata\n\t\t\t}\n\t\t});\n\t}\n\n\t/**\n\t * Remove the blob.\n\t * @param id The id of the blob to remove in urn format.\n\t * @returns Nothing.\n\t */\n\tpublic async remove(id: string): Promise<void> {\n\t\tUrn.guard(BlobStorageRestClient.CLASS_NAME, nameof(id), id);\n\n\t\tawait this.fetch<IBlobStorageRemoveRequest, INoContentResponse>(\"/:id\", \"DELETE\", {\n\t\t\tpathParams: {\n\t\t\t\tid\n\t\t\t}\n\t\t});\n\t}\n\n\t/**\n\t * Query all the blob storage entries which match the conditions.\n\t * @param conditions The conditions to match for the entries.\n\t * @param orderBy The order for the results, defaults to created.\n\t * @param orderByDirection The direction for the order, defaults to descending.\n\t * @param cursor The cursor to request the next page of entries.\n\t * @param limit The suggested number of entries to return in each chunk, in some scenarios can return a different amount.\n\t * @returns All the entries for the storage matching the conditions,\n\t * and a cursor which can be used to request more entities.\n\t */\n\tpublic async query(\n\t\tconditions?: EntityCondition<IBlobStorageEntry>,\n\t\torderBy?: keyof Pick<IBlobStorageEntry, \"dateCreated\" | \"dateModified\">,\n\t\torderByDirection?: SortDirection,\n\t\tcursor?: string,\n\t\tlimit?: number\n\t): Promise<IBlobStorageEntryList> {\n\t\tconst response = await this.fetch<IBlobStorageListRequest, IBlobStorageListResponse>(\n\t\t\t\"/\",\n\t\t\t\"GET\",\n\t\t\t{\n\t\t\t\theaders: {\n\t\t\t\t\t[HeaderTypes.Accept]: MimeTypes.JsonLd\n\t\t\t\t},\n\t\t\t\tquery: {\n\t\t\t\t\tconditions: HttpParameterHelper.objectToString(conditions),\n\t\t\t\t\torderBy,\n\t\t\t\t\torderByDirection,\n\t\t\t\t\tlimit: Coerce.string(limit),\n\t\t\t\t\tcursor\n\t\t\t\t}\n\t\t\t}\n\t\t);\n\n\t\treturn response.body;\n\t}\n\n\t/**\n\t * Create a download link for the blob.\n\t * @param id The id of the blob to get in urn format.\n\t * @param download Should the content disposition be set to download.\n\t * @param filename The filename to use for the download.\n\t * @returns The download link.\n\t */\n\tpublic createDownloadLink(id: string, download?: boolean, filename?: string): string {\n\t\tUrn.guard(BlobStorageRestClient.CLASS_NAME, nameof(id), id);\n\n\t\tlet link = StringHelper.trimTrailingSlashes(this.getEndpointWithPrefix());\n\t\tlink += `/${id}/content`;\n\n\t\tconst downloadQuery: string[] = [];\n\t\tif (download) {\n\t\t\tdownloadQuery.push(\"download=true\");\n\t\t}\n\t\tif (Is.stringValue(filename)) {\n\t\t\tdownloadQuery.push(`filename=${encodeURIComponent(filename)}`);\n\t\t}\n\t\tif (downloadQuery.length > 0) {\n\t\t\tlink += `?${downloadQuery.join(\"&\")}`;\n\t\t}\n\n\t\treturn link;\n\t}\n}\n"]}
|
|
1
|
+
{"version":3,"file":"blobStorageRestClient.js","sourceRoot":"","sources":["../../src/blobStorageRestClient.ts"],"names":[],"mappings":"AAAA,gCAAgC;AAChC,uCAAuC;AACvC,OAAO,EAAE,cAAc,EAAE,MAAM,oBAAoB,CAAC;AACpD,OAAO,EACN,mBAAmB,EAInB,MAAM,sBAAsB,CAAC;AAc9B,OAAO,EAAE,MAAM,EAAE,MAAM,EAAE,EAAE,EAAE,YAAY,EAAE,GAAG,EAAE,MAAM,gBAAgB,CAAC;AAIvE,OAAO,EAAE,YAAY,EAAE,WAAW,EAAE,SAAS,EAAE,MAAM,eAAe,CAAC;AAErE;;GAEG;AACH,MAAM,OAAO,qBAAsB,SAAQ,cAAc;IACxD;;OAEG;IACI,MAAM,CAAU,UAAU,2BAA2C;IAE5E;;;OAGG;IACH,YAAY,MAA6B;QACxC,KAAK,CAAC,qBAAqB,CAAC,UAAU,EAAE,MAAM,EAAE,MAAM,CAAC,CAAC;IACzD,CAAC;IAED;;;OAGG;IACI,SAAS;QACf,OAAO,qBAAqB,CAAC,UAAU,CAAC;IACzC,CAAC;IAED;;;;;;;;;;;OAWG;IACI,KAAK,CAAC,MAAM,CAClB,IAAY,EACZ,cAAuB,EACvB,aAAsB,EACtB,QAA4B,EAC5B,OAIC;QAED,MAAM,CAAC,YAAY,CAAC,qBAAqB,CA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AE,QAAkB,EAAE,QAAiB;QAC1E,GAAG,CAAC,KAAK,CAAC,qBAAqB,CAAC,UAAU,QAAc,EAAE,CAAC,CAAC;QAE5D,IAAI,IAAI,GAAG,YAAY,CAAC,mBAAmB,CAAC,IAAI,CAAC,qBAAqB,EAAE,CAAC,CAAC;QAC1E,IAAI,IAAI,IAAI,EAAE,UAAU,CAAC;QAEzB,MAAM,aAAa,GAAa,EAAE,CAAC;QACnC,IAAI,QAAQ,EAAE,CAAC;YACd,aAAa,CAAC,IAAI,CAAC,eAAe,CAAC,CAAC;QACrC,CAAC;QACD,IAAI,EAAE,CAAC,WAAW,CAAC,QAAQ,CAAC,EAAE,CAAC;YAC9B,aAAa,CAAC,IAAI,CAAC,YAAY,kBAAkB,CAAC,QAAQ,CAAC,EAAE,CAAC,CAAC;QAChE,CAAC;QACD,IAAI,aAAa,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC;YAC9B,IAAI,IAAI,IAAI,aAAa,CAAC,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC;QACvC,CAAC;QAED,OAAO,IAAI,CAAC;IACb,CAAC","sourcesContent":["// Copyright 2024 IOTA Stiftung.\n// SPDX-License-Identifier: Apache-2.0.\nimport { BaseRestClient } from \"@twin.org/api-core\";\nimport {\n\tHttpParameterHelper,\n\ttype IBaseRestClientConfig,\n\ttype ICreatedResponse,\n\ttype INoContentResponse\n} from \"@twin.org/api-models\";\nimport type {\n\tIBlobStorageComponent,\n\tIBlobStorageCreateRequest,\n\tIBlobStorageEmptyRequest,\n\tIBlobStorageEntry,\n\tIBlobStorageEntryList,\n\tIBlobStorageGetRequest,\n\tIBlobStorageGetResponse,\n\tIBlobStorageListRequest,\n\tIBlobStorageListResponse,\n\tIBlobStorageRemoveRequest,\n\tIBlobStorageUpdateRequest\n} from \"@twin.org/blob-storage-models\";\nimport { Coerce, Guards, Is, StringHelper, Urn } from \"@twin.org/core\";\nimport type { IJsonLdNodeObject } from \"@twin.org/data-json-ld\";\nimport type { EntityCondition, SortDirection } from \"@twin.org/entity\";\nimport { nameof } from \"@twin.org/nameof\";\nimport { HeaderHelper, HeaderTypes, MimeTypes } from \"@twin.org/web\";\n\n/**\n * Client for performing blob storage through to REST endpoints.\n */\nexport class BlobStorageRestClient extends BaseRestClient implements IBlobStorageComponent {\n\t/**\n\t * Runtime name for the class.\n\t */\n\tpublic static readonly CLASS_NAME: string = nameof<BlobStorageRestClient>();\n\n\t/**\n\t * Create a new instance of BlobStorageRestClient.\n\t * @param config The configuration for the client.\n\t */\n\tconstructor(config: IBaseRestClientConfig) {\n\t\tsuper(BlobStorageRestClient.CLASS_NAME, config, \"blob\");\n\t}\n\n\t/**\n\t * Returns the class name of the component.\n\t * @returns The class name of the component.\n\t */\n\tpublic className(): string {\n\t\treturn BlobStorageRestClient.CLASS_NAME;\n\t}\n\n\t/**\n\t * Create the blob with some metadata.\n\t * @param blob The data for the blob in base64 format.\n\t * @param encodingFormat Mime type for the blob, will be detected if left undefined.\n\t * @param fileExtension Extension for the blob, will be detected if left undefined.\n\t * @param metadata Data for the custom metadata as JSON-LD.\n\t * @param options Optional options for the creation of the blob.\n\t * @param options.disableEncryption Disables encryption if enabled by default.\n\t * @param options.overrideVaultKeyId Use a different vault key id for encryption, if not provided the default vault key id will be used.\n\t * @param options.namespace The namespace to use for storing, defaults to component configured namespace.\n\t * @returns The id of the stored blob in urn format.\n\t */\n\tpublic async create(\n\t\tblob: string,\n\t\tencodingFormat?: string,\n\t\tfileExtension?: string,\n\t\tmetadata?: IJsonLdNodeObject,\n\t\toptions?: {\n\t\t\tdisableEncryption?: boolean;\n\t\t\toverrideVaultKeyId?: string;\n\t\t\tnamespace?: string;\n\t\t}\n\t): Promise<string> {\n\t\tGuards.stringBase64(BlobStorageRestClient.CLASS_NAME, nameof(blob), blob);\n\n\t\tconst response = await this.fetch<IBlobStorageCreateRequest, ICreatedResponse>(\"/\", \"POST\", {\n\t\t\tbody: {\n\t\t\t\tblob,\n\t\t\t\tencodingFormat,\n\t\t\t\tfileExtension,\n\t\t\t\tmetadata,\n\t\t\t\tdisableEncryption: options?.disableEncryption,\n\t\t\t\toverrideVaultKeyId: options?.overrideVaultKeyId,\n\t\t\t\tnamespace: options?.namespace\n\t\t\t}\n\t\t});\n\n\t\treturn response.headers[HeaderTypes.Location];\n\t}\n\n\t/**\n\t * Get the blob and metadata.\n\t * @param id The id of the blob to get in urn format.\n\t * @param options Optional options for the retrieval of the blob.\n\t * @param options.includeContent Include the content, or just get the metadata.\n\t * @param options.overrideVaultKeyId Use a different vault key id for decryption, if not provided the default vault key id will be used.\n\t * @param options.decompress If the content should be decompressed, if it was compressed when stored, defaults to true.\n\t * @returns The metadata and data for the blob if it can be found.\n\t * @throws Not found error if the blob cannot be found.\n\t */\n\tpublic async get(\n\t\tid: string,\n\t\toptions?: {\n\t\t\tincludeContent?: boolean;\n\t\t\tdecompress?: boolean;\n\t\t\toverrideVaultKeyId?: string;\n\t\t}\n\t): Promise<IBlobStorageEntry> {\n\t\tUrn.guard(BlobStorageRestClient.CLASS_NAME, nameof(id), id);\n\n\t\tconst response = await this.fetch<IBlobStorageGetRequest, IBlobStorageGetResponse>(\n\t\t\t\"/:id\",\n\t\t\t\"GET\",\n\t\t\t{\n\t\t\t\theaders: {\n\t\t\t\t\t[HeaderTypes.Accept]: MimeTypes.JsonLd\n\t\t\t\t},\n\t\t\t\tpathParams: {\n\t\t\t\t\tid\n\t\t\t\t},\n\t\t\t\tquery: {\n\t\t\t\t\tincludeContent: Coerce.string(options?.includeContent),\n\t\t\t\t\tdecompress: Coerce.string(options?.decompress),\n\t\t\t\t\toverrideVaultKeyId: options?.overrideVaultKeyId\n\t\t\t\t}\n\t\t\t}\n\t\t);\n\n\t\treturn response.body;\n\t}\n\n\t/**\n\t * Update the blob with metadata.\n\t * @param id The id of the blob metadata to update.\n\t * @param encodingFormat Mime type for the blob, will be detected if left undefined.\n\t * @param fileExtension Extension for the blob, will be detected if left undefined.\n\t * @param metadata Data for the custom metadata as JSON-LD.\n\t * @returns Nothing.\n\t * @throws Not found error if the blob cannot be found.\n\t */\n\tpublic async update(\n\t\tid: string,\n\t\tencodingFormat?: string,\n\t\tfileExtension?: string,\n\t\tmetadata?: IJsonLdNodeObject\n\t): Promise<void> {\n\t\tUrn.guard(BlobStorageRestClient.CLASS_NAME, nameof(id), id);\n\n\t\tawait this.fetch<IBlobStorageUpdateRequest, INoContentResponse>(\"/:id\", \"PUT\", {\n\t\t\tpathParams: {\n\t\t\t\tid\n\t\t\t},\n\t\t\tbody: {\n\t\t\t\tencodingFormat,\n\t\t\t\tfileExtension,\n\t\t\t\tmetadata\n\t\t\t}\n\t\t});\n\t}\n\n\t/**\n\t * Remove all blobs from the storage.\n\t * @returns Nothing.\n\t */\n\tpublic async empty(): Promise<void> {\n\t\tawait this.fetch<IBlobStorageEmptyRequest, INoContentResponse>(\"/\", \"DELETE\");\n\t}\n\n\t/**\n\t * Remove the blob.\n\t * @param id The id of the blob to remove in urn format.\n\t * @returns Nothing.\n\t */\n\tpublic async remove(id: string): Promise<void> {\n\t\tUrn.guard(BlobStorageRestClient.CLASS_NAME, nameof(id), id);\n\n\t\tawait this.fetch<IBlobStorageRemoveRequest, INoContentResponse>(\"/:id\", \"DELETE\", {\n\t\t\tpathParams: {\n\t\t\t\tid\n\t\t\t}\n\t\t});\n\t}\n\n\t/**\n\t * Query all the blob storage entries which match the conditions.\n\t * @param conditions The conditions to match for the entries.\n\t * @param orderBy The order for the results, defaults to created.\n\t * @param orderByDirection The direction for the order, defaults to descending.\n\t * @param cursor The cursor to request the next page of entries.\n\t * @param limit The suggested number of entries to return in each chunk, in some scenarios can return a different amount.\n\t * @returns All the entries for the storage matching the conditions,\n\t * and a cursor which can be used to request more entities.\n\t */\n\tpublic async query(\n\t\tconditions?: EntityCondition<IBlobStorageEntry>,\n\t\torderBy?: keyof Pick<IBlobStorageEntry, \"dateCreated\" | \"dateModified\">,\n\t\torderByDirection?: SortDirection,\n\t\tcursor?: string,\n\t\tlimit?: number\n\t): Promise<{\n\t\tentries: IBlobStorageEntryList;\n\t\tcursor?: string;\n\t}> {\n\t\tconst response = await this.fetch<IBlobStorageListRequest, IBlobStorageListResponse>(\n\t\t\t\"/\",\n\t\t\t\"GET\",\n\t\t\t{\n\t\t\t\theaders: {\n\t\t\t\t\t[HeaderTypes.Accept]: MimeTypes.JsonLd\n\t\t\t\t},\n\t\t\t\tquery: {\n\t\t\t\t\tconditions: HttpParameterHelper.objectToString(conditions),\n\t\t\t\t\torderBy,\n\t\t\t\t\torderByDirection,\n\t\t\t\t\tlimit: Coerce.string(limit),\n\t\t\t\t\tcursor\n\t\t\t\t}\n\t\t\t}\n\t\t);\n\n\t\treturn {\n\t\t\tentries: response.body,\n\t\t\tcursor: HeaderHelper.extractLinkHeaderRelation(response.headers?.[HeaderTypes.Link], \"next\")\n\t\t\t\t?.urlQueryParams?.cursor\n\t\t};\n\t}\n\n\t/**\n\t * Create a download link for the blob.\n\t * @param id The id of the blob to get in urn format.\n\t * @param download Should the content disposition be set to download.\n\t * @param filename The filename to use for the download.\n\t * @returns The download link.\n\t */\n\tpublic createDownloadLink(id: string, download?: boolean, filename?: string): string {\n\t\tUrn.guard(BlobStorageRestClient.CLASS_NAME, nameof(id), id);\n\n\t\tlet link = StringHelper.trimTrailingSlashes(this.getEndpointWithPrefix());\n\t\tlink += `/${id}/content`;\n\n\t\tconst downloadQuery: string[] = [];\n\t\tif (download) {\n\t\t\tdownloadQuery.push(\"download=true\");\n\t\t}\n\t\tif (Is.stringValue(filename)) {\n\t\t\tdownloadQuery.push(`filename=${encodeURIComponent(filename)}`);\n\t\t}\n\t\tif (downloadQuery.length > 0) {\n\t\t\tlink += `?${downloadQuery.join(\"&\")}`;\n\t\t}\n\n\t\treturn link;\n\t}\n}\n"]}
|
|
@@ -63,6 +63,11 @@ export declare class BlobStorageRestClient extends BaseRestClient implements IBl
|
|
|
63
63
|
* @throws Not found error if the blob cannot be found.
|
|
64
64
|
*/
|
|
65
65
|
update(id: string, encodingFormat?: string, fileExtension?: string, metadata?: IJsonLdNodeObject): Promise<void>;
|
|
66
|
+
/**
|
|
67
|
+
* Remove all blobs from the storage.
|
|
68
|
+
* @returns Nothing.
|
|
69
|
+
*/
|
|
70
|
+
empty(): Promise<void>;
|
|
66
71
|
/**
|
|
67
72
|
* Remove the blob.
|
|
68
73
|
* @param id The id of the blob to remove in urn format.
|
|
@@ -79,7 +84,10 @@ export declare class BlobStorageRestClient extends BaseRestClient implements IBl
|
|
|
79
84
|
* @returns All the entries for the storage matching the conditions,
|
|
80
85
|
* and a cursor which can be used to request more entities.
|
|
81
86
|
*/
|
|
82
|
-
query(conditions?: EntityCondition<IBlobStorageEntry>, orderBy?: keyof Pick<IBlobStorageEntry, "dateCreated" | "dateModified">, orderByDirection?: SortDirection, cursor?: string, limit?: number): Promise<
|
|
87
|
+
query(conditions?: EntityCondition<IBlobStorageEntry>, orderBy?: keyof Pick<IBlobStorageEntry, "dateCreated" | "dateModified">, orderByDirection?: SortDirection, cursor?: string, limit?: number): Promise<{
|
|
88
|
+
entries: IBlobStorageEntryList;
|
|
89
|
+
cursor?: string;
|
|
90
|
+
}>;
|
|
83
91
|
/**
|
|
84
92
|
* Create a download link for the blob.
|
|
85
93
|
* @param id The id of the blob to get in urn format.
|
package/docs/changelog.md
CHANGED
|
@@ -1,18 +1,166 @@
|
|
|
1
|
-
#
|
|
1
|
+
# Changelog
|
|
2
2
|
|
|
3
|
-
## [0.0.3-next.
|
|
3
|
+
## [0.0.3-next.11](https://github.com/iotaledger/twin-blob-storage/compare/blob-storage-rest-client-v0.0.3-next.10...blob-storage-rest-client-v0.0.3-next.11) (2026-05-08)
|
|
4
4
|
|
|
5
5
|
|
|
6
6
|
### Features
|
|
7
7
|
|
|
8
|
-
* add
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
*
|
|
14
|
-
*
|
|
15
|
-
*
|
|
8
|
+
* add empty and teardown methods ([#49](https://github.com/iotaledger/twin-blob-storage/issues/49)) ([cec6248](https://github.com/iotaledger/twin-blob-storage/commit/cec624809ffd2f2baa4b7b8cbf72a7247b8703ed))
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
### Dependencies
|
|
12
|
+
|
|
13
|
+
* The following workspace dependencies were updated
|
|
14
|
+
* dependencies
|
|
15
|
+
* @twin.org/blob-storage-models bumped from 0.0.3-next.10 to 0.0.3-next.11
|
|
16
|
+
|
|
17
|
+
## [0.0.3-next.10](https://github.com/iotaledger/twin-blob-storage/compare/blob-storage-rest-client-v0.0.3-next.9...blob-storage-rest-client-v0.0.3-next.10) (2026-05-07)
|
|
18
|
+
|
|
19
|
+
|
|
20
|
+
### Miscellaneous Chores
|
|
21
|
+
|
|
22
|
+
* **blob-storage-rest-client:** Synchronize repo versions
|
|
23
|
+
|
|
24
|
+
|
|
25
|
+
### Dependencies
|
|
26
|
+
|
|
27
|
+
* The following workspace dependencies were updated
|
|
28
|
+
* dependencies
|
|
29
|
+
* @twin.org/blob-storage-models bumped from 0.0.3-next.9 to 0.0.3-next.10
|
|
30
|
+
|
|
31
|
+
## [0.0.3-next.9](https://github.com/iotaledger/twin-blob-storage/compare/blob-storage-rest-client-v0.0.3-next.8...blob-storage-rest-client-v0.0.3-next.9) (2026-05-07)
|
|
32
|
+
|
|
33
|
+
|
|
34
|
+
### Features
|
|
35
|
+
|
|
36
|
+
* add compression support ([67d239b](https://github.com/iotaledger/twin-blob-storage/commit/67d239bca8321bd90bf4ff93167c564130309730))
|
|
37
|
+
* add context id features ([#30](https://github.com/iotaledger/twin-blob-storage/issues/30)) ([fbf1c92](https://github.com/iotaledger/twin-blob-storage/commit/fbf1c9276424c841ef5ef3f4de8469ab3fba7e9c))
|
|
38
|
+
* add validate-locales ([f20fcec](https://github.com/iotaledger/twin-blob-storage/commit/f20fceced91e39a0c9edb770b2e43ce944c92f3c))
|
|
39
|
+
* additional encryption options on per item basis ([4b95a65](https://github.com/iotaledger/twin-blob-storage/commit/4b95a656d19e3b571cea905e36f29b679b13e1e8))
|
|
40
|
+
* eslint migration to flat config ([e4239dd](https://github.com/iotaledger/twin-blob-storage/commit/e4239dd1c721955cff7f0357255d2bba15319972))
|
|
41
|
+
* replace nextItem property with Link header ([#37](https://github.com/iotaledger/twin-blob-storage/issues/37)) ([0b68da5](https://github.com/iotaledger/twin-blob-storage/commit/0b68da58549c9e52eb2313ea5a868573840d5ca6))
|
|
42
|
+
* update dependencies ([56f0094](https://github.com/iotaledger/twin-blob-storage/commit/56f0094b68d8bd22864cd899ac1b61d95540f719))
|
|
43
|
+
* update framework core ([ff339fe](https://github.com/iotaledger/twin-blob-storage/commit/ff339fe7e3f09ddff429907834bdf43617e9c05e))
|
|
44
|
+
* use shared store mechanism ([#12](https://github.com/iotaledger/twin-blob-storage/issues/12)) ([cae8110](https://github.com/iotaledger/twin-blob-storage/commit/cae8110681847a1ac4fcac968b8196694e49c320))
|
|
45
|
+
|
|
46
|
+
|
|
47
|
+
### Dependencies
|
|
48
|
+
|
|
49
|
+
* The following workspace dependencies were updated
|
|
50
|
+
* dependencies
|
|
51
|
+
* @twin.org/blob-storage-models bumped from 0.0.3-next.8 to 0.0.3-next.9
|
|
52
|
+
|
|
53
|
+
## [0.0.3-next.8](https://github.com/iotaledger/twin-blob-storage/compare/blob-storage-rest-client-v0.0.3-next.7...blob-storage-rest-client-v0.0.3-next.8) (2026-05-07)
|
|
54
|
+
|
|
55
|
+
|
|
56
|
+
### Miscellaneous Chores
|
|
57
|
+
|
|
58
|
+
* **blob-storage-rest-client:** Synchronize repo versions
|
|
59
|
+
|
|
60
|
+
|
|
61
|
+
### Dependencies
|
|
62
|
+
|
|
63
|
+
* The following workspace dependencies were updated
|
|
64
|
+
* dependencies
|
|
65
|
+
* @twin.org/blob-storage-models bumped from 0.0.3-next.7 to 0.0.3-next.8
|
|
66
|
+
|
|
67
|
+
## [0.0.3-next.7](https://github.com/iotaledger/twin-blob-storage/compare/blob-storage-rest-client-v0.0.3-next.6...blob-storage-rest-client-v0.0.3-next.7) (2026-02-25)
|
|
68
|
+
|
|
69
|
+
|
|
70
|
+
### Miscellaneous Chores
|
|
71
|
+
|
|
72
|
+
* **blob-storage-rest-client:** Synchronize repo versions
|
|
73
|
+
|
|
74
|
+
|
|
75
|
+
### Dependencies
|
|
76
|
+
|
|
77
|
+
* The following workspace dependencies were updated
|
|
78
|
+
* dependencies
|
|
79
|
+
* @twin.org/blob-storage-models bumped from 0.0.3-next.6 to 0.0.3-next.7
|
|
80
|
+
|
|
81
|
+
## [0.0.3-next.6](https://github.com/iotaledger/twin-blob-storage/compare/blob-storage-rest-client-v0.0.3-next.5...blob-storage-rest-client-v0.0.3-next.6) (2026-02-09)
|
|
82
|
+
|
|
83
|
+
|
|
84
|
+
### Miscellaneous Chores
|
|
85
|
+
|
|
86
|
+
* **blob-storage-rest-client:** Synchronize repo versions
|
|
87
|
+
|
|
88
|
+
|
|
89
|
+
### Dependencies
|
|
90
|
+
|
|
91
|
+
* The following workspace dependencies were updated
|
|
92
|
+
* dependencies
|
|
93
|
+
* @twin.org/blob-storage-models bumped from 0.0.3-next.5 to 0.0.3-next.6
|
|
94
|
+
|
|
95
|
+
## [0.0.3-next.5](https://github.com/iotaledger/twin-blob-storage/compare/blob-storage-rest-client-v0.0.3-next.4...blob-storage-rest-client-v0.0.3-next.5) (2026-01-26)
|
|
96
|
+
|
|
97
|
+
|
|
98
|
+
### Miscellaneous Chores
|
|
99
|
+
|
|
100
|
+
* **blob-storage-rest-client:** Synchronize repo versions
|
|
101
|
+
|
|
102
|
+
|
|
103
|
+
### Dependencies
|
|
104
|
+
|
|
105
|
+
* The following workspace dependencies were updated
|
|
106
|
+
* dependencies
|
|
107
|
+
* @twin.org/blob-storage-models bumped from 0.0.3-next.4 to 0.0.3-next.5
|
|
108
|
+
|
|
109
|
+
## [0.0.3-next.4](https://github.com/iotaledger/twin-blob-storage/compare/blob-storage-rest-client-v0.0.3-next.3...blob-storage-rest-client-v0.0.3-next.4) (2026-01-23)
|
|
110
|
+
|
|
111
|
+
|
|
112
|
+
### Features
|
|
113
|
+
|
|
114
|
+
* replace nextItem property with Link header ([#37](https://github.com/iotaledger/twin-blob-storage/issues/37)) ([0b68da5](https://github.com/iotaledger/twin-blob-storage/commit/0b68da58549c9e52eb2313ea5a868573840d5ca6))
|
|
115
|
+
|
|
116
|
+
|
|
117
|
+
### Dependencies
|
|
118
|
+
|
|
119
|
+
* The following workspace dependencies were updated
|
|
120
|
+
* dependencies
|
|
121
|
+
* @twin.org/blob-storage-models bumped from 0.0.3-next.3 to 0.0.3-next.4
|
|
122
|
+
|
|
123
|
+
## [0.0.3-next.3](https://github.com/iotaledger/twin-blob-storage/compare/blob-storage-rest-client-v0.0.3-next.2...blob-storage-rest-client-v0.0.3-next.3) (2026-01-21)
|
|
124
|
+
|
|
125
|
+
|
|
126
|
+
### Miscellaneous Chores
|
|
127
|
+
|
|
128
|
+
* **blob-storage-rest-client:** Synchronize repo versions
|
|
129
|
+
|
|
130
|
+
|
|
131
|
+
### Dependencies
|
|
132
|
+
|
|
133
|
+
* The following workspace dependencies were updated
|
|
134
|
+
* dependencies
|
|
135
|
+
* @twin.org/blob-storage-models bumped from 0.0.3-next.2 to 0.0.3-next.3
|
|
136
|
+
|
|
137
|
+
## [0.0.3-next.2](https://github.com/iotaledger/twin-blob-storage/compare/blob-storage-rest-client-v0.0.3-next.1...blob-storage-rest-client-v0.0.3-next.2) (2026-01-14)
|
|
138
|
+
|
|
139
|
+
|
|
140
|
+
### Miscellaneous Chores
|
|
141
|
+
|
|
142
|
+
* **blob-storage-rest-client:** Synchronize repo versions
|
|
143
|
+
|
|
144
|
+
|
|
145
|
+
### Dependencies
|
|
146
|
+
|
|
147
|
+
* The following workspace dependencies were updated
|
|
148
|
+
* dependencies
|
|
149
|
+
* @twin.org/blob-storage-models bumped from 0.0.3-next.1 to 0.0.3-next.2
|
|
150
|
+
|
|
151
|
+
## [0.0.3-next.1](https://github.com/iotaledger/twin-blob-storage/compare/blob-storage-rest-client-v0.0.3-next.0...blob-storage-rest-client-v0.0.3-next.1) (2025-11-11)
|
|
152
|
+
|
|
153
|
+
|
|
154
|
+
### Features
|
|
155
|
+
|
|
156
|
+
* add compression support ([67d239b](https://github.com/iotaledger/twin-blob-storage/commit/67d239bca8321bd90bf4ff93167c564130309730))
|
|
157
|
+
* add context id features ([#30](https://github.com/iotaledger/twin-blob-storage/issues/30)) ([fbf1c92](https://github.com/iotaledger/twin-blob-storage/commit/fbf1c9276424c841ef5ef3f4de8469ab3fba7e9c))
|
|
158
|
+
* add validate-locales ([f20fcec](https://github.com/iotaledger/twin-blob-storage/commit/f20fceced91e39a0c9edb770b2e43ce944c92f3c))
|
|
159
|
+
* additional encryption options on per item basis ([4b95a65](https://github.com/iotaledger/twin-blob-storage/commit/4b95a656d19e3b571cea905e36f29b679b13e1e8))
|
|
160
|
+
* eslint migration to flat config ([e4239dd](https://github.com/iotaledger/twin-blob-storage/commit/e4239dd1c721955cff7f0357255d2bba15319972))
|
|
161
|
+
* update dependencies ([56f0094](https://github.com/iotaledger/twin-blob-storage/commit/56f0094b68d8bd22864cd899ac1b61d95540f719))
|
|
162
|
+
* update framework core ([ff339fe](https://github.com/iotaledger/twin-blob-storage/commit/ff339fe7e3f09ddff429907834bdf43617e9c05e))
|
|
163
|
+
* use shared store mechanism ([#12](https://github.com/iotaledger/twin-blob-storage/issues/12)) ([cae8110](https://github.com/iotaledger/twin-blob-storage/commit/cae8110681847a1ac4fcac968b8196694e49c320))
|
|
16
164
|
|
|
17
165
|
|
|
18
166
|
### Dependencies
|
|
@@ -21,12 +169,12 @@
|
|
|
21
169
|
* dependencies
|
|
22
170
|
* @twin.org/blob-storage-models bumped from 0.0.3-next.0 to 0.0.3-next.1
|
|
23
171
|
|
|
24
|
-
## [0.0.2-next.5](https://github.com/
|
|
172
|
+
## [0.0.2-next.5](https://github.com/iotaledger/twin-blob-storage/compare/blob-storage-rest-client-v0.0.2-next.4...blob-storage-rest-client-v0.0.2-next.5) (2025-10-09)
|
|
25
173
|
|
|
26
174
|
|
|
27
175
|
### Features
|
|
28
176
|
|
|
29
|
-
* add validate-locales ([f20fcec](https://github.com/
|
|
177
|
+
* add validate-locales ([f20fcec](https://github.com/iotaledger/twin-blob-storage/commit/f20fceced91e39a0c9edb770b2e43ce944c92f3c))
|
|
30
178
|
|
|
31
179
|
|
|
32
180
|
### Dependencies
|
|
@@ -35,7 +183,7 @@
|
|
|
35
183
|
* dependencies
|
|
36
184
|
* @twin.org/blob-storage-models bumped from 0.0.2-next.4 to 0.0.2-next.5
|
|
37
185
|
|
|
38
|
-
## [0.0.2-next.4](https://github.com/
|
|
186
|
+
## [0.0.2-next.4](https://github.com/iotaledger/twin-blob-storage/compare/blob-storage-rest-client-v0.0.2-next.3...blob-storage-rest-client-v0.0.2-next.4) (2025-10-02)
|
|
39
187
|
|
|
40
188
|
|
|
41
189
|
### Miscellaneous Chores
|
|
@@ -49,12 +197,12 @@
|
|
|
49
197
|
* dependencies
|
|
50
198
|
* @twin.org/blob-storage-models bumped from 0.0.2-next.3 to 0.0.2-next.4
|
|
51
199
|
|
|
52
|
-
## [0.0.2-next.3](https://github.com/
|
|
200
|
+
## [0.0.2-next.3](https://github.com/iotaledger/twin-blob-storage/compare/blob-storage-rest-client-v0.0.2-next.2...blob-storage-rest-client-v0.0.2-next.3) (2025-08-29)
|
|
53
201
|
|
|
54
202
|
|
|
55
203
|
### Features
|
|
56
204
|
|
|
57
|
-
* eslint migration to flat config ([e4239dd](https://github.com/
|
|
205
|
+
* eslint migration to flat config ([e4239dd](https://github.com/iotaledger/twin-blob-storage/commit/e4239dd1c721955cff7f0357255d2bba15319972))
|
|
58
206
|
|
|
59
207
|
|
|
60
208
|
### Dependencies
|
|
@@ -63,12 +211,12 @@
|
|
|
63
211
|
* dependencies
|
|
64
212
|
* @twin.org/blob-storage-models bumped from 0.0.2-next.2 to 0.0.2-next.3
|
|
65
213
|
|
|
66
|
-
## [0.0.2-next.2](https://github.com/
|
|
214
|
+
## [0.0.2-next.2](https://github.com/iotaledger/twin-blob-storage/compare/blob-storage-rest-client-v0.0.2-next.1...blob-storage-rest-client-v0.0.2-next.2) (2025-08-20)
|
|
67
215
|
|
|
68
216
|
|
|
69
217
|
### Features
|
|
70
218
|
|
|
71
|
-
* update framework core ([ff339fe](https://github.com/
|
|
219
|
+
* update framework core ([ff339fe](https://github.com/iotaledger/twin-blob-storage/commit/ff339fe7e3f09ddff429907834bdf43617e9c05e))
|
|
72
220
|
|
|
73
221
|
|
|
74
222
|
### Dependencies
|
|
@@ -77,15 +225,15 @@
|
|
|
77
225
|
* dependencies
|
|
78
226
|
* @twin.org/blob-storage-models bumped from 0.0.2-next.1 to 0.0.2-next.2
|
|
79
227
|
|
|
80
|
-
## [0.0.2-next.1](https://github.com/
|
|
228
|
+
## [0.0.2-next.1](https://github.com/iotaledger/twin-blob-storage/compare/blob-storage-rest-client-v0.0.2-next.0...blob-storage-rest-client-v0.0.2-next.1) (2025-07-24)
|
|
81
229
|
|
|
82
230
|
|
|
83
231
|
### Features
|
|
84
232
|
|
|
85
|
-
* add compression support ([67d239b](https://github.com/
|
|
86
|
-
* additional encryption options on per item basis ([4b95a65](https://github.com/
|
|
87
|
-
* update dependencies ([56f0094](https://github.com/
|
|
88
|
-
* use shared store mechanism ([#12](https://github.com/
|
|
233
|
+
* add compression support ([67d239b](https://github.com/iotaledger/twin-blob-storage/commit/67d239bca8321bd90bf4ff93167c564130309730))
|
|
234
|
+
* additional encryption options on per item basis ([4b95a65](https://github.com/iotaledger/twin-blob-storage/commit/4b95a656d19e3b571cea905e36f29b679b13e1e8))
|
|
235
|
+
* update dependencies ([56f0094](https://github.com/iotaledger/twin-blob-storage/commit/56f0094b68d8bd22864cd899ac1b61d95540f719))
|
|
236
|
+
* use shared store mechanism ([#12](https://github.com/iotaledger/twin-blob-storage/issues/12)) ([cae8110](https://github.com/iotaledger/twin-blob-storage/commit/cae8110681847a1ac4fcac968b8196694e49c320))
|
|
89
237
|
|
|
90
238
|
|
|
91
239
|
### Dependencies
|
|
@@ -99,7 +247,7 @@
|
|
|
99
247
|
|
|
100
248
|
### Features
|
|
101
249
|
|
|
102
|
-
* release to production ([eacfe75](https://github.com/
|
|
250
|
+
* release to production ([eacfe75](https://github.com/iotaledger/twin-blob-storage/commit/eacfe754a0dcd9243d9e13d86422327d0a605164))
|
|
103
251
|
|
|
104
252
|
|
|
105
253
|
### Dependencies
|
|
@@ -108,7 +256,7 @@
|
|
|
108
256
|
* dependencies
|
|
109
257
|
* @twin.org/blob-storage-models bumped from ^0.0.0 to ^0.0.1
|
|
110
258
|
|
|
111
|
-
## [0.0.1-next.37](https://github.com/
|
|
259
|
+
## [0.0.1-next.37](https://github.com/iotaledger/twin-blob-storage/compare/blob-storage-rest-client-v0.0.1-next.36...blob-storage-rest-client-v0.0.1-next.37) (2025-06-20)
|
|
112
260
|
|
|
113
261
|
|
|
114
262
|
### Miscellaneous Chores
|
|
@@ -122,12 +270,12 @@
|
|
|
122
270
|
* dependencies
|
|
123
271
|
* @twin.org/blob-storage-models bumped from 0.0.1-next.36 to 0.0.1-next.37
|
|
124
272
|
|
|
125
|
-
## [0.0.1-next.36](https://github.com/
|
|
273
|
+
## [0.0.1-next.36](https://github.com/iotaledger/twin-blob-storage/compare/blob-storage-rest-client-v0.0.1-next.35...blob-storage-rest-client-v0.0.1-next.36) (2025-06-19)
|
|
126
274
|
|
|
127
275
|
|
|
128
276
|
### Features
|
|
129
277
|
|
|
130
|
-
* add compression support ([67d239b](https://github.com/
|
|
278
|
+
* add compression support ([67d239b](https://github.com/iotaledger/twin-blob-storage/commit/67d239bca8321bd90bf4ff93167c564130309730))
|
|
131
279
|
|
|
132
280
|
|
|
133
281
|
### Dependencies
|
|
@@ -136,12 +284,12 @@
|
|
|
136
284
|
* dependencies
|
|
137
285
|
* @twin.org/blob-storage-models bumped from 0.0.1-next.35 to 0.0.1-next.36
|
|
138
286
|
|
|
139
|
-
## [0.0.1-next.35](https://github.com/
|
|
287
|
+
## [0.0.1-next.35](https://github.com/iotaledger/twin-blob-storage/compare/blob-storage-rest-client-v0.0.1-next.34...blob-storage-rest-client-v0.0.1-next.35) (2025-06-17)
|
|
140
288
|
|
|
141
289
|
|
|
142
290
|
### Features
|
|
143
291
|
|
|
144
|
-
* additional encryption options on per item basis ([4b95a65](https://github.com/
|
|
292
|
+
* additional encryption options on per item basis ([4b95a65](https://github.com/iotaledger/twin-blob-storage/commit/4b95a656d19e3b571cea905e36f29b679b13e1e8))
|
|
145
293
|
|
|
146
294
|
|
|
147
295
|
### Dependencies
|
|
@@ -150,12 +298,12 @@
|
|
|
150
298
|
* dependencies
|
|
151
299
|
* @twin.org/blob-storage-models bumped from 0.0.1-next.34 to 0.0.1-next.35
|
|
152
300
|
|
|
153
|
-
## [0.0.1-next.34](https://github.com/
|
|
301
|
+
## [0.0.1-next.34](https://github.com/iotaledger/twin-blob-storage/compare/blob-storage-rest-client-v0.0.1-next.33...blob-storage-rest-client-v0.0.1-next.34) (2025-06-12)
|
|
154
302
|
|
|
155
303
|
|
|
156
304
|
### Features
|
|
157
305
|
|
|
158
|
-
* update dependencies ([56f0094](https://github.com/
|
|
306
|
+
* update dependencies ([56f0094](https://github.com/iotaledger/twin-blob-storage/commit/56f0094b68d8bd22864cd899ac1b61d95540f719))
|
|
159
307
|
|
|
160
308
|
|
|
161
309
|
### Dependencies
|
|
@@ -164,7 +312,7 @@
|
|
|
164
312
|
* dependencies
|
|
165
313
|
* @twin.org/blob-storage-models bumped from 0.0.1-next.33 to 0.0.1-next.34
|
|
166
314
|
|
|
167
|
-
## [0.0.1-next.33](https://github.com/
|
|
315
|
+
## [0.0.1-next.33](https://github.com/iotaledger/twin-blob-storage/compare/blob-storage-rest-client-v0.0.1-next.32...blob-storage-rest-client-v0.0.1-next.33) (2025-06-03)
|
|
168
316
|
|
|
169
317
|
|
|
170
318
|
### Miscellaneous Chores
|
|
@@ -178,7 +326,7 @@
|
|
|
178
326
|
* dependencies
|
|
179
327
|
* @twin.org/blob-storage-models bumped from 0.0.1-next.32 to 0.0.1-next.33
|
|
180
328
|
|
|
181
|
-
## [0.0.1-next.32](https://github.com/
|
|
329
|
+
## [0.0.1-next.32](https://github.com/iotaledger/twin-blob-storage/compare/blob-storage-rest-client-v0.0.1-next.31...blob-storage-rest-client-v0.0.1-next.32) (2025-05-28)
|
|
182
330
|
|
|
183
331
|
|
|
184
332
|
### Miscellaneous Chores
|
|
@@ -192,7 +340,7 @@
|
|
|
192
340
|
* dependencies
|
|
193
341
|
* @twin.org/blob-storage-models bumped from 0.0.1-next.31 to 0.0.1-next.32
|
|
194
342
|
|
|
195
|
-
## [0.0.1-next.31](https://github.com/
|
|
343
|
+
## [0.0.1-next.31](https://github.com/iotaledger/twin-blob-storage/compare/blob-storage-rest-client-v0.0.1-next.30...blob-storage-rest-client-v0.0.1-next.31) (2025-05-08)
|
|
196
344
|
|
|
197
345
|
|
|
198
346
|
### Miscellaneous Chores
|
|
@@ -206,12 +354,12 @@
|
|
|
206
354
|
* dependencies
|
|
207
355
|
* @twin.org/blob-storage-models bumped from 0.0.1-next.30 to 0.0.1-next.31
|
|
208
356
|
|
|
209
|
-
## [0.0.1-next.30](https://github.com/
|
|
357
|
+
## [0.0.1-next.30](https://github.com/iotaledger/twin-blob-storage/compare/blob-storage-rest-client-v0.0.1-next.29...blob-storage-rest-client-v0.0.1-next.30) (2025-04-17)
|
|
210
358
|
|
|
211
359
|
|
|
212
360
|
### Features
|
|
213
361
|
|
|
214
|
-
* use shared store mechanism ([#12](https://github.com/
|
|
362
|
+
* use shared store mechanism ([#12](https://github.com/iotaledger/twin-blob-storage/issues/12)) ([cae8110](https://github.com/iotaledger/twin-blob-storage/commit/cae8110681847a1ac4fcac968b8196694e49c320))
|
|
215
363
|
|
|
216
364
|
|
|
217
365
|
### Dependencies
|
|
@@ -220,7 +368,7 @@
|
|
|
220
368
|
* dependencies
|
|
221
369
|
* @twin.org/blob-storage-models bumped from 0.0.1-next.29 to 0.0.1-next.30
|
|
222
370
|
|
|
223
|
-
## [0.0.1-next.29](https://github.com/
|
|
371
|
+
## [0.0.1-next.29](https://github.com/iotaledger/twin-blob-storage/compare/blob-storage-rest-client-v0.0.1-next.28...blob-storage-rest-client-v0.0.1-next.29) (2025-03-28)
|
|
224
372
|
|
|
225
373
|
|
|
226
374
|
### Miscellaneous Chores
|
package/docs/examples.md
CHANGED
|
@@ -1 +1,98 @@
|
|
|
1
|
-
#
|
|
1
|
+
# REST Client Examples
|
|
2
|
+
|
|
3
|
+
Use these snippets to create, query, and manage blobs through HTTP endpoints with strongly typed requests and responses.
|
|
4
|
+
|
|
5
|
+
## BlobStorageRestClient
|
|
6
|
+
|
|
7
|
+
```typescript
|
|
8
|
+
import { BlobStorageRestClient } from '@twin.org/blob-storage-rest-client';
|
|
9
|
+
|
|
10
|
+
const client = new BlobStorageRestClient({
|
|
11
|
+
endpoint: 'https://api.example.com',
|
|
12
|
+
pathPrefix: '/v1'
|
|
13
|
+
});
|
|
14
|
+
|
|
15
|
+
console.log(client.className()); // BlobStorageRestClient
|
|
16
|
+
```
|
|
17
|
+
|
|
18
|
+
```typescript
|
|
19
|
+
import { BlobStorageRestClient } from '@twin.org/blob-storage-rest-client';
|
|
20
|
+
|
|
21
|
+
const client = new BlobStorageRestClient({
|
|
22
|
+
endpoint: 'https://api.example.com',
|
|
23
|
+
pathPrefix: '/v1'
|
|
24
|
+
});
|
|
25
|
+
|
|
26
|
+
const blobId = await client.create(
|
|
27
|
+
'SGVsbG8gVFdJTiE=',
|
|
28
|
+
'text/plain',
|
|
29
|
+
'txt',
|
|
30
|
+
{
|
|
31
|
+
'@context': 'https://schema.org',
|
|
32
|
+
type: 'DigitalDocument',
|
|
33
|
+
name: 'greeting'
|
|
34
|
+
},
|
|
35
|
+
{
|
|
36
|
+
disableEncryption: false,
|
|
37
|
+
namespace: 'tenant-a'
|
|
38
|
+
}
|
|
39
|
+
);
|
|
40
|
+
console.log(blobId); // blob:urn:blob:...
|
|
41
|
+
|
|
42
|
+
const blobEntry = await client.get(blobId, { includeContent: true, decompress: true });
|
|
43
|
+
console.log(blobEntry.encodingFormat); // text/plain
|
|
44
|
+
|
|
45
|
+
await client.update(blobId, 'text/plain', 'txt', {
|
|
46
|
+
'@context': 'https://schema.org',
|
|
47
|
+
type: 'DigitalDocument',
|
|
48
|
+
name: 'greeting-v2'
|
|
49
|
+
});
|
|
50
|
+
console.log(blobId); // blob:urn:blob:...
|
|
51
|
+
```
|
|
52
|
+
|
|
53
|
+
```typescript
|
|
54
|
+
import {
|
|
55
|
+
type EntityCondition,
|
|
56
|
+
ComparisonOperator,
|
|
57
|
+
LogicalOperator,
|
|
58
|
+
SortDirection
|
|
59
|
+
} from '@twin.org/entity';
|
|
60
|
+
import type { IBlobStorageEntry } from '@twin.org/blob-storage-models';
|
|
61
|
+
import { BlobStorageRestClient } from '@twin.org/blob-storage-rest-client';
|
|
62
|
+
|
|
63
|
+
const client = new BlobStorageRestClient({
|
|
64
|
+
endpoint: 'https://api.example.com',
|
|
65
|
+
pathPrefix: '/v1'
|
|
66
|
+
});
|
|
67
|
+
|
|
68
|
+
const conditions: EntityCondition<IBlobStorageEntry> = {
|
|
69
|
+
logicalOperator: LogicalOperator.And,
|
|
70
|
+
conditions: [
|
|
71
|
+
{
|
|
72
|
+
property: 'encodingFormat',
|
|
73
|
+
comparison: ComparisonOperator.Equals,
|
|
74
|
+
value: 'text/plain'
|
|
75
|
+
}
|
|
76
|
+
]
|
|
77
|
+
};
|
|
78
|
+
|
|
79
|
+
const queryResult = await client.query(conditions, 'dateCreated', SortDirection.Descending, '', 25);
|
|
80
|
+
console.log(queryResult.entries.itemListElement.length); // 1
|
|
81
|
+
console.log(queryResult.cursor); // eyJwYWdlIjoyfQ==
|
|
82
|
+
```
|
|
83
|
+
|
|
84
|
+
```typescript
|
|
85
|
+
import { BlobStorageRestClient } from '@twin.org/blob-storage-rest-client';
|
|
86
|
+
|
|
87
|
+
const client = new BlobStorageRestClient({
|
|
88
|
+
endpoint: 'https://api.example.com',
|
|
89
|
+
pathPrefix: '/v1'
|
|
90
|
+
});
|
|
91
|
+
|
|
92
|
+
const blobId = 'blob:urn:blob:file:4ef42bb1b8d31f0c';
|
|
93
|
+
const downloadLink = client.createDownloadLink(blobId, true, 'report.txt');
|
|
94
|
+
console.log(downloadLink); // https://api.example.com/v1/blob/blob:urn:blob:file:4ef42bb1b8d31f0c/content?download=true&filename=report.txt
|
|
95
|
+
|
|
96
|
+
await client.remove(blobId);
|
|
97
|
+
console.log(blobId); // blob:urn:blob:file:4ef42bb1b8d31f0c
|
|
98
|
+
```
|
|
@@ -36,7 +36,7 @@ The configuration for the client.
|
|
|
36
36
|
|
|
37
37
|
## Properties
|
|
38
38
|
|
|
39
|
-
### CLASS\_NAME
|
|
39
|
+
### CLASS\_NAME {#class_name}
|
|
40
40
|
|
|
41
41
|
> `readonly` `static` **CLASS\_NAME**: `string`
|
|
42
42
|
|
|
@@ -44,7 +44,7 @@ Runtime name for the class.
|
|
|
44
44
|
|
|
45
45
|
## Methods
|
|
46
46
|
|
|
47
|
-
### className()
|
|
47
|
+
### className() {#classname}
|
|
48
48
|
|
|
49
49
|
> **className**(): `string`
|
|
50
50
|
|
|
@@ -62,7 +62,7 @@ The class name of the component.
|
|
|
62
62
|
|
|
63
63
|
***
|
|
64
64
|
|
|
65
|
-
### create()
|
|
65
|
+
### create() {#create}
|
|
66
66
|
|
|
67
67
|
> **create**(`blob`, `encodingFormat?`, `fileExtension?`, `metadata?`, `options?`): `Promise`\<`string`\>
|
|
68
68
|
|
|
@@ -128,7 +128,7 @@ The id of the stored blob in urn format.
|
|
|
128
128
|
|
|
129
129
|
***
|
|
130
130
|
|
|
131
|
-
### get()
|
|
131
|
+
### get() {#get}
|
|
132
132
|
|
|
133
133
|
> **get**(`id`, `options?`): `Promise`\<`IBlobStorageEntry`\>
|
|
134
134
|
|
|
@@ -180,7 +180,7 @@ Not found error if the blob cannot be found.
|
|
|
180
180
|
|
|
181
181
|
***
|
|
182
182
|
|
|
183
|
-
### update()
|
|
183
|
+
### update() {#update}
|
|
184
184
|
|
|
185
185
|
> **update**(`id`, `encodingFormat?`, `fileExtension?`, `metadata?`): `Promise`\<`void`\>
|
|
186
186
|
|
|
@@ -228,7 +228,25 @@ Not found error if the blob cannot be found.
|
|
|
228
228
|
|
|
229
229
|
***
|
|
230
230
|
|
|
231
|
-
###
|
|
231
|
+
### empty() {#empty}
|
|
232
|
+
|
|
233
|
+
> **empty**(): `Promise`\<`void`\>
|
|
234
|
+
|
|
235
|
+
Remove all blobs from the storage.
|
|
236
|
+
|
|
237
|
+
#### Returns
|
|
238
|
+
|
|
239
|
+
`Promise`\<`void`\>
|
|
240
|
+
|
|
241
|
+
Nothing.
|
|
242
|
+
|
|
243
|
+
#### Implementation of
|
|
244
|
+
|
|
245
|
+
`IBlobStorageComponent.empty`
|
|
246
|
+
|
|
247
|
+
***
|
|
248
|
+
|
|
249
|
+
### remove() {#remove}
|
|
232
250
|
|
|
233
251
|
> **remove**(`id`): `Promise`\<`void`\>
|
|
234
252
|
|
|
@@ -254,9 +272,9 @@ Nothing.
|
|
|
254
272
|
|
|
255
273
|
***
|
|
256
274
|
|
|
257
|
-
### query()
|
|
275
|
+
### query() {#query}
|
|
258
276
|
|
|
259
|
-
> **query**(`conditions?`, `orderBy?`, `orderByDirection?`, `cursor?`, `limit?`): `Promise
|
|
277
|
+
> **query**(`conditions?`, `orderBy?`, `orderByDirection?`, `cursor?`, `limit?`): `Promise`\<\{ `entries`: `IBlobStorageEntryList`; `cursor?`: `string`; \}\>
|
|
260
278
|
|
|
261
279
|
Query all the blob storage entries which match the conditions.
|
|
262
280
|
|
|
@@ -270,9 +288,9 @@ The conditions to match for the entries.
|
|
|
270
288
|
|
|
271
289
|
##### orderBy?
|
|
272
290
|
|
|
273
|
-
|
|
291
|
+
`"dateCreated"` \| `"dateModified"`
|
|
274
292
|
|
|
275
|
-
|
|
293
|
+
The order for the results, defaults to created.
|
|
276
294
|
|
|
277
295
|
##### orderByDirection?
|
|
278
296
|
|
|
@@ -294,7 +312,7 @@ The suggested number of entries to return in each chunk, in some scenarios can r
|
|
|
294
312
|
|
|
295
313
|
#### Returns
|
|
296
314
|
|
|
297
|
-
`Promise
|
|
315
|
+
`Promise`\<\{ `entries`: `IBlobStorageEntryList`; `cursor?`: `string`; \}\>
|
|
298
316
|
|
|
299
317
|
All the entries for the storage matching the conditions,
|
|
300
318
|
and a cursor which can be used to request more entities.
|
|
@@ -305,7 +323,7 @@ and a cursor which can be used to request more entities.
|
|
|
305
323
|
|
|
306
324
|
***
|
|
307
325
|
|
|
308
|
-
### createDownloadLink()
|
|
326
|
+
### createDownloadLink() {#createdownloadlink}
|
|
309
327
|
|
|
310
328
|
> **createDownloadLink**(`id`, `download?`, `filename?`): `string`
|
|
311
329
|
|
package/package.json
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@twin.org/blob-storage-rest-client",
|
|
3
|
-
"version": "0.0.3-next.
|
|
4
|
-
"description": "
|
|
3
|
+
"version": "0.0.3-next.11",
|
|
4
|
+
"description": "Offers client utilities for calling blob service endpoints with consistent request handling.",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
7
|
-
"url": "git+https://github.com/
|
|
7
|
+
"url": "git+https://github.com/iotaledger/blob-storage.git",
|
|
8
8
|
"directory": "packages/blob-storage-rest-client"
|
|
9
9
|
},
|
|
10
10
|
"author": "martyn.janes@iota.org",
|
|
@@ -16,7 +16,7 @@
|
|
|
16
16
|
"dependencies": {
|
|
17
17
|
"@twin.org/api-core": "next",
|
|
18
18
|
"@twin.org/api-models": "next",
|
|
19
|
-
"@twin.org/blob-storage-models": "0.0.3-next.
|
|
19
|
+
"@twin.org/blob-storage-models": "0.0.3-next.11",
|
|
20
20
|
"@twin.org/core": "next",
|
|
21
21
|
"@twin.org/data-json-ld": "next",
|
|
22
22
|
"@twin.org/entity": "next",
|
|
@@ -52,7 +52,7 @@
|
|
|
52
52
|
"binary"
|
|
53
53
|
],
|
|
54
54
|
"bugs": {
|
|
55
|
-
"url": "git+https://github.com/
|
|
55
|
+
"url": "git+https://github.com/iotaledger/blob-storage/issues"
|
|
56
56
|
},
|
|
57
57
|
"homepage": "https://twindev.org"
|
|
58
58
|
}
|