@twin.org/blob-storage-service 0.0.3-next.6 → 0.0.3-next.8
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 +1 -1
- package/dist/es/blobStorageRoutes.js +4 -4
- package/dist/es/blobStorageRoutes.js.map +1 -1
- package/docs/changelog.md +97 -65
- package/docs/examples.md +109 -1
- package/docs/open-api/spec.json +33 -74
- package/docs/reference/classes/BlobStorageEntry.md +15 -15
- package/docs/reference/classes/BlobStorageService.md +9 -9
- package/docs/reference/interfaces/IBlobStorageServiceConfig.md +4 -4
- package/docs/reference/interfaces/IBlobStorageServiceConstructorOptions.md +6 -6
- package/package.json +5 -5
package/README.md
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# TWIN Blob Storage Service
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
This package exposes service-side components and endpoint definitions for blob upload, retrieval, and management operations. It bridges shared blob models with application service layers so APIs can be published with consistent behaviour.
|
|
4
4
|
|
|
5
5
|
## Installation
|
|
6
6
|
|
|
@@ -114,7 +114,7 @@ export function generateRestRoutesBlobStorage(baseRouteName, componentName, opti
|
|
|
114
114
|
dateCreated: "2024-01-01T00:00:00Z",
|
|
115
115
|
encodingFormat: MimeTypes.Pdf,
|
|
116
116
|
blobSize: 42,
|
|
117
|
-
integrity: "sha256-
|
|
117
|
+
integrity: "sha256-xX2UsIj0xtLLMt7QFIExDHhqoAE0yO4i+EseJUVgKnA=",
|
|
118
118
|
fileExtension: "pdf",
|
|
119
119
|
metadata: {
|
|
120
120
|
"@context": "https://schema.org",
|
|
@@ -145,7 +145,7 @@ export function generateRestRoutesBlobStorage(baseRouteName, componentName, opti
|
|
|
145
145
|
dateCreated: "2024-01-01T00:00:00Z",
|
|
146
146
|
encodingFormat: MimeTypes.Pdf,
|
|
147
147
|
blobSize: 42,
|
|
148
|
-
integrity: "sha256-
|
|
148
|
+
integrity: "sha256-xX2UsIj0xtLLMt7QFIExDHhqoAE0yO4i+EseJUVgKnA=",
|
|
149
149
|
fileExtension: "pdf",
|
|
150
150
|
metadata: {
|
|
151
151
|
"@context": "https://schema.org",
|
|
@@ -310,7 +310,7 @@ export function generateRestRoutesBlobStorage(baseRouteName, componentName, opti
|
|
|
310
310
|
dateCreated: "2024-01-01T00:00:00Z",
|
|
311
311
|
encodingFormat: MimeTypes.Pdf,
|
|
312
312
|
blobSize: 42,
|
|
313
|
-
integrity: "sha256-
|
|
313
|
+
integrity: "sha256-xX2UsIj0xtLLMt7QFIExDHhqoAE0yO4i+EseJUVgKnA=",
|
|
314
314
|
fileExtension: "pdf",
|
|
315
315
|
metadata: {
|
|
316
316
|
"@context": "https://schema.org",
|
|
@@ -351,7 +351,7 @@ export function generateRestRoutesBlobStorage(baseRouteName, componentName, opti
|
|
|
351
351
|
dateCreated: "2024-01-01T00:00:00Z",
|
|
352
352
|
encodingFormat: MimeTypes.Pdf,
|
|
353
353
|
blobSize: 42,
|
|
354
|
-
integrity: "sha256-
|
|
354
|
+
integrity: "sha256-xX2UsIj0xtLLMt7QFIExDHhqoAE0yO4i+EseJUVgKnA=",
|
|
355
355
|
fileExtension: "pdf",
|
|
356
356
|
metadata: {
|
|
357
357
|
"@context": "https://schema.org",
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"blobStorageRoutes.js","sourceRoot":"","sources":["../../src/blobStorageRoutes.ts"],"names":[],"mappings":"AAAA,gCAAgC;AAChC,uCAAuC;AACvC,OAAO,EACN,mBAAmB,EASnB,MAAM,sBAAsB,CAAC;AAC9B,OAAO,EACN,0BAA0B,EAC1B,mBAAmB,EACnB,gBAAgB,EAWhB,MAAM,+BAA+B,CAAC;AACvC,OAAO,EAAE,MAAM,EAAE,gBAAgB,EAAE,SAAS,EAAE,MAAM,EAAE,EAAE,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAC;AAE/F,OAAO,EAAE,iBAAiB,EAAE,cAAc,EAAE,MAAM,gCAAgC,CAAC;AACnF,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,OAAO,EACtB,OAAO,CAAC,KAAK,EAAE,gBAAgB,EAC/B,OAAO,CAAC,KAAK,EAAE,MAAM,EACrB,MAAM,CAAC,MAAM,CAAC,OAAO,CAAC,KAAK,EAAE,KAAK,CAAC,CACnC,CAAC;IAEF,MAAM,OAAO,GAAwC;QACpD,CAAC,WAAW,CAAC,WAAW,CAAC,EACxB,OAAO,CAAC,OAAO,EAAE,CAAC,WAAW,CAAC,MAAM,CAAC,KAAK,SAAS,CAAC,MAAM,CAAC,CAAC,CAAC,SAAS,CAAC,MAAM,CAAC,CAAC,CAAC,SAAS,CAAC,IAAI;KAC/F,CAAC;IAEF,IAAI,EAAE,CAAC,WAAW,CAAC,MAAM,CAAC,MAAM,CAAC,EAAE,CAAC;QACnC,OAAO,CAAC,WAAW,CAAC,IAAI,CAAC,GAAG,YAAY,CAAC,gBAAgB,CACxD,MAAM,gBAAgB,CAAC,cAAc,CAAC,kBAAkB,CAAC,aAAa,CAAC,GAAG,CAAC,EAC3E,EAAE,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,EACzB,MAAM,CACN,CAAC;IACH,CAAC;IAED,OAAO;QACN,OAAO;QACP,IAAI,EAAE,MAAM,CAAC,OAAO;KACpB,CAAC;AACH,CAAC","sourcesContent":["// Copyright 2024 IOTA Stiftung.\n// SPDX-License-Identifier: Apache-2.0.\nimport {\n\tHttpParameterHelper,\n\ttype IHostingComponent,\n\ttype ICreatedResponse,\n\ttype IHttpRequestContext,\n\ttype INoContentResponse,\n\ttype INotFoundResponse,\n\ttype IRestRoute,\n\ttype IRestRouteResponseOptions,\n\ttype ITag\n} from \"@twin.org/api-models\";\nimport {\n\tBlobStorageCompressionType,\n\tBlobStorageContexts,\n\tBlobStorageTypes,\n\ttype IBlobStorageComponent,\n\ttype IBlobStorageCreateRequest,\n\ttype IBlobStorageGetContentRequest,\n\ttype IBlobStorageGetContentResponse,\n\ttype IBlobStorageGetRequest,\n\ttype IBlobStorageGetResponse,\n\ttype IBlobStorageListRequest,\n\ttype IBlobStorageListResponse,\n\ttype IBlobStorageRemoveRequest,\n\ttype IBlobStorageUpdateRequest\n} from \"@twin.org/blob-storage-models\";\nimport { Coerce, ComponentFactory, Converter, Guards, Is, StringHelper } from \"@twin.org/core\";\nimport { nameof } from \"@twin.org/nameof\";\nimport { SchemaOrgContexts, SchemaOrgTypes } from \"@twin.org/standards-schema-org\";\nimport {\n\tHeaderHelper,\n\tHeaderTypes,\n\tHttpStatusCode,\n\tMimeTypeHelper,\n\tMimeTypes\n} from \"@twin.org/web\";\n\n/**\n * The source used when communicating about these routes.\n */\nconst ROUTES_SOURCE = \"blobStorageRoutes\";\n\n/**\n * The tag to associate with the routes.\n */\nexport const tagsBlobStorage: ITag[] = [\n\t{\n\t\tname: \"Blob Storage\",\n\t\tdescription: \"Endpoints which are modelled to access a blob storage contract.\"\n\t}\n];\n\n/**\n * The REST routes for blob storage.\n * @param baseRouteName Prefix to prepend to the paths.\n * @param componentName The name of the component to use in the routes stored in the ComponentFactory.\n * @param options Additional options for the routes.\n * @param options.typeName Optional type name to use in the routes, defaults to Blob Storage.\n * @param options.tagName Optional name to use in OpenAPI spec for tag.\n * @returns The generated routes.\n */\nexport function generateRestRoutesBlobStorage(\n\tbaseRouteName: string,\n\tcomponentName: string,\n\toptions?: {\n\t\ttypeName?: string;\n\t\ttagName?: string;\n\t}\n): IRestRoute[] {\n\tconst typeName = options?.typeName ?? \"Blob Storage\";\n\tconst lowerName = typeName.toLowerCase();\n\tconst camelTypeName = StringHelper.camelCase(typeName);\n\n\tconst blobStorageCreateRoute: IRestRoute<IBlobStorageCreateRequest, ICreatedResponse> = {\n\t\toperationId: `${camelTypeName}Create`,\n\t\tsummary: `Create an entry in ${lowerName}`,\n\t\ttag: options?.tagName ?? tagsBlobStorage[0].name,\n\t\tmethod: \"POST\",\n\t\tpath: `${baseRouteName}/`,\n\t\thandler: async (httpRequestContext, request) =>\n\t\t\tblobStorageCreate(httpRequestContext, componentName, request),\n\t\trequestType: {\n\t\t\ttype: nameof<IBlobStorageCreateRequest>(),\n\t\t\texamples: [\n\t\t\t\t{\n\t\t\t\t\tid: `${camelTypeName}CreateRequestExample`,\n\t\t\t\t\trequest: {\n\t\t\t\t\t\tbody: {\n\t\t\t\t\t\t\tblob: \"VGhlIHF1aWNrIGJyb3duIGZveCBqdW1wcyBvdmVyIHRoZSBsYXp5IGRvZw==\",\n\t\t\t\t\t\t\tmetadata: {\n\t\t\t\t\t\t\t\t\"@context\": \"https://schema.org\",\n\t\t\t\t\t\t\t\t\"@type\": \"DigitalDocument\",\n\t\t\t\t\t\t\t\tname: \"myfile.pdf\"\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t]\n\t\t},\n\t\tresponseType: [\n\t\t\t{\n\t\t\t\ttype: nameof<ICreatedResponse>(),\n\t\t\t\texamples: [\n\t\t\t\t\t{\n\t\t\t\t\t\tid: `${camelTypeName}CreateResponseExample`,\n\t\t\t\t\t\tresponse: {\n\t\t\t\t\t\t\tstatusCode: HttpStatusCode.created,\n\t\t\t\t\t\t\theaders: {\n\t\t\t\t\t\t\t\t[HeaderTypes.Location]:\n\t\t\t\t\t\t\t\t\t\"blob-memory:c57d94b088f4c6d2cb32ded014813d0c786aa00134c8ee22f84b1e2545602a70\"\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t]\n\t\t\t}\n\t\t]\n\t};\n\n\tconst blobStorageGetRoute: IRestRoute<IBlobStorageGetRequest, IBlobStorageGetResponse> = {\n\t\toperationId: `${camelTypeName}Get`,\n\t\tsummary: `Get the metadata for an item from ${lowerName}`,\n\t\ttag: options?.tagName ?? tagsBlobStorage[0].name,\n\t\tmethod: \"GET\",\n\t\tpath: `${baseRouteName}/:id`,\n\t\thandler: async (httpRequestContext, request) =>\n\t\t\tblobStorageGet(httpRequestContext, componentName, request),\n\t\trequestType: {\n\t\t\ttype: nameof<IBlobStorageGetRequest>(),\n\t\t\texamples: [\n\t\t\t\t{\n\t\t\t\t\tid: `${camelTypeName}GetRequestExample`,\n\t\t\t\t\trequest: {\n\t\t\t\t\t\tpathParams: {\n\t\t\t\t\t\t\tid: \"blob-memory:c57d94b088f4c6d2cb32ded014813d0c786aa00134c8ee22f84b1e2545602a70\"\n\t\t\t\t\t\t},\n\t\t\t\t\t\tquery: {\n\t\t\t\t\t\t\tincludeContent: \"true\"\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t]\n\t\t},\n\t\tresponseType: [\n\t\t\t{\n\t\t\t\ttype: nameof<IBlobStorageGetResponse>(),\n\t\t\t\texamples: [\n\t\t\t\t\t{\n\t\t\t\t\t\tid: `${camelTypeName}GetResponseExample`,\n\t\t\t\t\t\tresponse: {\n\t\t\t\t\t\t\tbody: {\n\t\t\t\t\t\t\t\t\"@context\": [\n\t\t\t\t\t\t\t\t\tBlobStorageContexts.Context,\n\t\t\t\t\t\t\t\t\tBlobStorageContexts.ContextCommon,\n\t\t\t\t\t\t\t\t\tSchemaOrgContexts.Context\n\t\t\t\t\t\t\t\t],\n\t\t\t\t\t\t\t\ttype: BlobStorageTypes.Entry,\n\t\t\t\t\t\t\t\tid: \"blob-memory:c57d94b088f4c6d2cb32ded014813d0c786aa00134c8ee22f84b1e2545602a70\",\n\t\t\t\t\t\t\t\tdateCreated: \"2024-01-01T00:00:00Z\",\n\t\t\t\t\t\t\t\tencodingFormat: MimeTypes.Pdf,\n\t\t\t\t\t\t\t\tblobSize: 42,\n\t\t\t\t\t\t\t\tintegrity:\n\t\t\t\t\t\t\t\t\t\"sha256-c57d94b088f4c6d2cb32ded014813d0c786aa00134c8ee22f84b1e2545602a70\",\n\t\t\t\t\t\t\t\tfileExtension: \"pdf\",\n\t\t\t\t\t\t\t\tmetadata: {\n\t\t\t\t\t\t\t\t\t\"@context\": \"https://schema.org\",\n\t\t\t\t\t\t\t\t\t\"@type\": \"DigitalDocument\",\n\t\t\t\t\t\t\t\t\tname: \"myfile.pdf\"\n\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\tblob: \"VGhlIHF1aWNrIGJyb3duIGZveCBqdW1wcyBvdmVyIHRoZSBsYXp5IGRvZw==\"\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t]\n\t\t\t},\n\t\t\t{\n\t\t\t\ttype: nameof<IBlobStorageGetResponse>(),\n\t\t\t\tmimeType: MimeTypes.JsonLd,\n\t\t\t\texamples: [\n\t\t\t\t\t{\n\t\t\t\t\t\tid: `${camelTypeName}GetResponseJsonLdExample`,\n\t\t\t\t\t\tresponse: {\n\t\t\t\t\t\t\tbody: {\n\t\t\t\t\t\t\t\t\"@context\": [\n\t\t\t\t\t\t\t\t\tBlobStorageContexts.Context,\n\t\t\t\t\t\t\t\t\tBlobStorageContexts.ContextCommon,\n\t\t\t\t\t\t\t\t\tSchemaOrgContexts.Context\n\t\t\t\t\t\t\t\t],\n\t\t\t\t\t\t\t\ttype: BlobStorageTypes.Entry,\n\t\t\t\t\t\t\t\tid: \"blob-memory:c57d94b088f4c6d2cb32ded014813d0c786aa00134c8ee22f84b1e2545602a70\",\n\t\t\t\t\t\t\t\tdateCreated: \"2024-01-01T00:00:00Z\",\n\t\t\t\t\t\t\t\tencodingFormat: MimeTypes.Pdf,\n\t\t\t\t\t\t\t\tblobSize: 42,\n\t\t\t\t\t\t\t\tintegrity:\n\t\t\t\t\t\t\t\t\t\"sha256-c57d94b088f4c6d2cb32ded014813d0c786aa00134c8ee22f84b1e2545602a70\",\n\t\t\t\t\t\t\t\tfileExtension: \"pdf\",\n\t\t\t\t\t\t\t\tmetadata: {\n\t\t\t\t\t\t\t\t\t\"@context\": \"https://schema.org\",\n\t\t\t\t\t\t\t\t\t\"@type\": \"DigitalDocument\",\n\t\t\t\t\t\t\t\t\tname: \"myfile.pdf\"\n\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\tblob: \"VGhlIHF1aWNrIGJyb3duIGZveCBqdW1wcyBvdmVyIHRoZSBsYXp5IGRvZw==\"\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t]\n\t\t\t},\n\t\t\t{\n\t\t\t\ttype: nameof<INotFoundResponse>()\n\t\t\t}\n\t\t]\n\t};\n\n\tconst blobStorageGetContentRoute: IRestRoute<\n\t\tIBlobStorageGetContentRequest,\n\t\tIBlobStorageGetContentResponse & IRestRouteResponseOptions\n\t> = {\n\t\toperationId: `${camelTypeName}GetContent`,\n\t\tsummary: `Get the content for an item in ${lowerName}`,\n\t\ttag: options?.tagName ?? tagsBlobStorage[0].name,\n\t\tmethod: \"GET\",\n\t\tpath: `${baseRouteName}/:id/content`,\n\t\thandler: async (httpRequestContext, request) =>\n\t\t\tblobStorageGetContent(httpRequestContext, componentName, request),\n\t\trequestType: {\n\t\t\ttype: nameof<IBlobStorageGetRequest>(),\n\t\t\texamples: [\n\t\t\t\t{\n\t\t\t\t\tid: `${camelTypeName}GetContentRequestExample`,\n\t\t\t\t\trequest: {\n\t\t\t\t\t\tpathParams: {\n\t\t\t\t\t\t\tid: \"blob-memory:c57d94b088f4c6d2cb32ded014813d0c786aa00134c8ee22f84b1e2545602a70\"\n\t\t\t\t\t\t},\n\t\t\t\t\t\tquery: {\n\t\t\t\t\t\t\tdownload: \"true\",\n\t\t\t\t\t\t\tfilename: \"my-file.pdf\"\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t]\n\t\t},\n\t\tresponseType: [\n\t\t\t{\n\t\t\t\ttype: nameof<Uint8Array>(),\n\t\t\t\tmimeType: MimeTypes.OctetStream,\n\t\t\t\texamples: [\n\t\t\t\t\t{\n\t\t\t\t\t\tid: `${camelTypeName}GetContentResponseExample`,\n\t\t\t\t\t\tdescription: `The content of the blob, which will be a specific mime type if one can be detected from the content (or set as encodingFormat in the entry), or defaults to ${MimeTypes.OctetStream}.`,\n\t\t\t\t\t\tresponse: {\n\t\t\t\t\t\t\tbody: new Uint8Array()\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t]\n\t\t\t},\n\t\t\t{\n\t\t\t\ttype: nameof<INotFoundResponse>()\n\t\t\t}\n\t\t]\n\t};\n\n\tconst blobStorageUpdateRoute: IRestRoute<IBlobStorageUpdateRequest, INoContentResponse> = {\n\t\toperationId: `${camelTypeName}Update`,\n\t\tsummary: `Update the metadata for an item in ${lowerName}`,\n\t\ttag: options?.tagName ?? tagsBlobStorage[0].name,\n\t\tmethod: \"PUT\",\n\t\tpath: `${baseRouteName}/:id`,\n\t\thandler: async (httpRequestContext, request) =>\n\t\t\tblobStorageUpdate(httpRequestContext, componentName, request),\n\t\trequestType: {\n\t\t\ttype: nameof<IBlobStorageUpdateRequest>(),\n\t\t\texamples: [\n\t\t\t\t{\n\t\t\t\t\tid: `${camelTypeName}UpdateRequestExample`,\n\t\t\t\t\trequest: {\n\t\t\t\t\t\tpathParams: {\n\t\t\t\t\t\t\tid: \"blob-memory:c57d94b088f4c6d2cb32ded014813d0c786aa00134c8ee22f84b1e2545602a70\"\n\t\t\t\t\t\t},\n\t\t\t\t\t\tbody: {\n\t\t\t\t\t\t\tmetadata: {\n\t\t\t\t\t\t\t\t\"@context\": \"https://schema.org\",\n\t\t\t\t\t\t\t\t\"@type\": \"DigitalDocument\",\n\t\t\t\t\t\t\t\tname: \"myfile.pdf\"\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t]\n\t\t},\n\t\tresponseType: [\n\t\t\t{\n\t\t\t\ttype: nameof<INoContentResponse>()\n\t\t\t}\n\t\t]\n\t};\n\n\tconst blobStorageRemoveRoute: IRestRoute<IBlobStorageRemoveRequest, INoContentResponse> = {\n\t\toperationId: `${camelTypeName}Remove`,\n\t\tsummary: `Remove an item from ${lowerName}`,\n\t\ttag: options?.tagName ?? tagsBlobStorage[0].name,\n\t\tmethod: \"DELETE\",\n\t\tpath: `${baseRouteName}/:id`,\n\t\thandler: async (httpRequestContext, request) =>\n\t\t\tblobStorageRemove(httpRequestContext, componentName, request),\n\t\trequestType: {\n\t\t\ttype: nameof<IBlobStorageRemoveRequest>(),\n\t\t\texamples: [\n\t\t\t\t{\n\t\t\t\t\tid: `${camelTypeName}RemoveRequestExample`,\n\t\t\t\t\trequest: {\n\t\t\t\t\t\tpathParams: {\n\t\t\t\t\t\t\tid: \"blob-memory:c57d94b088f4c6d2cb32ded014813d0c786aa00134c8ee22f84b1e2545602a70\"\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t]\n\t\t},\n\t\tresponseType: [\n\t\t\t{\n\t\t\t\ttype: nameof<INoContentResponse>()\n\t\t\t},\n\t\t\t{\n\t\t\t\ttype: nameof<INotFoundResponse>()\n\t\t\t}\n\t\t]\n\t};\n\n\tconst blobStorageListRoute: IRestRoute<IBlobStorageListRequest, IBlobStorageListResponse> = {\n\t\toperationId: `${camelTypeName}Query`,\n\t\tsummary: `Query the items from ${lowerName}`,\n\t\ttag: options?.tagName ?? tagsBlobStorage[0].name,\n\t\tmethod: \"GET\",\n\t\tpath: `${baseRouteName}/`,\n\t\thandler: async (httpRequestContext, request) =>\n\t\t\tblobStorageList(httpRequestContext, componentName, request),\n\t\trequestType: {\n\t\t\ttype: nameof<IBlobStorageListRequest>(),\n\t\t\texamples: [\n\t\t\t\t{\n\t\t\t\t\tid: `${camelTypeName}ListRequestExample`,\n\t\t\t\t\trequest: {}\n\t\t\t\t}\n\t\t\t]\n\t\t},\n\t\tresponseType: [\n\t\t\t{\n\t\t\t\ttype: nameof<IBlobStorageListResponse>(),\n\t\t\t\texamples: [\n\t\t\t\t\t{\n\t\t\t\t\t\tid: `${camelTypeName}ListResponseExample`,\n\t\t\t\t\t\tresponse: {\n\t\t\t\t\t\t\tbody: {\n\t\t\t\t\t\t\t\t\"@context\": [\n\t\t\t\t\t\t\t\t\tSchemaOrgContexts.Context,\n\t\t\t\t\t\t\t\t\tBlobStorageContexts.Context,\n\t\t\t\t\t\t\t\t\tBlobStorageContexts.ContextCommon\n\t\t\t\t\t\t\t\t],\n\t\t\t\t\t\t\t\ttype: SchemaOrgTypes.ItemList,\n\t\t\t\t\t\t\t\t[SchemaOrgTypes.ItemListElement]: [\n\t\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\t\t\"@context\": [\n\t\t\t\t\t\t\t\t\t\t\tBlobStorageContexts.Context,\n\t\t\t\t\t\t\t\t\t\t\tBlobStorageContexts.ContextCommon,\n\t\t\t\t\t\t\t\t\t\t\tSchemaOrgContexts.Context\n\t\t\t\t\t\t\t\t\t\t],\n\t\t\t\t\t\t\t\t\t\ttype: BlobStorageTypes.Entry,\n\t\t\t\t\t\t\t\t\t\tid: \"blob-memory:c57d94b088f4c6d2cb32ded014813d0c786aa00134c8ee22f84b1e2545602a70\",\n\t\t\t\t\t\t\t\t\t\tdateCreated: \"2024-01-01T00:00:00Z\",\n\t\t\t\t\t\t\t\t\t\tencodingFormat: MimeTypes.Pdf,\n\t\t\t\t\t\t\t\t\t\tblobSize: 42,\n\t\t\t\t\t\t\t\t\t\tintegrity:\n\t\t\t\t\t\t\t\t\t\t\t\"sha256-c57d94b088f4c6d2cb32ded014813d0c786aa00134c8ee22f84b1e2545602a70\",\n\t\t\t\t\t\t\t\t\t\tfileExtension: \"pdf\",\n\t\t\t\t\t\t\t\t\t\tmetadata: {\n\t\t\t\t\t\t\t\t\t\t\t\"@context\": \"https://schema.org\",\n\t\t\t\t\t\t\t\t\t\t\t\"@type\": \"DigitalDocument\",\n\t\t\t\t\t\t\t\t\t\t\tname: \"myfile.pdf\"\n\t\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t\t\tblob: \"VGhlIHF1aWNrIGJyb3duIGZveCBqdW1wcyBvdmVyIHRoZSBsYXp5IGRvZw==\"\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t]\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t]\n\t\t\t},\n\t\t\t{\n\t\t\t\ttype: nameof<IBlobStorageListResponse>(),\n\t\t\t\tmimeType: MimeTypes.JsonLd,\n\t\t\t\texamples: [\n\t\t\t\t\t{\n\t\t\t\t\t\tid: `${camelTypeName}ListResponseJsonLdExample`,\n\t\t\t\t\t\tresponse: {\n\t\t\t\t\t\t\tbody: {\n\t\t\t\t\t\t\t\t\"@context\": [\n\t\t\t\t\t\t\t\t\tSchemaOrgContexts.Context,\n\t\t\t\t\t\t\t\t\tBlobStorageContexts.Context,\n\t\t\t\t\t\t\t\t\tBlobStorageContexts.ContextCommon\n\t\t\t\t\t\t\t\t],\n\t\t\t\t\t\t\t\ttype: SchemaOrgTypes.ItemList,\n\t\t\t\t\t\t\t\t[SchemaOrgTypes.ItemListElement]: [\n\t\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\t\t\"@context\": [\n\t\t\t\t\t\t\t\t\t\t\tBlobStorageContexts.Context,\n\t\t\t\t\t\t\t\t\t\t\tBlobStorageContexts.ContextCommon,\n\t\t\t\t\t\t\t\t\t\t\tSchemaOrgContexts.Context\n\t\t\t\t\t\t\t\t\t\t],\n\t\t\t\t\t\t\t\t\t\ttype: BlobStorageTypes.Entry,\n\t\t\t\t\t\t\t\t\t\tid: \"blob-memory:c57d94b088f4c6d2cb32ded014813d0c786aa00134c8ee22f84b1e2545602a70\",\n\t\t\t\t\t\t\t\t\t\tdateCreated: \"2024-01-01T00:00:00Z\",\n\t\t\t\t\t\t\t\t\t\tencodingFormat: MimeTypes.Pdf,\n\t\t\t\t\t\t\t\t\t\tblobSize: 42,\n\t\t\t\t\t\t\t\t\t\tintegrity:\n\t\t\t\t\t\t\t\t\t\t\t\"sha256-c57d94b088f4c6d2cb32ded014813d0c786aa00134c8ee22f84b1e2545602a70\",\n\t\t\t\t\t\t\t\t\t\tfileExtension: \"pdf\",\n\t\t\t\t\t\t\t\t\t\tmetadata: {\n\t\t\t\t\t\t\t\t\t\t\t\"@context\": \"https://schema.org\",\n\t\t\t\t\t\t\t\t\t\t\t\"@type\": \"DigitalDocument\",\n\t\t\t\t\t\t\t\t\t\t\tname: \"myfile.pdf\"\n\t\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t\t\tblob: \"VGhlIHF1aWNrIGJyb3duIGZveCBqdW1wcyBvdmVyIHRoZSBsYXp5IGRvZw==\"\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t]\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t]\n\t\t\t},\n\t\t\t{\n\t\t\t\ttype: nameof<INotFoundResponse>()\n\t\t\t}\n\t\t]\n\t};\n\n\treturn [\n\t\tblobStorageCreateRoute,\n\t\tblobStorageGetRoute,\n\t\tblobStorageGetContentRoute,\n\t\tblobStorageUpdateRoute,\n\t\tblobStorageRemoveRoute,\n\t\tblobStorageListRoute\n\t];\n}\n\n/**\n * Create a blob in storage.\n * @param httpRequestContext The request context for the API.\n * @param componentName The name of the component to use in the routes.\n * @param request The request.\n * @returns The response object with additional http response properties.\n */\nexport async function blobStorageCreate(\n\thttpRequestContext: IHttpRequestContext,\n\tcomponentName: string,\n\trequest: IBlobStorageCreateRequest\n): Promise<ICreatedResponse> {\n\tGuards.object<IBlobStorageCreateRequest>(ROUTES_SOURCE, nameof(request), request);\n\tGuards.object<IBlobStorageCreateRequest[\"body\"]>(\n\t\tROUTES_SOURCE,\n\t\tnameof(request.body),\n\t\trequest.body\n\t);\n\tGuards.stringBase64(ROUTES_SOURCE, nameof(request.body.blob), request.body.blob);\n\n\tconst component = ComponentFactory.get<IBlobStorageComponent>(componentName);\n\tconst id = await component.create(\n\t\trequest.body.blob,\n\t\trequest.body.encodingFormat,\n\t\trequest.body.fileExtension,\n\t\trequest.body.metadata,\n\t\t{\n\t\t\tdisableEncryption: request.body.disableEncryption,\n\t\t\toverrideVaultKeyId: request.body.overrideVaultKeyId,\n\t\t\tnamespace: request.body.namespace\n\t\t}\n\t);\n\n\treturn {\n\t\tstatusCode: HttpStatusCode.created,\n\t\theaders: {\n\t\t\t[HeaderTypes.Location]: id\n\t\t}\n\t};\n}\n\n/**\n * Get the blob from storage.\n * @param httpRequestContext The request context for the API.\n * @param componentName The name of the component to use in the routes.\n * @param request The request.\n * @returns The response object with additional http response properties.\n */\nexport async function blobStorageGet(\n\thttpRequestContext: IHttpRequestContext,\n\tcomponentName: string,\n\trequest: IBlobStorageGetRequest\n): Promise<IBlobStorageGetResponse> {\n\tGuards.object<IBlobStorageGetRequest>(ROUTES_SOURCE, nameof(request), request);\n\tGuards.object<IBlobStorageGetRequest[\"pathParams\"]>(\n\t\tROUTES_SOURCE,\n\t\tnameof(request.pathParams),\n\t\trequest.pathParams\n\t);\n\tGuards.stringValue(ROUTES_SOURCE, nameof(request.pathParams.id), request.pathParams.id);\n\n\tconst component = ComponentFactory.get<IBlobStorageComponent>(componentName);\n\n\tconst result = await component.get(request.pathParams.id, {\n\t\tincludeContent: Coerce.boolean(request.query?.includeContent),\n\t\tdecompress: Coerce.boolean(request.query?.decompress),\n\t\toverrideVaultKeyId: request.query?.overrideVaultKeyId\n\t});\n\n\treturn {\n\t\theaders: {\n\t\t\t[HeaderTypes.ContentType]:\n\t\t\t\trequest.headers?.[HeaderTypes.Accept] === MimeTypes.JsonLd\n\t\t\t\t\t? MimeTypes.JsonLd\n\t\t\t\t\t: MimeTypes.Json\n\t\t},\n\t\tbody: result\n\t};\n}\n\n/**\n * Get the blob from storage.\n * @param httpRequestContext The request context for the API.\n * @param componentName The name of the component to use in the routes.\n * @param request The request.\n * @returns The response object with additional http response properties.\n */\nexport async function blobStorageGetContent(\n\thttpRequestContext: IHttpRequestContext,\n\tcomponentName: string,\n\trequest: IBlobStorageGetContentRequest\n): Promise<IBlobStorageGetContentResponse & IRestRouteResponseOptions> {\n\tGuards.object<IBlobStorageGetContentRequest>(ROUTES_SOURCE, nameof(request), request);\n\tGuards.object<IBlobStorageGetContentRequest[\"pathParams\"]>(\n\t\tROUTES_SOURCE,\n\t\tnameof(request.pathParams),\n\t\trequest.pathParams\n\t);\n\tGuards.stringValue(ROUTES_SOURCE, nameof(request.pathParams.id), request.pathParams.id);\n\n\tconst component = ComponentFactory.get<IBlobStorageComponent>(componentName);\n\n\tconst decompress = Coerce.boolean(request.query?.decompress);\n\tconst download = Coerce.boolean(request.query?.download) ?? false;\n\n\tconst result = await component.get(request.pathParams.id, {\n\t\tincludeContent: true,\n\t\tdecompress,\n\t\toverrideVaultKeyId: request.query?.overrideVaultKeyId\n\t});\n\n\tconst encodingFormat = result?.encodingFormat ?? MimeTypes.OctetStream;\n\tlet compressedEncodingFormat: MimeTypes | undefined;\n\tlet compressedExtension: string = \"\";\n\n\t// If the entry is compressed and we are not decompressing\n\t// we need to override the encoding format to the compressed type\n\t// and append an additional extension to the filename.\n\tif (result.compression && !decompress) {\n\t\tcompressedEncodingFormat =\n\t\t\tresult.compression === BlobStorageCompressionType.Gzip ? MimeTypes.Gzip : MimeTypes.Zlib;\n\t\tcompressedExtension = `.${MimeTypeHelper.defaultExtension(compressedEncodingFormat)}`;\n\t}\n\n\tlet filename = request.query?.filename;\n\tif (!Is.stringValue(filename)) {\n\t\tfilename = `file.${result.fileExtension ?? MimeTypeHelper.defaultExtension(encodingFormat)}${compressedExtension}`;\n\t}\n\n\treturn {\n\t\tbody: Is.stringBase64(result.blob) ? Converter.base64ToBytes(result.blob) : new Uint8Array(),\n\t\tattachment: {\n\t\t\tmimeType: compressedEncodingFormat ?? encodingFormat,\n\t\t\tfilename,\n\t\t\tinline: !download\n\t\t}\n\t};\n}\n\n/**\n * Update the blob storage metadata.\n * @param httpRequestContext The request context for the API.\n * @param componentName The name of the component to use in the routes.\n * @param request The request.\n * @returns The response object with additional http response properties.\n */\nexport async function blobStorageUpdate(\n\thttpRequestContext: IHttpRequestContext,\n\tcomponentName: string,\n\trequest: IBlobStorageUpdateRequest\n): Promise<INoContentResponse> {\n\tGuards.object<IBlobStorageUpdateRequest>(ROUTES_SOURCE, nameof(request), request);\n\tGuards.object<IBlobStorageUpdateRequest[\"pathParams\"]>(\n\t\tROUTES_SOURCE,\n\t\tnameof(request.pathParams),\n\t\trequest.pathParams\n\t);\n\tGuards.stringValue(ROUTES_SOURCE, nameof(request.pathParams.id), request.pathParams.id);\n\n\tconst component = ComponentFactory.get<IBlobStorageComponent>(componentName);\n\n\tawait component.update(\n\t\trequest.pathParams.id,\n\t\trequest.body.encodingFormat,\n\t\trequest.body.fileExtension,\n\t\trequest.body.metadata\n\t);\n\n\treturn {\n\t\tstatusCode: HttpStatusCode.noContent\n\t};\n}\n\n/**\n * Remove the blob from storage.\n * @param httpRequestContext The request context for the API.\n * @param componentName The name of the component to use in the routes.\n * @param request The request.\n * @returns The response object with additional http response properties.\n */\nexport async function blobStorageRemove(\n\thttpRequestContext: IHttpRequestContext,\n\tcomponentName: string,\n\trequest: IBlobStorageRemoveRequest\n): Promise<INoContentResponse> {\n\tGuards.object<IBlobStorageRemoveRequest>(ROUTES_SOURCE, nameof(request), request);\n\tGuards.object<IBlobStorageGetRequest[\"pathParams\"]>(\n\t\tROUTES_SOURCE,\n\t\tnameof(request.pathParams),\n\t\trequest.pathParams\n\t);\n\tGuards.stringValue(ROUTES_SOURCE, nameof(request.pathParams.id), request.pathParams.id);\n\n\tconst component = ComponentFactory.get<IBlobStorageComponent>(componentName);\n\n\tawait component.remove(request.pathParams.id);\n\n\treturn {\n\t\tstatusCode: HttpStatusCode.noContent\n\t};\n}\n\n/**\n * List the entries from blob storage.\n * @param httpRequestContext The request context for the API.\n * @param componentName The name of the component to use in the routes.\n * @param request The request.\n * @returns The response object with additional http response properties.\n */\nexport async function blobStorageList(\n\thttpRequestContext: IHttpRequestContext,\n\tcomponentName: string,\n\trequest: IBlobStorageListRequest\n): Promise<IBlobStorageListResponse> {\n\tGuards.object<IBlobStorageListRequest>(ROUTES_SOURCE, nameof(request), request);\n\n\tconst hostingComponent = ComponentFactory.get<IHostingComponent>(\n\t\thttpRequestContext.hostingComponentType ?? \"hosting\"\n\t);\n\n\tconst component = ComponentFactory.get<IBlobStorageComponent>(componentName);\n\n\tconst result = await component.query(\n\t\tHttpParameterHelper.objectFromString(request.query?.conditions),\n\t\trequest.query?.orderBy,\n\t\trequest.query?.orderByDirection,\n\t\trequest.query?.cursor,\n\t\tCoerce.number(request.query?.limit)\n\t);\n\n\tconst headers: IBlobStorageListResponse[\"headers\"] = {\n\t\t[HeaderTypes.ContentType]:\n\t\t\trequest.headers?.[HeaderTypes.Accept] === MimeTypes.JsonLd ? MimeTypes.JsonLd : MimeTypes.Json\n\t};\n\n\tif (Is.stringValue(result.cursor)) {\n\t\theaders[HeaderTypes.Link] = HeaderHelper.createLinkHeader(\n\t\t\tawait hostingComponent.buildPublicUrl(httpRequestContext.serverRequest.url),\n\t\t\t{ cursor: result.cursor },\n\t\t\t\"next\"\n\t\t);\n\t}\n\n\treturn {\n\t\theaders,\n\t\tbody: result.entries\n\t};\n}\n"]}
|
|
1
|
+
{"version":3,"file":"blobStorageRoutes.js","sourceRoot":"","sources":["../../src/blobStorageRoutes.ts"],"names":[],"mappings":"AAAA,gCAAgC;AAChC,uCAAuC;AACvC,OAAO,EACN,mBAAmB,EASnB,MAAM,sBAAsB,CAAC;AAC9B,OAAO,EACN,0BAA0B,EAC1B,mBAAmB,EACnB,gBAAgB,EAWhB,MAAM,+BAA+B,CAAC;AACvC,OAAO,EAAE,MAAM,EAAE,gBAAgB,EAAE,SAAS,EAAE,MAAM,EAAE,EAAE,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAC;AAE/F,OAAO,EAAE,iBAAiB,EAAE,cAAc,EAAE,MAAM,gCAAgC,CAAC;AACnF,OAAO,EACN,YAAY,EACZ,WAAW,EACX,cAAc,EACd,cAAc,EACd,SAAS,EACT,MAAM,eAAe,CAAC;AAEvB;;GAEG;AACH,MAAM,aAAa,GAAG,mBAAmB,CAAC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E,KAAK,CAAC,CACnC,CAAC;IAEF,MAAM,OAAO,GAAwC;QACpD,CAAC,WAAW,CAAC,WAAW,CAAC,EACxB,OAAO,CAAC,OAAO,EAAE,CAAC,WAAW,CAAC,MAAM,CAAC,KAAK,SAAS,CAAC,MAAM,CAAC,CAAC,CAAC,SAAS,CAAC,MAAM,CAAC,CAAC,CAAC,SAAS,CAAC,IAAI;KAC/F,CAAC;IAEF,IAAI,EAAE,CAAC,WAAW,CAAC,MAAM,CAAC,MAAM,CAAC,EAAE,CAAC;QACnC,OAAO,CAAC,WAAW,CAAC,IAAI,CAAC,GAAG,YAAY,CAAC,gBAAgB,CACxD,MAAM,gBAAgB,CAAC,cAAc,CAAC,kBAAkB,CAAC,aAAa,CAAC,GAAG,CAAC,EAC3E,EAAE,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,EACzB,MAAM,CACN,CAAC;IACH,CAAC;IAED,OAAO;QACN,OAAO;QACP,IAAI,EAAE,MAAM,CAAC,OAAO;KACpB,CAAC;AACH,CAAC","sourcesContent":["// Copyright 2024 IOTA Stiftung.\n// SPDX-License-Identifier: Apache-2.0.\nimport {\n\tHttpParameterHelper,\n\ttype IHostingComponent,\n\ttype ICreatedResponse,\n\ttype IHttpRequestContext,\n\ttype INoContentResponse,\n\ttype INotFoundResponse,\n\ttype IRestRoute,\n\ttype IRestRouteResponseOptions,\n\ttype ITag\n} from \"@twin.org/api-models\";\nimport {\n\tBlobStorageCompressionType,\n\tBlobStorageContexts,\n\tBlobStorageTypes,\n\ttype IBlobStorageComponent,\n\ttype IBlobStorageCreateRequest,\n\ttype IBlobStorageGetContentRequest,\n\ttype IBlobStorageGetContentResponse,\n\ttype IBlobStorageGetRequest,\n\ttype IBlobStorageGetResponse,\n\ttype IBlobStorageListRequest,\n\ttype IBlobStorageListResponse,\n\ttype IBlobStorageRemoveRequest,\n\ttype IBlobStorageUpdateRequest\n} from \"@twin.org/blob-storage-models\";\nimport { Coerce, ComponentFactory, Converter, Guards, Is, StringHelper } from \"@twin.org/core\";\nimport { nameof } from \"@twin.org/nameof\";\nimport { SchemaOrgContexts, SchemaOrgTypes } from \"@twin.org/standards-schema-org\";\nimport {\n\tHeaderHelper,\n\tHeaderTypes,\n\tHttpStatusCode,\n\tMimeTypeHelper,\n\tMimeTypes\n} from \"@twin.org/web\";\n\n/**\n * The source used when communicating about these routes.\n */\nconst ROUTES_SOURCE = \"blobStorageRoutes\";\n\n/**\n * The tag to associate with the routes.\n */\nexport const tagsBlobStorage: ITag[] = [\n\t{\n\t\tname: \"Blob Storage\",\n\t\tdescription: \"Endpoints which are modelled to access a blob storage contract.\"\n\t}\n];\n\n/**\n * The REST routes for blob storage.\n * @param baseRouteName Prefix to prepend to the paths.\n * @param componentName The name of the component to use in the routes stored in the ComponentFactory.\n * @param options Additional options for the routes.\n * @param options.typeName Optional type name to use in the routes, defaults to Blob Storage.\n * @param options.tagName Optional name to use in OpenAPI spec for tag.\n * @returns The generated routes.\n */\nexport function generateRestRoutesBlobStorage(\n\tbaseRouteName: string,\n\tcomponentName: string,\n\toptions?: {\n\t\ttypeName?: string;\n\t\ttagName?: string;\n\t}\n): IRestRoute[] {\n\tconst typeName = options?.typeName ?? \"Blob Storage\";\n\tconst lowerName = typeName.toLowerCase();\n\tconst camelTypeName = StringHelper.camelCase(typeName);\n\n\tconst blobStorageCreateRoute: IRestRoute<IBlobStorageCreateRequest, ICreatedResponse> = {\n\t\toperationId: `${camelTypeName}Create`,\n\t\tsummary: `Create an entry in ${lowerName}`,\n\t\ttag: options?.tagName ?? tagsBlobStorage[0].name,\n\t\tmethod: \"POST\",\n\t\tpath: `${baseRouteName}/`,\n\t\thandler: async (httpRequestContext, request) =>\n\t\t\tblobStorageCreate(httpRequestContext, componentName, request),\n\t\trequestType: {\n\t\t\ttype: nameof<IBlobStorageCreateRequest>(),\n\t\t\texamples: [\n\t\t\t\t{\n\t\t\t\t\tid: `${camelTypeName}CreateRequestExample`,\n\t\t\t\t\trequest: {\n\t\t\t\t\t\tbody: {\n\t\t\t\t\t\t\tblob: \"VGhlIHF1aWNrIGJyb3duIGZveCBqdW1wcyBvdmVyIHRoZSBsYXp5IGRvZw==\",\n\t\t\t\t\t\t\tmetadata: {\n\t\t\t\t\t\t\t\t\"@context\": \"https://schema.org\",\n\t\t\t\t\t\t\t\t\"@type\": \"DigitalDocument\",\n\t\t\t\t\t\t\t\tname: \"myfile.pdf\"\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t]\n\t\t},\n\t\tresponseType: [\n\t\t\t{\n\t\t\t\ttype: nameof<ICreatedResponse>(),\n\t\t\t\texamples: [\n\t\t\t\t\t{\n\t\t\t\t\t\tid: `${camelTypeName}CreateResponseExample`,\n\t\t\t\t\t\tresponse: {\n\t\t\t\t\t\t\tstatusCode: HttpStatusCode.created,\n\t\t\t\t\t\t\theaders: {\n\t\t\t\t\t\t\t\t[HeaderTypes.Location]:\n\t\t\t\t\t\t\t\t\t\"blob-memory:c57d94b088f4c6d2cb32ded014813d0c786aa00134c8ee22f84b1e2545602a70\"\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t]\n\t\t\t}\n\t\t]\n\t};\n\n\tconst blobStorageGetRoute: IRestRoute<IBlobStorageGetRequest, IBlobStorageGetResponse> = {\n\t\toperationId: `${camelTypeName}Get`,\n\t\tsummary: `Get the metadata for an item from ${lowerName}`,\n\t\ttag: options?.tagName ?? tagsBlobStorage[0].name,\n\t\tmethod: \"GET\",\n\t\tpath: `${baseRouteName}/:id`,\n\t\thandler: async (httpRequestContext, request) =>\n\t\t\tblobStorageGet(httpRequestContext, componentName, request),\n\t\trequestType: {\n\t\t\ttype: nameof<IBlobStorageGetRequest>(),\n\t\t\texamples: [\n\t\t\t\t{\n\t\t\t\t\tid: `${camelTypeName}GetRequestExample`,\n\t\t\t\t\trequest: {\n\t\t\t\t\t\tpathParams: {\n\t\t\t\t\t\t\tid: \"blob-memory:c57d94b088f4c6d2cb32ded014813d0c786aa00134c8ee22f84b1e2545602a70\"\n\t\t\t\t\t\t},\n\t\t\t\t\t\tquery: {\n\t\t\t\t\t\t\tincludeContent: \"true\"\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t]\n\t\t},\n\t\tresponseType: [\n\t\t\t{\n\t\t\t\ttype: nameof<IBlobStorageGetResponse>(),\n\t\t\t\texamples: [\n\t\t\t\t\t{\n\t\t\t\t\t\tid: `${camelTypeName}GetResponseExample`,\n\t\t\t\t\t\tresponse: {\n\t\t\t\t\t\t\tbody: {\n\t\t\t\t\t\t\t\t\"@context\": [\n\t\t\t\t\t\t\t\t\tBlobStorageContexts.Context,\n\t\t\t\t\t\t\t\t\tBlobStorageContexts.ContextCommon,\n\t\t\t\t\t\t\t\t\tSchemaOrgContexts.Context\n\t\t\t\t\t\t\t\t],\n\t\t\t\t\t\t\t\ttype: BlobStorageTypes.Entry,\n\t\t\t\t\t\t\t\tid: \"blob-memory:c57d94b088f4c6d2cb32ded014813d0c786aa00134c8ee22f84b1e2545602a70\",\n\t\t\t\t\t\t\t\tdateCreated: \"2024-01-01T00:00:00Z\",\n\t\t\t\t\t\t\t\tencodingFormat: MimeTypes.Pdf,\n\t\t\t\t\t\t\t\tblobSize: 42,\n\t\t\t\t\t\t\t\tintegrity: \"sha256-xX2UsIj0xtLLMt7QFIExDHhqoAE0yO4i+EseJUVgKnA=\",\n\t\t\t\t\t\t\t\tfileExtension: \"pdf\",\n\t\t\t\t\t\t\t\tmetadata: {\n\t\t\t\t\t\t\t\t\t\"@context\": \"https://schema.org\",\n\t\t\t\t\t\t\t\t\t\"@type\": \"DigitalDocument\",\n\t\t\t\t\t\t\t\t\tname: \"myfile.pdf\"\n\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\tblob: \"VGhlIHF1aWNrIGJyb3duIGZveCBqdW1wcyBvdmVyIHRoZSBsYXp5IGRvZw==\"\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t]\n\t\t\t},\n\t\t\t{\n\t\t\t\ttype: nameof<IBlobStorageGetResponse>(),\n\t\t\t\tmimeType: MimeTypes.JsonLd,\n\t\t\t\texamples: [\n\t\t\t\t\t{\n\t\t\t\t\t\tid: `${camelTypeName}GetResponseJsonLdExample`,\n\t\t\t\t\t\tresponse: {\n\t\t\t\t\t\t\tbody: {\n\t\t\t\t\t\t\t\t\"@context\": [\n\t\t\t\t\t\t\t\t\tBlobStorageContexts.Context,\n\t\t\t\t\t\t\t\t\tBlobStorageContexts.ContextCommon,\n\t\t\t\t\t\t\t\t\tSchemaOrgContexts.Context\n\t\t\t\t\t\t\t\t],\n\t\t\t\t\t\t\t\ttype: BlobStorageTypes.Entry,\n\t\t\t\t\t\t\t\tid: \"blob-memory:c57d94b088f4c6d2cb32ded014813d0c786aa00134c8ee22f84b1e2545602a70\",\n\t\t\t\t\t\t\t\tdateCreated: \"2024-01-01T00:00:00Z\",\n\t\t\t\t\t\t\t\tencodingFormat: MimeTypes.Pdf,\n\t\t\t\t\t\t\t\tblobSize: 42,\n\t\t\t\t\t\t\t\tintegrity: \"sha256-xX2UsIj0xtLLMt7QFIExDHhqoAE0yO4i+EseJUVgKnA=\",\n\t\t\t\t\t\t\t\tfileExtension: \"pdf\",\n\t\t\t\t\t\t\t\tmetadata: {\n\t\t\t\t\t\t\t\t\t\"@context\": \"https://schema.org\",\n\t\t\t\t\t\t\t\t\t\"@type\": \"DigitalDocument\",\n\t\t\t\t\t\t\t\t\tname: \"myfile.pdf\"\n\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\tblob: \"VGhlIHF1aWNrIGJyb3duIGZveCBqdW1wcyBvdmVyIHRoZSBsYXp5IGRvZw==\"\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t]\n\t\t\t},\n\t\t\t{\n\t\t\t\ttype: nameof<INotFoundResponse>()\n\t\t\t}\n\t\t]\n\t};\n\n\tconst blobStorageGetContentRoute: IRestRoute<\n\t\tIBlobStorageGetContentRequest,\n\t\tIBlobStorageGetContentResponse & IRestRouteResponseOptions\n\t> = {\n\t\toperationId: `${camelTypeName}GetContent`,\n\t\tsummary: `Get the content for an item in ${lowerName}`,\n\t\ttag: options?.tagName ?? tagsBlobStorage[0].name,\n\t\tmethod: \"GET\",\n\t\tpath: `${baseRouteName}/:id/content`,\n\t\thandler: async (httpRequestContext, request) =>\n\t\t\tblobStorageGetContent(httpRequestContext, componentName, request),\n\t\trequestType: {\n\t\t\ttype: nameof<IBlobStorageGetRequest>(),\n\t\t\texamples: [\n\t\t\t\t{\n\t\t\t\t\tid: `${camelTypeName}GetContentRequestExample`,\n\t\t\t\t\trequest: {\n\t\t\t\t\t\tpathParams: {\n\t\t\t\t\t\t\tid: \"blob-memory:c57d94b088f4c6d2cb32ded014813d0c786aa00134c8ee22f84b1e2545602a70\"\n\t\t\t\t\t\t},\n\t\t\t\t\t\tquery: {\n\t\t\t\t\t\t\tdownload: \"true\",\n\t\t\t\t\t\t\tfilename: \"my-file.pdf\"\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t]\n\t\t},\n\t\tresponseType: [\n\t\t\t{\n\t\t\t\ttype: nameof<Uint8Array>(),\n\t\t\t\tmimeType: MimeTypes.OctetStream,\n\t\t\t\texamples: [\n\t\t\t\t\t{\n\t\t\t\t\t\tid: `${camelTypeName}GetContentResponseExample`,\n\t\t\t\t\t\tdescription: `The content of the blob, which will be a specific mime type if one can be detected from the content (or set as encodingFormat in the entry), or defaults to ${MimeTypes.OctetStream}.`,\n\t\t\t\t\t\tresponse: {\n\t\t\t\t\t\t\tbody: new Uint8Array()\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t]\n\t\t\t},\n\t\t\t{\n\t\t\t\ttype: nameof<INotFoundResponse>()\n\t\t\t}\n\t\t]\n\t};\n\n\tconst blobStorageUpdateRoute: IRestRoute<IBlobStorageUpdateRequest, INoContentResponse> = {\n\t\toperationId: `${camelTypeName}Update`,\n\t\tsummary: `Update the metadata for an item in ${lowerName}`,\n\t\ttag: options?.tagName ?? tagsBlobStorage[0].name,\n\t\tmethod: \"PUT\",\n\t\tpath: `${baseRouteName}/:id`,\n\t\thandler: async (httpRequestContext, request) =>\n\t\t\tblobStorageUpdate(httpRequestContext, componentName, request),\n\t\trequestType: {\n\t\t\ttype: nameof<IBlobStorageUpdateRequest>(),\n\t\t\texamples: [\n\t\t\t\t{\n\t\t\t\t\tid: `${camelTypeName}UpdateRequestExample`,\n\t\t\t\t\trequest: {\n\t\t\t\t\t\tpathParams: {\n\t\t\t\t\t\t\tid: \"blob-memory:c57d94b088f4c6d2cb32ded014813d0c786aa00134c8ee22f84b1e2545602a70\"\n\t\t\t\t\t\t},\n\t\t\t\t\t\tbody: {\n\t\t\t\t\t\t\tmetadata: {\n\t\t\t\t\t\t\t\t\"@context\": \"https://schema.org\",\n\t\t\t\t\t\t\t\t\"@type\": \"DigitalDocument\",\n\t\t\t\t\t\t\t\tname: \"myfile.pdf\"\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t]\n\t\t},\n\t\tresponseType: [\n\t\t\t{\n\t\t\t\ttype: nameof<INoContentResponse>()\n\t\t\t}\n\t\t]\n\t};\n\n\tconst blobStorageRemoveRoute: IRestRoute<IBlobStorageRemoveRequest, INoContentResponse> = {\n\t\toperationId: `${camelTypeName}Remove`,\n\t\tsummary: `Remove an item from ${lowerName}`,\n\t\ttag: options?.tagName ?? tagsBlobStorage[0].name,\n\t\tmethod: \"DELETE\",\n\t\tpath: `${baseRouteName}/:id`,\n\t\thandler: async (httpRequestContext, request) =>\n\t\t\tblobStorageRemove(httpRequestContext, componentName, request),\n\t\trequestType: {\n\t\t\ttype: nameof<IBlobStorageRemoveRequest>(),\n\t\t\texamples: [\n\t\t\t\t{\n\t\t\t\t\tid: `${camelTypeName}RemoveRequestExample`,\n\t\t\t\t\trequest: {\n\t\t\t\t\t\tpathParams: {\n\t\t\t\t\t\t\tid: \"blob-memory:c57d94b088f4c6d2cb32ded014813d0c786aa00134c8ee22f84b1e2545602a70\"\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t]\n\t\t},\n\t\tresponseType: [\n\t\t\t{\n\t\t\t\ttype: nameof<INoContentResponse>()\n\t\t\t},\n\t\t\t{\n\t\t\t\ttype: nameof<INotFoundResponse>()\n\t\t\t}\n\t\t]\n\t};\n\n\tconst blobStorageListRoute: IRestRoute<IBlobStorageListRequest, IBlobStorageListResponse> = {\n\t\toperationId: `${camelTypeName}Query`,\n\t\tsummary: `Query the items from ${lowerName}`,\n\t\ttag: options?.tagName ?? tagsBlobStorage[0].name,\n\t\tmethod: \"GET\",\n\t\tpath: `${baseRouteName}/`,\n\t\thandler: async (httpRequestContext, request) =>\n\t\t\tblobStorageList(httpRequestContext, componentName, request),\n\t\trequestType: {\n\t\t\ttype: nameof<IBlobStorageListRequest>(),\n\t\t\texamples: [\n\t\t\t\t{\n\t\t\t\t\tid: `${camelTypeName}ListRequestExample`,\n\t\t\t\t\trequest: {}\n\t\t\t\t}\n\t\t\t]\n\t\t},\n\t\tresponseType: [\n\t\t\t{\n\t\t\t\ttype: nameof<IBlobStorageListResponse>(),\n\t\t\t\texamples: [\n\t\t\t\t\t{\n\t\t\t\t\t\tid: `${camelTypeName}ListResponseExample`,\n\t\t\t\t\t\tresponse: {\n\t\t\t\t\t\t\tbody: {\n\t\t\t\t\t\t\t\t\"@context\": [\n\t\t\t\t\t\t\t\t\tSchemaOrgContexts.Context,\n\t\t\t\t\t\t\t\t\tBlobStorageContexts.Context,\n\t\t\t\t\t\t\t\t\tBlobStorageContexts.ContextCommon\n\t\t\t\t\t\t\t\t],\n\t\t\t\t\t\t\t\ttype: SchemaOrgTypes.ItemList,\n\t\t\t\t\t\t\t\t[SchemaOrgTypes.ItemListElement]: [\n\t\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\t\t\"@context\": [\n\t\t\t\t\t\t\t\t\t\t\tBlobStorageContexts.Context,\n\t\t\t\t\t\t\t\t\t\t\tBlobStorageContexts.ContextCommon,\n\t\t\t\t\t\t\t\t\t\t\tSchemaOrgContexts.Context\n\t\t\t\t\t\t\t\t\t\t],\n\t\t\t\t\t\t\t\t\t\ttype: BlobStorageTypes.Entry,\n\t\t\t\t\t\t\t\t\t\tid: \"blob-memory:c57d94b088f4c6d2cb32ded014813d0c786aa00134c8ee22f84b1e2545602a70\",\n\t\t\t\t\t\t\t\t\t\tdateCreated: \"2024-01-01T00:00:00Z\",\n\t\t\t\t\t\t\t\t\t\tencodingFormat: MimeTypes.Pdf,\n\t\t\t\t\t\t\t\t\t\tblobSize: 42,\n\t\t\t\t\t\t\t\t\t\tintegrity: \"sha256-xX2UsIj0xtLLMt7QFIExDHhqoAE0yO4i+EseJUVgKnA=\",\n\t\t\t\t\t\t\t\t\t\tfileExtension: \"pdf\",\n\t\t\t\t\t\t\t\t\t\tmetadata: {\n\t\t\t\t\t\t\t\t\t\t\t\"@context\": \"https://schema.org\",\n\t\t\t\t\t\t\t\t\t\t\t\"@type\": \"DigitalDocument\",\n\t\t\t\t\t\t\t\t\t\t\tname: \"myfile.pdf\"\n\t\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t\t\tblob: \"VGhlIHF1aWNrIGJyb3duIGZveCBqdW1wcyBvdmVyIHRoZSBsYXp5IGRvZw==\"\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t]\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t]\n\t\t\t},\n\t\t\t{\n\t\t\t\ttype: nameof<IBlobStorageListResponse>(),\n\t\t\t\tmimeType: MimeTypes.JsonLd,\n\t\t\t\texamples: [\n\t\t\t\t\t{\n\t\t\t\t\t\tid: `${camelTypeName}ListResponseJsonLdExample`,\n\t\t\t\t\t\tresponse: {\n\t\t\t\t\t\t\tbody: {\n\t\t\t\t\t\t\t\t\"@context\": [\n\t\t\t\t\t\t\t\t\tSchemaOrgContexts.Context,\n\t\t\t\t\t\t\t\t\tBlobStorageContexts.Context,\n\t\t\t\t\t\t\t\t\tBlobStorageContexts.ContextCommon\n\t\t\t\t\t\t\t\t],\n\t\t\t\t\t\t\t\ttype: SchemaOrgTypes.ItemList,\n\t\t\t\t\t\t\t\t[SchemaOrgTypes.ItemListElement]: [\n\t\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\t\t\"@context\": [\n\t\t\t\t\t\t\t\t\t\t\tBlobStorageContexts.Context,\n\t\t\t\t\t\t\t\t\t\t\tBlobStorageContexts.ContextCommon,\n\t\t\t\t\t\t\t\t\t\t\tSchemaOrgContexts.Context\n\t\t\t\t\t\t\t\t\t\t],\n\t\t\t\t\t\t\t\t\t\ttype: BlobStorageTypes.Entry,\n\t\t\t\t\t\t\t\t\t\tid: \"blob-memory:c57d94b088f4c6d2cb32ded014813d0c786aa00134c8ee22f84b1e2545602a70\",\n\t\t\t\t\t\t\t\t\t\tdateCreated: \"2024-01-01T00:00:00Z\",\n\t\t\t\t\t\t\t\t\t\tencodingFormat: MimeTypes.Pdf,\n\t\t\t\t\t\t\t\t\t\tblobSize: 42,\n\t\t\t\t\t\t\t\t\t\tintegrity: \"sha256-xX2UsIj0xtLLMt7QFIExDHhqoAE0yO4i+EseJUVgKnA=\",\n\t\t\t\t\t\t\t\t\t\tfileExtension: \"pdf\",\n\t\t\t\t\t\t\t\t\t\tmetadata: {\n\t\t\t\t\t\t\t\t\t\t\t\"@context\": \"https://schema.org\",\n\t\t\t\t\t\t\t\t\t\t\t\"@type\": \"DigitalDocument\",\n\t\t\t\t\t\t\t\t\t\t\tname: \"myfile.pdf\"\n\t\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t\t\tblob: \"VGhlIHF1aWNrIGJyb3duIGZveCBqdW1wcyBvdmVyIHRoZSBsYXp5IGRvZw==\"\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t]\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t]\n\t\t\t},\n\t\t\t{\n\t\t\t\ttype: nameof<INotFoundResponse>()\n\t\t\t}\n\t\t]\n\t};\n\n\treturn [\n\t\tblobStorageCreateRoute,\n\t\tblobStorageGetRoute,\n\t\tblobStorageGetContentRoute,\n\t\tblobStorageUpdateRoute,\n\t\tblobStorageRemoveRoute,\n\t\tblobStorageListRoute\n\t];\n}\n\n/**\n * Create a blob in storage.\n * @param httpRequestContext The request context for the API.\n * @param componentName The name of the component to use in the routes.\n * @param request The request.\n * @returns The response object with additional http response properties.\n */\nexport async function blobStorageCreate(\n\thttpRequestContext: IHttpRequestContext,\n\tcomponentName: string,\n\trequest: IBlobStorageCreateRequest\n): Promise<ICreatedResponse> {\n\tGuards.object<IBlobStorageCreateRequest>(ROUTES_SOURCE, nameof(request), request);\n\tGuards.object<IBlobStorageCreateRequest[\"body\"]>(\n\t\tROUTES_SOURCE,\n\t\tnameof(request.body),\n\t\trequest.body\n\t);\n\tGuards.stringBase64(ROUTES_SOURCE, nameof(request.body.blob), request.body.blob);\n\n\tconst component = ComponentFactory.get<IBlobStorageComponent>(componentName);\n\tconst id = await component.create(\n\t\trequest.body.blob,\n\t\trequest.body.encodingFormat,\n\t\trequest.body.fileExtension,\n\t\trequest.body.metadata,\n\t\t{\n\t\t\tdisableEncryption: request.body.disableEncryption,\n\t\t\toverrideVaultKeyId: request.body.overrideVaultKeyId,\n\t\t\tnamespace: request.body.namespace\n\t\t}\n\t);\n\n\treturn {\n\t\tstatusCode: HttpStatusCode.created,\n\t\theaders: {\n\t\t\t[HeaderTypes.Location]: id\n\t\t}\n\t};\n}\n\n/**\n * Get the blob from storage.\n * @param httpRequestContext The request context for the API.\n * @param componentName The name of the component to use in the routes.\n * @param request The request.\n * @returns The response object with additional http response properties.\n */\nexport async function blobStorageGet(\n\thttpRequestContext: IHttpRequestContext,\n\tcomponentName: string,\n\trequest: IBlobStorageGetRequest\n): Promise<IBlobStorageGetResponse> {\n\tGuards.object<IBlobStorageGetRequest>(ROUTES_SOURCE, nameof(request), request);\n\tGuards.object<IBlobStorageGetRequest[\"pathParams\"]>(\n\t\tROUTES_SOURCE,\n\t\tnameof(request.pathParams),\n\t\trequest.pathParams\n\t);\n\tGuards.stringValue(ROUTES_SOURCE, nameof(request.pathParams.id), request.pathParams.id);\n\n\tconst component = ComponentFactory.get<IBlobStorageComponent>(componentName);\n\n\tconst result = await component.get(request.pathParams.id, {\n\t\tincludeContent: Coerce.boolean(request.query?.includeContent),\n\t\tdecompress: Coerce.boolean(request.query?.decompress),\n\t\toverrideVaultKeyId: request.query?.overrideVaultKeyId\n\t});\n\n\treturn {\n\t\theaders: {\n\t\t\t[HeaderTypes.ContentType]:\n\t\t\t\trequest.headers?.[HeaderTypes.Accept] === MimeTypes.JsonLd\n\t\t\t\t\t? MimeTypes.JsonLd\n\t\t\t\t\t: MimeTypes.Json\n\t\t},\n\t\tbody: result\n\t};\n}\n\n/**\n * Get the blob from storage.\n * @param httpRequestContext The request context for the API.\n * @param componentName The name of the component to use in the routes.\n * @param request The request.\n * @returns The response object with additional http response properties.\n */\nexport async function blobStorageGetContent(\n\thttpRequestContext: IHttpRequestContext,\n\tcomponentName: string,\n\trequest: IBlobStorageGetContentRequest\n): Promise<IBlobStorageGetContentResponse & IRestRouteResponseOptions> {\n\tGuards.object<IBlobStorageGetContentRequest>(ROUTES_SOURCE, nameof(request), request);\n\tGuards.object<IBlobStorageGetContentRequest[\"pathParams\"]>(\n\t\tROUTES_SOURCE,\n\t\tnameof(request.pathParams),\n\t\trequest.pathParams\n\t);\n\tGuards.stringValue(ROUTES_SOURCE, nameof(request.pathParams.id), request.pathParams.id);\n\n\tconst component = ComponentFactory.get<IBlobStorageComponent>(componentName);\n\n\tconst decompress = Coerce.boolean(request.query?.decompress);\n\tconst download = Coerce.boolean(request.query?.download) ?? false;\n\n\tconst result = await component.get(request.pathParams.id, {\n\t\tincludeContent: true,\n\t\tdecompress,\n\t\toverrideVaultKeyId: request.query?.overrideVaultKeyId\n\t});\n\n\tconst encodingFormat = result?.encodingFormat ?? MimeTypes.OctetStream;\n\tlet compressedEncodingFormat: MimeTypes | undefined;\n\tlet compressedExtension: string = \"\";\n\n\t// If the entry is compressed and we are not decompressing\n\t// we need to override the encoding format to the compressed type\n\t// and append an additional extension to the filename.\n\tif (result.compression && !decompress) {\n\t\tcompressedEncodingFormat =\n\t\t\tresult.compression === BlobStorageCompressionType.Gzip ? MimeTypes.Gzip : MimeTypes.Zlib;\n\t\tcompressedExtension = `.${MimeTypeHelper.defaultExtension(compressedEncodingFormat)}`;\n\t}\n\n\tlet filename = request.query?.filename;\n\tif (!Is.stringValue(filename)) {\n\t\tfilename = `file.${result.fileExtension ?? MimeTypeHelper.defaultExtension(encodingFormat)}${compressedExtension}`;\n\t}\n\n\treturn {\n\t\tbody: Is.stringBase64(result.blob) ? Converter.base64ToBytes(result.blob) : new Uint8Array(),\n\t\tattachment: {\n\t\t\tmimeType: compressedEncodingFormat ?? encodingFormat,\n\t\t\tfilename,\n\t\t\tinline: !download\n\t\t}\n\t};\n}\n\n/**\n * Update the blob storage metadata.\n * @param httpRequestContext The request context for the API.\n * @param componentName The name of the component to use in the routes.\n * @param request The request.\n * @returns The response object with additional http response properties.\n */\nexport async function blobStorageUpdate(\n\thttpRequestContext: IHttpRequestContext,\n\tcomponentName: string,\n\trequest: IBlobStorageUpdateRequest\n): Promise<INoContentResponse> {\n\tGuards.object<IBlobStorageUpdateRequest>(ROUTES_SOURCE, nameof(request), request);\n\tGuards.object<IBlobStorageUpdateRequest[\"pathParams\"]>(\n\t\tROUTES_SOURCE,\n\t\tnameof(request.pathParams),\n\t\trequest.pathParams\n\t);\n\tGuards.stringValue(ROUTES_SOURCE, nameof(request.pathParams.id), request.pathParams.id);\n\n\tconst component = ComponentFactory.get<IBlobStorageComponent>(componentName);\n\n\tawait component.update(\n\t\trequest.pathParams.id,\n\t\trequest.body.encodingFormat,\n\t\trequest.body.fileExtension,\n\t\trequest.body.metadata\n\t);\n\n\treturn {\n\t\tstatusCode: HttpStatusCode.noContent\n\t};\n}\n\n/**\n * Remove the blob from storage.\n * @param httpRequestContext The request context for the API.\n * @param componentName The name of the component to use in the routes.\n * @param request The request.\n * @returns The response object with additional http response properties.\n */\nexport async function blobStorageRemove(\n\thttpRequestContext: IHttpRequestContext,\n\tcomponentName: string,\n\trequest: IBlobStorageRemoveRequest\n): Promise<INoContentResponse> {\n\tGuards.object<IBlobStorageRemoveRequest>(ROUTES_SOURCE, nameof(request), request);\n\tGuards.object<IBlobStorageGetRequest[\"pathParams\"]>(\n\t\tROUTES_SOURCE,\n\t\tnameof(request.pathParams),\n\t\trequest.pathParams\n\t);\n\tGuards.stringValue(ROUTES_SOURCE, nameof(request.pathParams.id), request.pathParams.id);\n\n\tconst component = ComponentFactory.get<IBlobStorageComponent>(componentName);\n\n\tawait component.remove(request.pathParams.id);\n\n\treturn {\n\t\tstatusCode: HttpStatusCode.noContent\n\t};\n}\n\n/**\n * List the entries from blob storage.\n * @param httpRequestContext The request context for the API.\n * @param componentName The name of the component to use in the routes.\n * @param request The request.\n * @returns The response object with additional http response properties.\n */\nexport async function blobStorageList(\n\thttpRequestContext: IHttpRequestContext,\n\tcomponentName: string,\n\trequest: IBlobStorageListRequest\n): Promise<IBlobStorageListResponse> {\n\tGuards.object<IBlobStorageListRequest>(ROUTES_SOURCE, nameof(request), request);\n\n\tconst hostingComponent = ComponentFactory.get<IHostingComponent>(\n\t\thttpRequestContext.hostingComponentType ?? \"hosting\"\n\t);\n\n\tconst component = ComponentFactory.get<IBlobStorageComponent>(componentName);\n\n\tconst result = await component.query(\n\t\tHttpParameterHelper.objectFromString(request.query?.conditions),\n\t\trequest.query?.orderBy,\n\t\trequest.query?.orderByDirection,\n\t\trequest.query?.cursor,\n\t\tCoerce.number(request.query?.limit)\n\t);\n\n\tconst headers: IBlobStorageListResponse[\"headers\"] = {\n\t\t[HeaderTypes.ContentType]:\n\t\t\trequest.headers?.[HeaderTypes.Accept] === MimeTypes.JsonLd ? MimeTypes.JsonLd : MimeTypes.Json\n\t};\n\n\tif (Is.stringValue(result.cursor)) {\n\t\theaders[HeaderTypes.Link] = HeaderHelper.createLinkHeader(\n\t\t\tawait hostingComponent.buildPublicUrl(httpRequestContext.serverRequest.url),\n\t\t\t{ cursor: result.cursor },\n\t\t\t\"next\"\n\t\t);\n\t}\n\n\treturn {\n\t\theaders,\n\t\tbody: result.entries\n\t};\n}\n"]}
|
package/docs/changelog.md
CHANGED
|
@@ -1,13 +1,45 @@
|
|
|
1
|
-
#
|
|
1
|
+
# Changelog
|
|
2
2
|
|
|
3
|
-
## [0.0.3-next.
|
|
3
|
+
## [0.0.3-next.8](https://github.com/iotaledger/twin-blob-storage/compare/blob-storage-service-v0.0.3-next.7...blob-storage-service-v0.0.3-next.8) (2026-05-07)
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
### Miscellaneous Chores
|
|
7
|
+
|
|
8
|
+
* **blob-storage-service:** Synchronize repo versions
|
|
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.7 to 0.0.3-next.8
|
|
16
|
+
* devDependencies
|
|
17
|
+
* @twin.org/blob-storage-connector-memory bumped from 0.0.3-next.7 to 0.0.3-next.8
|
|
18
|
+
|
|
19
|
+
## [0.0.3-next.7](https://github.com/iotaledger/twin-blob-storage/compare/blob-storage-service-v0.0.3-next.6...blob-storage-service-v0.0.3-next.7) (2026-02-25)
|
|
20
|
+
|
|
21
|
+
|
|
22
|
+
### Features
|
|
23
|
+
|
|
24
|
+
* update schemas ([6fe6571](https://github.com/iotaledger/twin-blob-storage/commit/6fe65714e23209cdd760ecd5aa8e18762044e4b3))
|
|
25
|
+
|
|
26
|
+
|
|
27
|
+
### Dependencies
|
|
28
|
+
|
|
29
|
+
* The following workspace dependencies were updated
|
|
30
|
+
* dependencies
|
|
31
|
+
* @twin.org/blob-storage-models bumped from 0.0.3-next.6 to 0.0.3-next.7
|
|
32
|
+
* devDependencies
|
|
33
|
+
* @twin.org/blob-storage-connector-memory bumped from 0.0.3-next.6 to 0.0.3-next.7
|
|
34
|
+
|
|
35
|
+
## [0.0.3-next.6](https://github.com/iotaledger/twin-blob-storage/compare/blob-storage-service-v0.0.3-next.5...blob-storage-service-v0.0.3-next.6) (2026-02-09)
|
|
4
36
|
|
|
5
37
|
|
|
6
38
|
### Features
|
|
7
39
|
|
|
8
|
-
* add ts-to-jsonld-context tool ([2fd217f](https://github.com/
|
|
9
|
-
* blobHash changed to integrity ([#41](https://github.com/
|
|
10
|
-
* update naming ([19d160f](https://github.com/
|
|
40
|
+
* add ts-to-jsonld-context tool ([2fd217f](https://github.com/iotaledger/twin-blob-storage/commit/2fd217f50dfaf6ac068091876237f5a101a7995e))
|
|
41
|
+
* blobHash changed to integrity ([#41](https://github.com/iotaledger/twin-blob-storage/issues/41)) ([c06a55f](https://github.com/iotaledger/twin-blob-storage/commit/c06a55f0eed3f7cad5d19c4084abd8ef0cdbfb60))
|
|
42
|
+
* update naming ([19d160f](https://github.com/iotaledger/twin-blob-storage/commit/19d160f6c2b155a1a19b85f4d676cbc15c0f0869))
|
|
11
43
|
|
|
12
44
|
|
|
13
45
|
### Dependencies
|
|
@@ -18,12 +50,12 @@
|
|
|
18
50
|
* devDependencies
|
|
19
51
|
* @twin.org/blob-storage-connector-memory bumped from 0.0.3-next.5 to 0.0.3-next.6
|
|
20
52
|
|
|
21
|
-
## [0.0.3-next.5](https://github.com/
|
|
53
|
+
## [0.0.3-next.5](https://github.com/iotaledger/twin-blob-storage/compare/blob-storage-service-v0.0.3-next.4...blob-storage-service-v0.0.3-next.5) (2026-01-26)
|
|
22
54
|
|
|
23
55
|
|
|
24
56
|
### Features
|
|
25
57
|
|
|
26
|
-
* use new hosting url for cursor links ([6844126](https://github.com/
|
|
58
|
+
* use new hosting url for cursor links ([6844126](https://github.com/iotaledger/twin-blob-storage/commit/6844126e1c431448de51225392daa3559776fdf3))
|
|
27
59
|
|
|
28
60
|
|
|
29
61
|
### Dependencies
|
|
@@ -34,12 +66,12 @@
|
|
|
34
66
|
* devDependencies
|
|
35
67
|
* @twin.org/blob-storage-connector-memory bumped from 0.0.3-next.4 to 0.0.3-next.5
|
|
36
68
|
|
|
37
|
-
## [0.0.3-next.4](https://github.com/
|
|
69
|
+
## [0.0.3-next.4](https://github.com/iotaledger/twin-blob-storage/compare/blob-storage-service-v0.0.3-next.3...blob-storage-service-v0.0.3-next.4) (2026-01-23)
|
|
38
70
|
|
|
39
71
|
|
|
40
72
|
### Features
|
|
41
73
|
|
|
42
|
-
* replace nextItem property with Link header ([#37](https://github.com/
|
|
74
|
+
* 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))
|
|
43
75
|
|
|
44
76
|
|
|
45
77
|
### Dependencies
|
|
@@ -50,12 +82,12 @@
|
|
|
50
82
|
* devDependencies
|
|
51
83
|
* @twin.org/blob-storage-connector-memory bumped from 0.0.3-next.3 to 0.0.3-next.4
|
|
52
84
|
|
|
53
|
-
## [0.0.3-next.3](https://github.com/
|
|
85
|
+
## [0.0.3-next.3](https://github.com/iotaledger/twin-blob-storage/compare/blob-storage-service-v0.0.3-next.2...blob-storage-service-v0.0.3-next.3) (2026-01-21)
|
|
54
86
|
|
|
55
87
|
|
|
56
88
|
### Features
|
|
57
89
|
|
|
58
|
-
* update contexts ([#34](https://github.com/
|
|
90
|
+
* update contexts ([#34](https://github.com/iotaledger/twin-blob-storage/issues/34)) ([b9e432c](https://github.com/iotaledger/twin-blob-storage/commit/b9e432c26025e4bfdf5ba837516dfdbf40f45a61))
|
|
59
91
|
|
|
60
92
|
|
|
61
93
|
### Dependencies
|
|
@@ -66,17 +98,17 @@
|
|
|
66
98
|
* devDependencies
|
|
67
99
|
* @twin.org/blob-storage-connector-memory bumped from 0.0.3-next.2 to 0.0.3-next.3
|
|
68
100
|
|
|
69
|
-
## [0.0.3-next.2](https://github.com/
|
|
101
|
+
## [0.0.3-next.2](https://github.com/iotaledger/twin-blob-storage/compare/blob-storage-service-v0.0.3-next.1...blob-storage-service-v0.0.3-next.2) (2026-01-14)
|
|
70
102
|
|
|
71
103
|
|
|
72
104
|
### Features
|
|
73
105
|
|
|
74
|
-
* update contexts and namespaces ([#32](https://github.com/
|
|
106
|
+
* update contexts and namespaces ([#32](https://github.com/iotaledger/twin-blob-storage/issues/32)) ([187ed36](https://github.com/iotaledger/twin-blob-storage/commit/187ed36a7d83062665f70689ec5e2b2f553a592e))
|
|
75
107
|
|
|
76
108
|
|
|
77
109
|
### Bug Fixes
|
|
78
110
|
|
|
79
|
-
* api docs ([0f5d3ad](https://github.com/
|
|
111
|
+
* api docs ([0f5d3ad](https://github.com/iotaledger/twin-blob-storage/commit/0f5d3ad88c4c048495ffd64886d00ceb25a976d6))
|
|
80
112
|
|
|
81
113
|
|
|
82
114
|
### Dependencies
|
|
@@ -87,29 +119,29 @@
|
|
|
87
119
|
* devDependencies
|
|
88
120
|
* @twin.org/blob-storage-connector-memory bumped from 0.0.3-next.1 to 0.0.3-next.2
|
|
89
121
|
|
|
90
|
-
## [0.0.3-next.1](https://github.com/
|
|
122
|
+
## [0.0.3-next.1](https://github.com/iotaledger/twin-blob-storage/compare/blob-storage-service-v0.0.3-next.0...blob-storage-service-v0.0.3-next.1) (2025-11-11)
|
|
91
123
|
|
|
92
124
|
|
|
93
125
|
### Features
|
|
94
126
|
|
|
95
|
-
* add compression support ([67d239b](https://github.com/
|
|
96
|
-
* add context id features ([#30](https://github.com/
|
|
97
|
-
* add validate-locales ([f20fcec](https://github.com/
|
|
98
|
-
* additional encryption options on per item basis ([4b95a65](https://github.com/
|
|
99
|
-
* eslint migration to flat config ([e4239dd](https://github.com/
|
|
100
|
-
* remove includeNodeIdentity flag ([13bc334](https://github.com/
|
|
101
|
-
* remove unused namespace ([6376433](https://github.com/
|
|
102
|
-
* update dependencies ([56f0094](https://github.com/
|
|
103
|
-
* update framework core ([ff339fe](https://github.com/
|
|
104
|
-
* update to support fully qualified data type names ([3297d69](https://github.com/
|
|
105
|
-
* use shared store mechanism ([#12](https://github.com/
|
|
106
|
-
* use standard list json ld types ([d6bdfd6](https://github.com/
|
|
127
|
+
* add compression support ([67d239b](https://github.com/iotaledger/twin-blob-storage/commit/67d239bca8321bd90bf4ff93167c564130309730))
|
|
128
|
+
* add context id features ([#30](https://github.com/iotaledger/twin-blob-storage/issues/30)) ([fbf1c92](https://github.com/iotaledger/twin-blob-storage/commit/fbf1c9276424c841ef5ef3f4de8469ab3fba7e9c))
|
|
129
|
+
* add validate-locales ([f20fcec](https://github.com/iotaledger/twin-blob-storage/commit/f20fceced91e39a0c9edb770b2e43ce944c92f3c))
|
|
130
|
+
* additional encryption options on per item basis ([4b95a65](https://github.com/iotaledger/twin-blob-storage/commit/4b95a656d19e3b571cea905e36f29b679b13e1e8))
|
|
131
|
+
* eslint migration to flat config ([e4239dd](https://github.com/iotaledger/twin-blob-storage/commit/e4239dd1c721955cff7f0357255d2bba15319972))
|
|
132
|
+
* remove includeNodeIdentity flag ([13bc334](https://github.com/iotaledger/twin-blob-storage/commit/13bc33445b179879688af3c98e8be8a5609d3f46))
|
|
133
|
+
* remove unused namespace ([6376433](https://github.com/iotaledger/twin-blob-storage/commit/637643399ffa42dbf6af07e7579e82e392ac90c9))
|
|
134
|
+
* update dependencies ([56f0094](https://github.com/iotaledger/twin-blob-storage/commit/56f0094b68d8bd22864cd899ac1b61d95540f719))
|
|
135
|
+
* update framework core ([ff339fe](https://github.com/iotaledger/twin-blob-storage/commit/ff339fe7e3f09ddff429907834bdf43617e9c05e))
|
|
136
|
+
* update to support fully qualified data type names ([3297d69](https://github.com/iotaledger/twin-blob-storage/commit/3297d69d332058b0f0141002087f56ba230620e1))
|
|
137
|
+
* use shared store mechanism ([#12](https://github.com/iotaledger/twin-blob-storage/issues/12)) ([cae8110](https://github.com/iotaledger/twin-blob-storage/commit/cae8110681847a1ac4fcac968b8196694e49c320))
|
|
138
|
+
* use standard list json ld types ([d6bdfd6](https://github.com/iotaledger/twin-blob-storage/commit/d6bdfd68af47f70f3cc53658b4a12543497e1f48))
|
|
107
139
|
|
|
108
140
|
|
|
109
141
|
### Bug Fixes
|
|
110
142
|
|
|
111
|
-
* Adding the optional flag to the entity ([#10](https://github.com/
|
|
112
|
-
* query params force coercion ([a5e547a](https://github.com/
|
|
143
|
+
* Adding the optional flag to the entity ([#10](https://github.com/iotaledger/twin-blob-storage/issues/10)) ([626677e](https://github.com/iotaledger/twin-blob-storage/commit/626677e5730d23535a0eb1f36f8394d941ff2447))
|
|
144
|
+
* query params force coercion ([a5e547a](https://github.com/iotaledger/twin-blob-storage/commit/a5e547a775f8997cb04780938c7a9561ddb048d1))
|
|
113
145
|
|
|
114
146
|
|
|
115
147
|
### Dependencies
|
|
@@ -120,12 +152,12 @@
|
|
|
120
152
|
* devDependencies
|
|
121
153
|
* @twin.org/blob-storage-connector-memory bumped from 0.0.3-next.0 to 0.0.3-next.1
|
|
122
154
|
|
|
123
|
-
## [0.0.2-next.5](https://github.com/
|
|
155
|
+
## [0.0.2-next.5](https://github.com/iotaledger/twin-blob-storage/compare/blob-storage-service-v0.0.2-next.4...blob-storage-service-v0.0.2-next.5) (2025-10-09)
|
|
124
156
|
|
|
125
157
|
|
|
126
158
|
### Features
|
|
127
159
|
|
|
128
|
-
* add validate-locales ([f20fcec](https://github.com/
|
|
160
|
+
* add validate-locales ([f20fcec](https://github.com/iotaledger/twin-blob-storage/commit/f20fceced91e39a0c9edb770b2e43ce944c92f3c))
|
|
129
161
|
|
|
130
162
|
|
|
131
163
|
### Dependencies
|
|
@@ -136,7 +168,7 @@
|
|
|
136
168
|
* devDependencies
|
|
137
169
|
* @twin.org/blob-storage-connector-memory bumped from 0.0.2-next.4 to 0.0.2-next.5
|
|
138
170
|
|
|
139
|
-
## [0.0.2-next.4](https://github.com/
|
|
171
|
+
## [0.0.2-next.4](https://github.com/iotaledger/twin-blob-storage/compare/blob-storage-service-v0.0.2-next.3...blob-storage-service-v0.0.2-next.4) (2025-10-02)
|
|
140
172
|
|
|
141
173
|
|
|
142
174
|
### Miscellaneous Chores
|
|
@@ -152,12 +184,12 @@
|
|
|
152
184
|
* devDependencies
|
|
153
185
|
* @twin.org/blob-storage-connector-memory bumped from 0.0.2-next.3 to 0.0.2-next.4
|
|
154
186
|
|
|
155
|
-
## [0.0.2-next.3](https://github.com/
|
|
187
|
+
## [0.0.2-next.3](https://github.com/iotaledger/twin-blob-storage/compare/blob-storage-service-v0.0.2-next.2...blob-storage-service-v0.0.2-next.3) (2025-08-29)
|
|
156
188
|
|
|
157
189
|
|
|
158
190
|
### Features
|
|
159
191
|
|
|
160
|
-
* eslint migration to flat config ([e4239dd](https://github.com/
|
|
192
|
+
* eslint migration to flat config ([e4239dd](https://github.com/iotaledger/twin-blob-storage/commit/e4239dd1c721955cff7f0357255d2bba15319972))
|
|
161
193
|
|
|
162
194
|
|
|
163
195
|
### Dependencies
|
|
@@ -168,12 +200,12 @@
|
|
|
168
200
|
* devDependencies
|
|
169
201
|
* @twin.org/blob-storage-connector-memory bumped from 0.0.2-next.2 to 0.0.2-next.3
|
|
170
202
|
|
|
171
|
-
## [0.0.2-next.2](https://github.com/
|
|
203
|
+
## [0.0.2-next.2](https://github.com/iotaledger/twin-blob-storage/compare/blob-storage-service-v0.0.2-next.1...blob-storage-service-v0.0.2-next.2) (2025-08-20)
|
|
172
204
|
|
|
173
205
|
|
|
174
206
|
### Features
|
|
175
207
|
|
|
176
|
-
* update framework core ([ff339fe](https://github.com/
|
|
208
|
+
* update framework core ([ff339fe](https://github.com/iotaledger/twin-blob-storage/commit/ff339fe7e3f09ddff429907834bdf43617e9c05e))
|
|
177
209
|
|
|
178
210
|
|
|
179
211
|
### Dependencies
|
|
@@ -184,25 +216,25 @@
|
|
|
184
216
|
* devDependencies
|
|
185
217
|
* @twin.org/blob-storage-connector-memory bumped from 0.0.2-next.1 to 0.0.2-next.2
|
|
186
218
|
|
|
187
|
-
## [0.0.2-next.1](https://github.com/
|
|
219
|
+
## [0.0.2-next.1](https://github.com/iotaledger/twin-blob-storage/compare/blob-storage-service-v0.0.2-next.0...blob-storage-service-v0.0.2-next.1) (2025-07-24)
|
|
188
220
|
|
|
189
221
|
|
|
190
222
|
### Features
|
|
191
223
|
|
|
192
|
-
* add compression support ([67d239b](https://github.com/
|
|
193
|
-
* additional encryption options on per item basis ([4b95a65](https://github.com/
|
|
194
|
-
* remove includeNodeIdentity flag ([13bc334](https://github.com/
|
|
195
|
-
* remove unused namespace ([6376433](https://github.com/
|
|
196
|
-
* update dependencies ([56f0094](https://github.com/
|
|
197
|
-
* update to support fully qualified data type names ([3297d69](https://github.com/
|
|
198
|
-
* use shared store mechanism ([#12](https://github.com/
|
|
199
|
-
* use standard list json ld types ([d6bdfd6](https://github.com/
|
|
224
|
+
* add compression support ([67d239b](https://github.com/iotaledger/twin-blob-storage/commit/67d239bca8321bd90bf4ff93167c564130309730))
|
|
225
|
+
* additional encryption options on per item basis ([4b95a65](https://github.com/iotaledger/twin-blob-storage/commit/4b95a656d19e3b571cea905e36f29b679b13e1e8))
|
|
226
|
+
* remove includeNodeIdentity flag ([13bc334](https://github.com/iotaledger/twin-blob-storage/commit/13bc33445b179879688af3c98e8be8a5609d3f46))
|
|
227
|
+
* remove unused namespace ([6376433](https://github.com/iotaledger/twin-blob-storage/commit/637643399ffa42dbf6af07e7579e82e392ac90c9))
|
|
228
|
+
* update dependencies ([56f0094](https://github.com/iotaledger/twin-blob-storage/commit/56f0094b68d8bd22864cd899ac1b61d95540f719))
|
|
229
|
+
* update to support fully qualified data type names ([3297d69](https://github.com/iotaledger/twin-blob-storage/commit/3297d69d332058b0f0141002087f56ba230620e1))
|
|
230
|
+
* use shared store mechanism ([#12](https://github.com/iotaledger/twin-blob-storage/issues/12)) ([cae8110](https://github.com/iotaledger/twin-blob-storage/commit/cae8110681847a1ac4fcac968b8196694e49c320))
|
|
231
|
+
* use standard list json ld types ([d6bdfd6](https://github.com/iotaledger/twin-blob-storage/commit/d6bdfd68af47f70f3cc53658b4a12543497e1f48))
|
|
200
232
|
|
|
201
233
|
|
|
202
234
|
### Bug Fixes
|
|
203
235
|
|
|
204
|
-
* Adding the optional flag to the entity ([#10](https://github.com/
|
|
205
|
-
* query params force coercion ([a5e547a](https://github.com/
|
|
236
|
+
* Adding the optional flag to the entity ([#10](https://github.com/iotaledger/twin-blob-storage/issues/10)) ([626677e](https://github.com/iotaledger/twin-blob-storage/commit/626677e5730d23535a0eb1f36f8394d941ff2447))
|
|
237
|
+
* query params force coercion ([a5e547a](https://github.com/iotaledger/twin-blob-storage/commit/a5e547a775f8997cb04780938c7a9561ddb048d1))
|
|
206
238
|
|
|
207
239
|
|
|
208
240
|
### Dependencies
|
|
@@ -218,7 +250,7 @@
|
|
|
218
250
|
|
|
219
251
|
### Features
|
|
220
252
|
|
|
221
|
-
* release to production ([eacfe75](https://github.com/
|
|
253
|
+
* release to production ([eacfe75](https://github.com/iotaledger/twin-blob-storage/commit/eacfe754a0dcd9243d9e13d86422327d0a605164))
|
|
222
254
|
|
|
223
255
|
|
|
224
256
|
### Dependencies
|
|
@@ -229,12 +261,12 @@
|
|
|
229
261
|
* devDependencies
|
|
230
262
|
* @twin.org/blob-storage-connector-memory bumped from ^0.0.0 to ^0.0.1
|
|
231
263
|
|
|
232
|
-
## [0.0.1-next.37](https://github.com/
|
|
264
|
+
## [0.0.1-next.37](https://github.com/iotaledger/twin-blob-storage/compare/blob-storage-service-v0.0.1-next.36...blob-storage-service-v0.0.1-next.37) (2025-06-20)
|
|
233
265
|
|
|
234
266
|
|
|
235
267
|
### Bug Fixes
|
|
236
268
|
|
|
237
|
-
* query params force coercion ([a5e547a](https://github.com/
|
|
269
|
+
* query params force coercion ([a5e547a](https://github.com/iotaledger/twin-blob-storage/commit/a5e547a775f8997cb04780938c7a9561ddb048d1))
|
|
238
270
|
|
|
239
271
|
|
|
240
272
|
### Dependencies
|
|
@@ -245,12 +277,12 @@
|
|
|
245
277
|
* devDependencies
|
|
246
278
|
* @twin.org/blob-storage-connector-memory bumped from 0.0.1-next.36 to 0.0.1-next.37
|
|
247
279
|
|
|
248
|
-
## [0.0.1-next.36](https://github.com/
|
|
280
|
+
## [0.0.1-next.36](https://github.com/iotaledger/twin-blob-storage/compare/blob-storage-service-v0.0.1-next.35...blob-storage-service-v0.0.1-next.36) (2025-06-19)
|
|
249
281
|
|
|
250
282
|
|
|
251
283
|
### Features
|
|
252
284
|
|
|
253
|
-
* add compression support ([67d239b](https://github.com/
|
|
285
|
+
* add compression support ([67d239b](https://github.com/iotaledger/twin-blob-storage/commit/67d239bca8321bd90bf4ff93167c564130309730))
|
|
254
286
|
|
|
255
287
|
|
|
256
288
|
### Dependencies
|
|
@@ -261,12 +293,12 @@
|
|
|
261
293
|
* devDependencies
|
|
262
294
|
* @twin.org/blob-storage-connector-memory bumped from 0.0.1-next.35 to 0.0.1-next.36
|
|
263
295
|
|
|
264
|
-
## [0.0.1-next.35](https://github.com/
|
|
296
|
+
## [0.0.1-next.35](https://github.com/iotaledger/twin-blob-storage/compare/blob-storage-service-v0.0.1-next.34...blob-storage-service-v0.0.1-next.35) (2025-06-17)
|
|
265
297
|
|
|
266
298
|
|
|
267
299
|
### Features
|
|
268
300
|
|
|
269
|
-
* additional encryption options on per item basis ([4b95a65](https://github.com/
|
|
301
|
+
* additional encryption options on per item basis ([4b95a65](https://github.com/iotaledger/twin-blob-storage/commit/4b95a656d19e3b571cea905e36f29b679b13e1e8))
|
|
270
302
|
|
|
271
303
|
|
|
272
304
|
### Dependencies
|
|
@@ -277,12 +309,12 @@
|
|
|
277
309
|
* devDependencies
|
|
278
310
|
* @twin.org/blob-storage-connector-memory bumped from 0.0.1-next.34 to 0.0.1-next.35
|
|
279
311
|
|
|
280
|
-
## [0.0.1-next.34](https://github.com/
|
|
312
|
+
## [0.0.1-next.34](https://github.com/iotaledger/twin-blob-storage/compare/blob-storage-service-v0.0.1-next.33...blob-storage-service-v0.0.1-next.34) (2025-06-12)
|
|
281
313
|
|
|
282
314
|
|
|
283
315
|
### Features
|
|
284
316
|
|
|
285
|
-
* update dependencies ([56f0094](https://github.com/
|
|
317
|
+
* update dependencies ([56f0094](https://github.com/iotaledger/twin-blob-storage/commit/56f0094b68d8bd22864cd899ac1b61d95540f719))
|
|
286
318
|
|
|
287
319
|
|
|
288
320
|
### Dependencies
|
|
@@ -293,7 +325,7 @@
|
|
|
293
325
|
* devDependencies
|
|
294
326
|
* @twin.org/blob-storage-connector-memory bumped from 0.0.1-next.33 to 0.0.1-next.34
|
|
295
327
|
|
|
296
|
-
## [0.0.1-next.33](https://github.com/
|
|
328
|
+
## [0.0.1-next.33](https://github.com/iotaledger/twin-blob-storage/compare/blob-storage-service-v0.0.1-next.32...blob-storage-service-v0.0.1-next.33) (2025-06-03)
|
|
297
329
|
|
|
298
330
|
|
|
299
331
|
### Miscellaneous Chores
|
|
@@ -309,12 +341,12 @@
|
|
|
309
341
|
* devDependencies
|
|
310
342
|
* @twin.org/blob-storage-connector-memory bumped from 0.0.1-next.32 to 0.0.1-next.33
|
|
311
343
|
|
|
312
|
-
## [0.0.1-next.32](https://github.com/
|
|
344
|
+
## [0.0.1-next.32](https://github.com/iotaledger/twin-blob-storage/compare/blob-storage-service-v0.0.1-next.31...blob-storage-service-v0.0.1-next.32) (2025-05-28)
|
|
313
345
|
|
|
314
346
|
|
|
315
347
|
### Features
|
|
316
348
|
|
|
317
|
-
* update to support fully qualified data type names ([3297d69](https://github.com/
|
|
349
|
+
* update to support fully qualified data type names ([3297d69](https://github.com/iotaledger/twin-blob-storage/commit/3297d69d332058b0f0141002087f56ba230620e1))
|
|
318
350
|
|
|
319
351
|
|
|
320
352
|
### Dependencies
|
|
@@ -325,12 +357,12 @@
|
|
|
325
357
|
* devDependencies
|
|
326
358
|
* @twin.org/blob-storage-connector-memory bumped from 0.0.1-next.31 to 0.0.1-next.32
|
|
327
359
|
|
|
328
|
-
## [0.0.1-next.31](https://github.com/
|
|
360
|
+
## [0.0.1-next.31](https://github.com/iotaledger/twin-blob-storage/compare/blob-storage-service-v0.0.1-next.30...blob-storage-service-v0.0.1-next.31) (2025-05-08)
|
|
329
361
|
|
|
330
362
|
|
|
331
363
|
### Features
|
|
332
364
|
|
|
333
|
-
* use standard list json ld types ([d6bdfd6](https://github.com/
|
|
365
|
+
* use standard list json ld types ([d6bdfd6](https://github.com/iotaledger/twin-blob-storage/commit/d6bdfd68af47f70f3cc53658b4a12543497e1f48))
|
|
334
366
|
|
|
335
367
|
|
|
336
368
|
### Dependencies
|
|
@@ -341,12 +373,12 @@
|
|
|
341
373
|
* devDependencies
|
|
342
374
|
* @twin.org/blob-storage-connector-memory bumped from 0.0.1-next.30 to 0.0.1-next.31
|
|
343
375
|
|
|
344
|
-
## [0.0.1-next.30](https://github.com/
|
|
376
|
+
## [0.0.1-next.30](https://github.com/iotaledger/twin-blob-storage/compare/blob-storage-service-v0.0.1-next.29...blob-storage-service-v0.0.1-next.30) (2025-04-17)
|
|
345
377
|
|
|
346
378
|
|
|
347
379
|
### Features
|
|
348
380
|
|
|
349
|
-
* use shared store mechanism ([#12](https://github.com/
|
|
381
|
+
* use shared store mechanism ([#12](https://github.com/iotaledger/twin-blob-storage/issues/12)) ([cae8110](https://github.com/iotaledger/twin-blob-storage/commit/cae8110681847a1ac4fcac968b8196694e49c320))
|
|
350
382
|
|
|
351
383
|
|
|
352
384
|
### Dependencies
|
|
@@ -357,12 +389,12 @@
|
|
|
357
389
|
* devDependencies
|
|
358
390
|
* @twin.org/blob-storage-connector-memory bumped from 0.0.1-next.29 to 0.0.1-next.30
|
|
359
391
|
|
|
360
|
-
## [0.0.1-next.29](https://github.com/
|
|
392
|
+
## [0.0.1-next.29](https://github.com/iotaledger/twin-blob-storage/compare/blob-storage-service-v0.0.1-next.28...blob-storage-service-v0.0.1-next.29) (2025-03-28)
|
|
361
393
|
|
|
362
394
|
|
|
363
395
|
### Bug Fixes
|
|
364
396
|
|
|
365
|
-
* Adding the optional flag to the entity ([#10](https://github.com/
|
|
397
|
+
* Adding the optional flag to the entity ([#10](https://github.com/iotaledger/twin-blob-storage/issues/10)) ([626677e](https://github.com/iotaledger/twin-blob-storage/commit/626677e5730d23535a0eb1f36f8394d941ff2447))
|
|
366
398
|
|
|
367
399
|
|
|
368
400
|
### Dependencies
|
package/docs/examples.md
CHANGED
|
@@ -1 +1,109 @@
|
|
|
1
|
-
#
|
|
1
|
+
# Service Examples
|
|
2
|
+
|
|
3
|
+
Use these snippets to create metadata-rich entries, retrieve stored content, and keep catalogue data consistent over time.
|
|
4
|
+
|
|
5
|
+
## BlobStorageService
|
|
6
|
+
|
|
7
|
+
```typescript
|
|
8
|
+
import { BlobStorageService } from '@twin.org/blob-storage-service';
|
|
9
|
+
|
|
10
|
+
const service = new BlobStorageService({
|
|
11
|
+
config: {
|
|
12
|
+
defaultNamespace: 'memory',
|
|
13
|
+
vaultKeyId: 'tenant-main'
|
|
14
|
+
}
|
|
15
|
+
});
|
|
16
|
+
|
|
17
|
+
console.log(service.className()); // BlobStorageService
|
|
18
|
+
```
|
|
19
|
+
|
|
20
|
+
```typescript
|
|
21
|
+
import { BlobStorageService } from '@twin.org/blob-storage-service';
|
|
22
|
+
|
|
23
|
+
const service = new BlobStorageService({
|
|
24
|
+
config: {
|
|
25
|
+
defaultNamespace: 'memory'
|
|
26
|
+
}
|
|
27
|
+
});
|
|
28
|
+
|
|
29
|
+
const blobId = await service.create(
|
|
30
|
+
'SGVsbG8gVFdJTiE=',
|
|
31
|
+
'text/plain',
|
|
32
|
+
'txt',
|
|
33
|
+
{
|
|
34
|
+
'@context': 'https://schema.org',
|
|
35
|
+
type: 'DigitalDocument',
|
|
36
|
+
name: 'welcome-note'
|
|
37
|
+
},
|
|
38
|
+
{
|
|
39
|
+
disableEncryption: true,
|
|
40
|
+
namespace: 'memory'
|
|
41
|
+
}
|
|
42
|
+
);
|
|
43
|
+
console.log(blobId); // blob:urn:blob:memory:...
|
|
44
|
+
|
|
45
|
+
const blobEntry = await service.get(blobId, { includeContent: true, decompress: true });
|
|
46
|
+
console.log(blobEntry.blobSize); // 11
|
|
47
|
+
```
|
|
48
|
+
|
|
49
|
+
```typescript
|
|
50
|
+
import { BlobStorageService } from '@twin.org/blob-storage-service';
|
|
51
|
+
|
|
52
|
+
const service = new BlobStorageService({
|
|
53
|
+
config: {
|
|
54
|
+
defaultNamespace: 'memory'
|
|
55
|
+
}
|
|
56
|
+
});
|
|
57
|
+
|
|
58
|
+
const blobId = 'blob:urn:blob:memory:7f83b1657ff1fc53';
|
|
59
|
+
await service.update(blobId, 'text/markdown', 'md', {
|
|
60
|
+
'@context': 'https://schema.org',
|
|
61
|
+
type: 'DigitalDocument',
|
|
62
|
+
name: 'release-notes'
|
|
63
|
+
});
|
|
64
|
+
console.log(blobId); // blob:urn:blob:memory:7f83b1657ff1fc53
|
|
65
|
+
|
|
66
|
+
const result = await service.query(
|
|
67
|
+
{
|
|
68
|
+
logicalOperator: 'and',
|
|
69
|
+
conditions: [
|
|
70
|
+
{
|
|
71
|
+
property: 'encodingFormat',
|
|
72
|
+
comparison: 'equals',
|
|
73
|
+
value: 'text/markdown'
|
|
74
|
+
}
|
|
75
|
+
]
|
|
76
|
+
},
|
|
77
|
+
'dateCreated',
|
|
78
|
+
'descending',
|
|
79
|
+
'eyJwYWdlIjoyfQ==',
|
|
80
|
+
10
|
|
81
|
+
);
|
|
82
|
+
console.log(result.entries.itemListElement.length); // 1
|
|
83
|
+
|
|
84
|
+
await service.remove(blobId);
|
|
85
|
+
console.log(blobId); // blob:urn:blob:memory:7f83b1657ff1fc53
|
|
86
|
+
```
|
|
87
|
+
|
|
88
|
+
## BlobStorageEntry
|
|
89
|
+
|
|
90
|
+
```typescript
|
|
91
|
+
import type { BlobStorageEntry } from '@twin.org/blob-storage-service';
|
|
92
|
+
|
|
93
|
+
const entry: BlobStorageEntry = {
|
|
94
|
+
id: 'blob:urn:blob:memory:7f83b1657ff1fc53',
|
|
95
|
+
dateCreated: '2026-03-09T12:00:00.000Z',
|
|
96
|
+
blobSize: 2048,
|
|
97
|
+
integrity: 'sha256:ab45f3f0c2b13496',
|
|
98
|
+
encodingFormat: 'application/pdf',
|
|
99
|
+
fileExtension: 'pdf',
|
|
100
|
+
metadata: {
|
|
101
|
+
'@context': 'https://schema.org',
|
|
102
|
+
type: 'DigitalDocument',
|
|
103
|
+
name: 'invoice-2026-03'
|
|
104
|
+
},
|
|
105
|
+
isEncrypted: false
|
|
106
|
+
};
|
|
107
|
+
|
|
108
|
+
console.log(entry.encodingFormat); // application/pdf
|
|
109
|
+
```
|
package/docs/open-api/spec.json
CHANGED
|
@@ -149,7 +149,6 @@
|
|
|
149
149
|
"in": "query",
|
|
150
150
|
"required": false,
|
|
151
151
|
"schema": {
|
|
152
|
-
"type": "string",
|
|
153
152
|
"enum": [
|
|
154
153
|
"dateCreated",
|
|
155
154
|
"dateModified"
|
|
@@ -227,7 +226,7 @@
|
|
|
227
226
|
"dateCreated": "2024-01-01T00:00:00Z",
|
|
228
227
|
"encodingFormat": "application/pdf",
|
|
229
228
|
"blobSize": 42,
|
|
230
|
-
"integrity": "sha256-
|
|
229
|
+
"integrity": "sha256-xX2UsIj0xtLLMt7QFIExDHhqoAE0yO4i+EseJUVgKnA=",
|
|
231
230
|
"fileExtension": "pdf",
|
|
232
231
|
"metadata": {
|
|
233
232
|
"@context": "https://schema.org",
|
|
@@ -266,7 +265,7 @@
|
|
|
266
265
|
"dateCreated": "2024-01-01T00:00:00Z",
|
|
267
266
|
"encodingFormat": "application/pdf",
|
|
268
267
|
"blobSize": 42,
|
|
269
|
-
"integrity": "sha256-
|
|
268
|
+
"integrity": "sha256-xX2UsIj0xtLLMt7QFIExDHhqoAE0yO4i+EseJUVgKnA=",
|
|
270
269
|
"fileExtension": "pdf",
|
|
271
270
|
"metadata": {
|
|
272
271
|
"@context": "https://schema.org",
|
|
@@ -446,7 +445,7 @@
|
|
|
446
445
|
"dateCreated": "2024-01-01T00:00:00Z",
|
|
447
446
|
"encodingFormat": "application/pdf",
|
|
448
447
|
"blobSize": 42,
|
|
449
|
-
"integrity": "sha256-
|
|
448
|
+
"integrity": "sha256-xX2UsIj0xtLLMt7QFIExDHhqoAE0yO4i+EseJUVgKnA=",
|
|
450
449
|
"fileExtension": "pdf",
|
|
451
450
|
"metadata": {
|
|
452
451
|
"@context": "https://schema.org",
|
|
@@ -475,7 +474,7 @@
|
|
|
475
474
|
"dateCreated": "2024-01-01T00:00:00Z",
|
|
476
475
|
"encodingFormat": "application/pdf",
|
|
477
476
|
"blobSize": 42,
|
|
478
|
-
"integrity": "sha256-
|
|
477
|
+
"integrity": "sha256-xX2UsIj0xtLLMt7QFIExDHhqoAE0yO4i+EseJUVgKnA=",
|
|
479
478
|
"fileExtension": "pdf",
|
|
480
479
|
"metadata": {
|
|
481
480
|
"@context": "https://schema.org",
|
|
@@ -915,19 +914,17 @@
|
|
|
915
914
|
"components": {
|
|
916
915
|
"schemas": {
|
|
917
916
|
"BlobStorageCompressionType": {
|
|
917
|
+
"description": "The types of compression for blob storage data.",
|
|
918
918
|
"anyOf": [
|
|
919
919
|
{
|
|
920
|
-
"type": "string",
|
|
921
920
|
"const": "gzip",
|
|
922
921
|
"description": "Gzip."
|
|
923
922
|
},
|
|
924
923
|
{
|
|
925
|
-
"type": "string",
|
|
926
924
|
"const": "deflate",
|
|
927
925
|
"description": "Deflate."
|
|
928
926
|
}
|
|
929
|
-
]
|
|
930
|
-
"description": "The types of compression for blob storage data."
|
|
927
|
+
]
|
|
931
928
|
},
|
|
932
929
|
"BlobStorageCreateRequest": {
|
|
933
930
|
"type": "object",
|
|
@@ -968,32 +965,29 @@
|
|
|
968
965
|
"required": [
|
|
969
966
|
"blob"
|
|
970
967
|
],
|
|
971
|
-
"additionalProperties": false,
|
|
972
968
|
"description": "The body parameters."
|
|
973
969
|
},
|
|
974
970
|
"BlobStorageEntry": {
|
|
971
|
+
"description": "Interface describing a blob storage entry.",
|
|
975
972
|
"type": "object",
|
|
976
973
|
"properties": {
|
|
977
974
|
"@context": {
|
|
978
975
|
"type": "array",
|
|
979
|
-
"minItems": 2,
|
|
980
|
-
"description": "JSON-LD Context.",
|
|
981
976
|
"prefixItems": [
|
|
982
977
|
{
|
|
983
|
-
"type": "string",
|
|
984
978
|
"const": "https://schema.twindev.org/blob-storage/"
|
|
985
979
|
},
|
|
986
980
|
{
|
|
987
|
-
"type": "string",
|
|
988
981
|
"const": "https://schema.twindev.org/common/"
|
|
989
982
|
}
|
|
990
983
|
],
|
|
991
984
|
"items": {
|
|
992
985
|
"$ref": "https://schema.twindev.org/json-ld/JsonLdContextDefinitionElement"
|
|
993
|
-
}
|
|
986
|
+
},
|
|
987
|
+
"minItems": 2,
|
|
988
|
+
"description": "JSON-LD Context."
|
|
994
989
|
},
|
|
995
990
|
"type": {
|
|
996
|
-
"type": "string",
|
|
997
991
|
"const": "BlobStorageEntry",
|
|
998
992
|
"description": "JSON-LD Type."
|
|
999
993
|
},
|
|
@@ -1003,41 +997,41 @@
|
|
|
1003
997
|
},
|
|
1004
998
|
"dateCreated": {
|
|
1005
999
|
"type": "string",
|
|
1006
|
-
"description": "The date/time when the entry was created.
|
|
1000
|
+
"description": "The date/time when the entry was created."
|
|
1007
1001
|
},
|
|
1008
1002
|
"dateModified": {
|
|
1009
1003
|
"type": "string",
|
|
1010
|
-
"description": "The date/time when the entry was modified.
|
|
1004
|
+
"description": "The date/time when the entry was modified."
|
|
1011
1005
|
},
|
|
1012
1006
|
"blobSize": {
|
|
1013
1007
|
"type": "number",
|
|
1014
|
-
"description": "The size of the data in the blob.
|
|
1008
|
+
"description": "The size of the data in the blob."
|
|
1015
1009
|
},
|
|
1016
1010
|
"integrity": {
|
|
1017
1011
|
"type": "string",
|
|
1018
|
-
"description": "The integrity of the data in the blob.
|
|
1012
|
+
"description": "The integrity of the data in the blob."
|
|
1019
1013
|
},
|
|
1020
1014
|
"encodingFormat": {
|
|
1021
1015
|
"type": "string",
|
|
1022
|
-
"description": "The mime type for the blob.
|
|
1016
|
+
"description": "The mime type for the blob."
|
|
1023
1017
|
},
|
|
1024
1018
|
"isEncrypted": {
|
|
1025
1019
|
"type": "boolean",
|
|
1026
|
-
"description": "Indicates if the blob is encrypted.
|
|
1020
|
+
"description": "Indicates if the blob is encrypted."
|
|
1027
1021
|
},
|
|
1028
1022
|
"compression": {
|
|
1029
1023
|
"$ref": "#/components/schemas/BlobStorageCompressionType"
|
|
1030
1024
|
},
|
|
1031
1025
|
"fileExtension": {
|
|
1032
1026
|
"type": "string",
|
|
1033
|
-
"description": "The extension.
|
|
1027
|
+
"description": "The extension."
|
|
1034
1028
|
},
|
|
1035
1029
|
"metadata": {
|
|
1036
1030
|
"$ref": "https://schema.twindev.org/json-ld/JsonLdNodeObject"
|
|
1037
1031
|
},
|
|
1038
1032
|
"blob": {
|
|
1039
1033
|
"type": "string",
|
|
1040
|
-
"description": "The blob in base64 format, included if the includeContent flag was set in the request.
|
|
1034
|
+
"description": "The blob in base64 format, included if the includeContent flag was set in the request."
|
|
1041
1035
|
}
|
|
1042
1036
|
},
|
|
1043
1037
|
"required": [
|
|
@@ -1047,37 +1041,32 @@
|
|
|
1047
1041
|
"dateCreated",
|
|
1048
1042
|
"blobSize",
|
|
1049
1043
|
"integrity"
|
|
1050
|
-
]
|
|
1051
|
-
"additionalProperties": false,
|
|
1052
|
-
"description": "Interface describing a blob storage entry."
|
|
1044
|
+
]
|
|
1053
1045
|
},
|
|
1054
1046
|
"BlobStorageEntryList": {
|
|
1047
|
+
"description": "Interface describing an blob storage entry list.",
|
|
1055
1048
|
"type": "object",
|
|
1056
1049
|
"properties": {
|
|
1057
1050
|
"@context": {
|
|
1058
1051
|
"type": "array",
|
|
1059
|
-
"minItems": 3,
|
|
1060
|
-
"description": "JSON-LD Context.",
|
|
1061
1052
|
"prefixItems": [
|
|
1062
1053
|
{
|
|
1063
|
-
"type": "string",
|
|
1064
1054
|
"const": "https://schema.org"
|
|
1065
1055
|
},
|
|
1066
1056
|
{
|
|
1067
|
-
"type": "string",
|
|
1068
1057
|
"const": "https://schema.twindev.org/blob-storage/"
|
|
1069
1058
|
},
|
|
1070
1059
|
{
|
|
1071
|
-
"type": "string",
|
|
1072
1060
|
"const": "https://schema.twindev.org/common/"
|
|
1073
1061
|
}
|
|
1074
1062
|
],
|
|
1075
1063
|
"items": {
|
|
1076
1064
|
"$ref": "https://schema.twindev.org/json-ld/JsonLdContextDefinitionElement"
|
|
1077
|
-
}
|
|
1065
|
+
},
|
|
1066
|
+
"minItems": 3,
|
|
1067
|
+
"description": "JSON-LD Context."
|
|
1078
1068
|
},
|
|
1079
1069
|
"type": {
|
|
1080
|
-
"type": "string",
|
|
1081
1070
|
"const": "ItemList",
|
|
1082
1071
|
"description": "JSON-LD Type."
|
|
1083
1072
|
},
|
|
@@ -1093,9 +1082,7 @@
|
|
|
1093
1082
|
"@context",
|
|
1094
1083
|
"type",
|
|
1095
1084
|
"itemListElement"
|
|
1096
|
-
]
|
|
1097
|
-
"additionalProperties": false,
|
|
1098
|
-
"description": "Interface describing an blob storage entry list."
|
|
1085
|
+
]
|
|
1099
1086
|
},
|
|
1100
1087
|
"BlobStorageUpdateRequest": {
|
|
1101
1088
|
"type": "object",
|
|
@@ -1112,10 +1099,10 @@
|
|
|
1112
1099
|
"$ref": "https://schema.twindev.org/json-ld/JsonLdNodeObject"
|
|
1113
1100
|
}
|
|
1114
1101
|
},
|
|
1115
|
-
"additionalProperties": false,
|
|
1116
1102
|
"description": "The body parameters."
|
|
1117
1103
|
},
|
|
1118
1104
|
"Error": {
|
|
1105
|
+
"description": "Model to describe serialized error.",
|
|
1119
1106
|
"type": "object",
|
|
1120
1107
|
"properties": {
|
|
1121
1108
|
"name": {
|
|
@@ -1124,7 +1111,7 @@
|
|
|
1124
1111
|
},
|
|
1125
1112
|
"message": {
|
|
1126
1113
|
"type": "string",
|
|
1127
|
-
"description": "The message for the error."
|
|
1114
|
+
"description": "The message for the error as an i18n key."
|
|
1128
1115
|
},
|
|
1129
1116
|
"source": {
|
|
1130
1117
|
"type": "string",
|
|
@@ -1146,63 +1133,35 @@
|
|
|
1146
1133
|
"required": [
|
|
1147
1134
|
"name",
|
|
1148
1135
|
"message"
|
|
1149
|
-
]
|
|
1150
|
-
"additionalProperties": false,
|
|
1151
|
-
"description": "Model to describe serialized error."
|
|
1136
|
+
]
|
|
1152
1137
|
},
|
|
1153
1138
|
"NotFoundResponse": {
|
|
1154
1139
|
"type": "object",
|
|
1155
|
-
"additionalProperties": false,
|
|
1156
1140
|
"properties": {
|
|
1157
1141
|
"notFoundId": {
|
|
1158
1142
|
"type": "string",
|
|
1159
1143
|
"description": "The id if the item that was not found."
|
|
1160
|
-
},
|
|
1161
|
-
"name": {
|
|
1162
|
-
"type": "string",
|
|
1163
|
-
"description": "The name for the error."
|
|
1164
|
-
},
|
|
1165
|
-
"message": {
|
|
1166
|
-
"type": "string",
|
|
1167
|
-
"description": "The message for the error."
|
|
1168
|
-
},
|
|
1169
|
-
"source": {
|
|
1170
|
-
"type": "string",
|
|
1171
|
-
"description": "The source of the error."
|
|
1172
|
-
},
|
|
1173
|
-
"properties": {
|
|
1174
|
-
"type": "object",
|
|
1175
|
-
"additionalProperties": {},
|
|
1176
|
-
"description": "Any additional information for the error."
|
|
1177
|
-
},
|
|
1178
|
-
"stack": {
|
|
1179
|
-
"type": "string",
|
|
1180
|
-
"description": "The stack trace for the error."
|
|
1181
|
-
},
|
|
1182
|
-
"cause": {
|
|
1183
|
-
"$ref": "#/components/schemas/Error"
|
|
1184
1144
|
}
|
|
1185
1145
|
},
|
|
1186
|
-
"
|
|
1187
|
-
|
|
1188
|
-
|
|
1146
|
+
"allOf": [
|
|
1147
|
+
{
|
|
1148
|
+
"$ref": "#/components/schemas/Error"
|
|
1149
|
+
}
|
|
1189
1150
|
],
|
|
1190
1151
|
"description": "The body which contains the error."
|
|
1191
1152
|
},
|
|
1192
1153
|
"SortDirection": {
|
|
1154
|
+
"description": "The sort directions.",
|
|
1193
1155
|
"anyOf": [
|
|
1194
1156
|
{
|
|
1195
|
-
"type": "string",
|
|
1196
1157
|
"const": "asc",
|
|
1197
1158
|
"description": "Ascending."
|
|
1198
1159
|
},
|
|
1199
1160
|
{
|
|
1200
|
-
"type": "string",
|
|
1201
1161
|
"const": "desc",
|
|
1202
1162
|
"description": "Descending."
|
|
1203
1163
|
}
|
|
1204
|
-
]
|
|
1205
|
-
"description": "The sort directions."
|
|
1164
|
+
]
|
|
1206
1165
|
}
|
|
1207
1166
|
},
|
|
1208
1167
|
"securitySchemes": {
|
|
@@ -14,7 +14,7 @@ Class representing entry for the blob storage.
|
|
|
14
14
|
|
|
15
15
|
## Properties
|
|
16
16
|
|
|
17
|
-
### id
|
|
17
|
+
### id {#id}
|
|
18
18
|
|
|
19
19
|
> **id**: `string`
|
|
20
20
|
|
|
@@ -22,7 +22,7 @@ The id for the blob.
|
|
|
22
22
|
|
|
23
23
|
***
|
|
24
24
|
|
|
25
|
-
### dateCreated
|
|
25
|
+
### dateCreated {#datecreated}
|
|
26
26
|
|
|
27
27
|
> **dateCreated**: `string`
|
|
28
28
|
|
|
@@ -30,15 +30,15 @@ The date/time when the entry was created.
|
|
|
30
30
|
|
|
31
31
|
***
|
|
32
32
|
|
|
33
|
-
### dateModified?
|
|
33
|
+
### dateModified? {#datemodified}
|
|
34
34
|
|
|
35
|
-
> `optional` **dateModified
|
|
35
|
+
> `optional` **dateModified?**: `string`
|
|
36
36
|
|
|
37
37
|
The date/time when the entry was modified.
|
|
38
38
|
|
|
39
39
|
***
|
|
40
40
|
|
|
41
|
-
### blobSize
|
|
41
|
+
### blobSize {#blobsize}
|
|
42
42
|
|
|
43
43
|
> **blobSize**: `number`
|
|
44
44
|
|
|
@@ -46,7 +46,7 @@ The length of the data in the blob.
|
|
|
46
46
|
|
|
47
47
|
***
|
|
48
48
|
|
|
49
|
-
### integrity
|
|
49
|
+
### integrity {#integrity}
|
|
50
50
|
|
|
51
51
|
> **integrity**: `string`
|
|
52
52
|
|
|
@@ -54,31 +54,31 @@ The integrity of the data in the blob.
|
|
|
54
54
|
|
|
55
55
|
***
|
|
56
56
|
|
|
57
|
-
### encodingFormat?
|
|
57
|
+
### encodingFormat? {#encodingformat}
|
|
58
58
|
|
|
59
|
-
> `optional` **encodingFormat
|
|
59
|
+
> `optional` **encodingFormat?**: `string`
|
|
60
60
|
|
|
61
61
|
The mime type for the blob.
|
|
62
62
|
|
|
63
63
|
***
|
|
64
64
|
|
|
65
|
-
### fileExtension?
|
|
65
|
+
### fileExtension? {#fileextension}
|
|
66
66
|
|
|
67
|
-
> `optional` **fileExtension
|
|
67
|
+
> `optional` **fileExtension?**: `string`
|
|
68
68
|
|
|
69
69
|
The extension.
|
|
70
70
|
|
|
71
71
|
***
|
|
72
72
|
|
|
73
|
-
### metadata?
|
|
73
|
+
### metadata? {#metadata}
|
|
74
74
|
|
|
75
|
-
> `optional` **metadata
|
|
75
|
+
> `optional` **metadata?**: `IJsonLdNodeObject`
|
|
76
76
|
|
|
77
77
|
The metadata for the blob as JSON-LD.
|
|
78
78
|
|
|
79
79
|
***
|
|
80
80
|
|
|
81
|
-
### isEncrypted
|
|
81
|
+
### isEncrypted {#isencrypted}
|
|
82
82
|
|
|
83
83
|
> **isEncrypted**: `boolean`
|
|
84
84
|
|
|
@@ -86,8 +86,8 @@ Is the entry encrypted.
|
|
|
86
86
|
|
|
87
87
|
***
|
|
88
88
|
|
|
89
|
-
### compression?
|
|
89
|
+
### compression? {#compression}
|
|
90
90
|
|
|
91
|
-
> `optional` **compression
|
|
91
|
+
> `optional` **compression?**: `BlobStorageCompressionType`
|
|
92
92
|
|
|
93
93
|
Is the entry compressed.
|
|
@@ -28,7 +28,7 @@ The options for the service.
|
|
|
28
28
|
|
|
29
29
|
## Properties
|
|
30
30
|
|
|
31
|
-
### CLASS\_NAME
|
|
31
|
+
### CLASS\_NAME {#class_name}
|
|
32
32
|
|
|
33
33
|
> `readonly` `static` **CLASS\_NAME**: `string`
|
|
34
34
|
|
|
@@ -36,7 +36,7 @@ Runtime name for the class.
|
|
|
36
36
|
|
|
37
37
|
## Methods
|
|
38
38
|
|
|
39
|
-
### className()
|
|
39
|
+
### className() {#classname}
|
|
40
40
|
|
|
41
41
|
> **className**(): `string`
|
|
42
42
|
|
|
@@ -54,7 +54,7 @@ The class name of the component.
|
|
|
54
54
|
|
|
55
55
|
***
|
|
56
56
|
|
|
57
|
-
### create()
|
|
57
|
+
### create() {#create}
|
|
58
58
|
|
|
59
59
|
> **create**(`blob`, `encodingFormat?`, `fileExtension?`, `metadata?`, `options?`): `Promise`\<`string`\>
|
|
60
60
|
|
|
@@ -126,7 +126,7 @@ The id of the stored blob in urn format.
|
|
|
126
126
|
|
|
127
127
|
***
|
|
128
128
|
|
|
129
|
-
### get()
|
|
129
|
+
### get() {#get}
|
|
130
130
|
|
|
131
131
|
> **get**(`id`, `options?`): `Promise`\<`IBlobStorageEntry`\>
|
|
132
132
|
|
|
@@ -178,7 +178,7 @@ Not found error if the blob cannot be found.
|
|
|
178
178
|
|
|
179
179
|
***
|
|
180
180
|
|
|
181
|
-
### update()
|
|
181
|
+
### update() {#update}
|
|
182
182
|
|
|
183
183
|
> **update**(`id`, `encodingFormat?`, `fileExtension?`, `metadata?`): `Promise`\<`void`\>
|
|
184
184
|
|
|
@@ -226,7 +226,7 @@ Not found error if the blob cannot be found.
|
|
|
226
226
|
|
|
227
227
|
***
|
|
228
228
|
|
|
229
|
-
### remove()
|
|
229
|
+
### remove() {#remove}
|
|
230
230
|
|
|
231
231
|
> **remove**(`id`): `Promise`\<`void`\>
|
|
232
232
|
|
|
@@ -252,7 +252,7 @@ Nothing.
|
|
|
252
252
|
|
|
253
253
|
***
|
|
254
254
|
|
|
255
|
-
### query()
|
|
255
|
+
### query() {#query}
|
|
256
256
|
|
|
257
257
|
> **query**(`conditions?`, `orderBy?`, `orderByDirection?`, `cursor?`, `limit?`): `Promise`\<\{ `entries`: `IBlobStorageEntryList`; `cursor?`: `string`; \}\>
|
|
258
258
|
|
|
@@ -268,9 +268,9 @@ The conditions to match for the entries.
|
|
|
268
268
|
|
|
269
269
|
##### orderBy?
|
|
270
270
|
|
|
271
|
-
|
|
271
|
+
`"dateCreated"` \| `"dateModified"`
|
|
272
272
|
|
|
273
|
-
|
|
273
|
+
The order for the results, defaults to created.
|
|
274
274
|
|
|
275
275
|
##### orderByDirection?
|
|
276
276
|
|
|
@@ -4,17 +4,17 @@ Configuration for the blob storage service.
|
|
|
4
4
|
|
|
5
5
|
## Properties
|
|
6
6
|
|
|
7
|
-
### vaultKeyId?
|
|
7
|
+
### vaultKeyId? {#vaultkeyid}
|
|
8
8
|
|
|
9
|
-
> `optional` **vaultKeyId
|
|
9
|
+
> `optional` **vaultKeyId?**: `string`
|
|
10
10
|
|
|
11
11
|
The name of the vault key to use for encryption, if not configured no encryption will happen.
|
|
12
12
|
|
|
13
13
|
***
|
|
14
14
|
|
|
15
|
-
### defaultNamespace?
|
|
15
|
+
### defaultNamespace? {#defaultnamespace}
|
|
16
16
|
|
|
17
|
-
> `optional` **defaultNamespace
|
|
17
|
+
> `optional` **defaultNamespace?**: `string`
|
|
18
18
|
|
|
19
19
|
The namespace of the default storage connector to use.
|
|
20
20
|
Defaults to the first entry in the factory if not provided.
|
|
@@ -4,9 +4,9 @@ Options for the Blob Storage Service constructor.
|
|
|
4
4
|
|
|
5
5
|
## Properties
|
|
6
6
|
|
|
7
|
-
### entryEntityStorageType?
|
|
7
|
+
### entryEntityStorageType? {#entryentitystoragetype}
|
|
8
8
|
|
|
9
|
-
> `optional` **entryEntityStorageType
|
|
9
|
+
> `optional` **entryEntityStorageType?**: `string`
|
|
10
10
|
|
|
11
11
|
The type of the storage connector for the metadata.
|
|
12
12
|
|
|
@@ -18,16 +18,16 @@ blob-storage-entry
|
|
|
18
18
|
|
|
19
19
|
***
|
|
20
20
|
|
|
21
|
-
### vaultConnectorType?
|
|
21
|
+
### vaultConnectorType? {#vaultconnectortype}
|
|
22
22
|
|
|
23
|
-
> `optional` **vaultConnectorType
|
|
23
|
+
> `optional` **vaultConnectorType?**: `string`
|
|
24
24
|
|
|
25
25
|
The type of the vault connector for encryption.
|
|
26
26
|
|
|
27
27
|
***
|
|
28
28
|
|
|
29
|
-
### config?
|
|
29
|
+
### config? {#config}
|
|
30
30
|
|
|
31
|
-
> `optional` **config
|
|
31
|
+
> `optional` **config?**: [`IBlobStorageServiceConfig`](IBlobStorageServiceConfig.md)
|
|
32
32
|
|
|
33
33
|
The configuration for the service.
|
package/package.json
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@twin.org/blob-storage-service",
|
|
3
|
-
"version": "0.0.3-next.
|
|
4
|
-
"description": "
|
|
3
|
+
"version": "0.0.3-next.8",
|
|
4
|
+
"description": "Exposes blob operations through service components and HTTP route definitions.",
|
|
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-service"
|
|
9
9
|
},
|
|
10
10
|
"author": "martyn.janes@iota.org",
|
|
@@ -15,7 +15,7 @@
|
|
|
15
15
|
},
|
|
16
16
|
"dependencies": {
|
|
17
17
|
"@twin.org/api-models": "next",
|
|
18
|
-
"@twin.org/blob-storage-models": "0.0.3-next.
|
|
18
|
+
"@twin.org/blob-storage-models": "0.0.3-next.8",
|
|
19
19
|
"@twin.org/context": "next",
|
|
20
20
|
"@twin.org/core": "next",
|
|
21
21
|
"@twin.org/crypto": "next",
|
|
@@ -59,7 +59,7 @@
|
|
|
59
59
|
"business-logic"
|
|
60
60
|
],
|
|
61
61
|
"bugs": {
|
|
62
|
-
"url": "git+https://github.com/
|
|
62
|
+
"url": "git+https://github.com/iotaledger/blob-storage/issues"
|
|
63
63
|
},
|
|
64
64
|
"homepage": "https://twindev.org"
|
|
65
65
|
}
|