@twin.org/blob-storage-service 0.0.1-next.24 → 0.0.1-next.26
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/dist/cjs/index.cjs +48 -41
- package/dist/esm/index.mjs +48 -41
- package/dist/types/blobStorageRoutes.d.ts +1 -1
- package/dist/types/blobStorageService.d.ts +7 -7
- package/dist/types/entities/blobStorageEntry.d.ts +2 -2
- package/dist/types/models/IBlobStorageServiceConstructorOptions.d.ts +1 -1
- package/docs/changelog.md +1 -1
- package/docs/open-api/spec.json +12 -12
- package/docs/reference/classes/BlobStorageEntry.md +3 -3
- package/docs/reference/classes/BlobStorageService.md +9 -9
- package/docs/reference/functions/blobStorageUpdate.md +1 -1
- package/docs/reference/interfaces/IBlobStorageServiceConstructorOptions.md +1 -1
- package/package.json +2 -2
package/dist/cjs/index.cjs
CHANGED
|
@@ -54,7 +54,7 @@ function generateRestRoutesBlobStorage(baseRouteName, componentName, options) {
|
|
|
54
54
|
request: {
|
|
55
55
|
body: {
|
|
56
56
|
blob: "VGhlIHF1aWNrIGJyb3duIGZveCBqdW1wcyBvdmVyIHRoZSBsYXp5IGRvZw==",
|
|
57
|
-
|
|
57
|
+
metadata: {
|
|
58
58
|
"@context": "https://schema.org",
|
|
59
59
|
"@type": "DigitalDocument",
|
|
60
60
|
name: "myfile.pdf"
|
|
@@ -83,7 +83,7 @@ function generateRestRoutesBlobStorage(baseRouteName, componentName, options) {
|
|
|
83
83
|
};
|
|
84
84
|
const blobStorageGetRoute = {
|
|
85
85
|
operationId: `${camelTypeName}Get`,
|
|
86
|
-
summary: `Get the
|
|
86
|
+
summary: `Get the metadata for an item from ${lowerName}`,
|
|
87
87
|
tag: options?.tagName ?? tagsBlobStorage[0].name,
|
|
88
88
|
method: "GET",
|
|
89
89
|
path: `${baseRouteName}/:id`,
|
|
@@ -124,7 +124,7 @@ function generateRestRoutesBlobStorage(baseRouteName, componentName, options) {
|
|
|
124
124
|
blobSize: 42,
|
|
125
125
|
blobHash: "sha256:c57d94b088f4c6d2cb32ded014813d0c786aa00134c8ee22f84b1e2545602a70",
|
|
126
126
|
fileExtension: "pdf",
|
|
127
|
-
|
|
127
|
+
metadata: {
|
|
128
128
|
"@context": "https://schema.org",
|
|
129
129
|
"@type": "DigitalDocument",
|
|
130
130
|
name: "myfile.pdf"
|
|
@@ -155,7 +155,7 @@ function generateRestRoutesBlobStorage(baseRouteName, componentName, options) {
|
|
|
155
155
|
blobSize: 42,
|
|
156
156
|
blobHash: "sha256:c57d94b088f4c6d2cb32ded014813d0c786aa00134c8ee22f84b1e2545602a70",
|
|
157
157
|
fileExtension: "pdf",
|
|
158
|
-
|
|
158
|
+
metadata: {
|
|
159
159
|
"@context": "https://schema.org",
|
|
160
160
|
"@type": "DigitalDocument",
|
|
161
161
|
name: "myfile.pdf"
|
|
@@ -216,7 +216,7 @@ function generateRestRoutesBlobStorage(baseRouteName, componentName, options) {
|
|
|
216
216
|
};
|
|
217
217
|
const blobStorageUpdateRoute = {
|
|
218
218
|
operationId: `${camelTypeName}Update`,
|
|
219
|
-
summary: `Update the
|
|
219
|
+
summary: `Update the metadata for an item in ${lowerName}`,
|
|
220
220
|
tag: options?.tagName ?? tagsBlobStorage[0].name,
|
|
221
221
|
method: "PUT",
|
|
222
222
|
path: `${baseRouteName}/:id`,
|
|
@@ -231,7 +231,7 @@ function generateRestRoutesBlobStorage(baseRouteName, componentName, options) {
|
|
|
231
231
|
id: "blob-memory:c57d94b088f4c6d2cb32ded014813d0c786aa00134c8ee22f84b1e2545602a70"
|
|
232
232
|
},
|
|
233
233
|
body: {
|
|
234
|
-
|
|
234
|
+
metadata: {
|
|
235
235
|
"@context": "https://schema.org",
|
|
236
236
|
"@type": "DigitalDocument",
|
|
237
237
|
name: "myfile.pdf"
|
|
@@ -316,7 +316,7 @@ function generateRestRoutesBlobStorage(baseRouteName, componentName, options) {
|
|
|
316
316
|
blobSize: 42,
|
|
317
317
|
blobHash: "sha256:c57d94b088f4c6d2cb32ded014813d0c786aa00134c8ee22f84b1e2545602a70",
|
|
318
318
|
fileExtension: "pdf",
|
|
319
|
-
|
|
319
|
+
metadata: {
|
|
320
320
|
"@context": "https://schema.org",
|
|
321
321
|
"@type": "DigitalDocument",
|
|
322
322
|
name: "myfile.pdf"
|
|
@@ -353,7 +353,7 @@ function generateRestRoutesBlobStorage(baseRouteName, componentName, options) {
|
|
|
353
353
|
blobSize: 42,
|
|
354
354
|
blobHash: "sha256:c57d94b088f4c6d2cb32ded014813d0c786aa00134c8ee22f84b1e2545602a70",
|
|
355
355
|
fileExtension: "pdf",
|
|
356
|
-
|
|
356
|
+
metadata: {
|
|
357
357
|
"@context": "https://schema.org",
|
|
358
358
|
"@type": "DigitalDocument",
|
|
359
359
|
name: "myfile.pdf"
|
|
@@ -392,7 +392,7 @@ async function blobStorageCreate(httpRequestContext, componentName, request) {
|
|
|
392
392
|
core.Guards.object(ROUTES_SOURCE, "request.body", request.body);
|
|
393
393
|
core.Guards.stringBase64(ROUTES_SOURCE, "request.body.blob", request.body.blob);
|
|
394
394
|
const component = core.ComponentFactory.get(componentName);
|
|
395
|
-
const id = await component.create(request.body.blob, request.body.encodingFormat, request.body.fileExtension, request.body.
|
|
395
|
+
const id = await component.create(request.body.blob, request.body.encodingFormat, request.body.fileExtension, request.body.metadata, request.body.namespace, httpRequestContext.userIdentity, httpRequestContext.nodeIdentity);
|
|
396
396
|
return {
|
|
397
397
|
statusCode: web.HttpStatusCode.created,
|
|
398
398
|
headers: {
|
|
@@ -449,7 +449,7 @@ async function blobStorageGetContent(httpRequestContext, componentName, request)
|
|
|
449
449
|
};
|
|
450
450
|
}
|
|
451
451
|
/**
|
|
452
|
-
* Update the blob storage
|
|
452
|
+
* Update the blob storage metadata.
|
|
453
453
|
* @param httpRequestContext The request context for the API.
|
|
454
454
|
* @param componentName The name of the component to use in the routes.
|
|
455
455
|
* @param request The request.
|
|
@@ -460,7 +460,7 @@ async function blobStorageUpdate(httpRequestContext, componentName, request) {
|
|
|
460
460
|
core.Guards.object(ROUTES_SOURCE, "request.pathParams", request.pathParams);
|
|
461
461
|
core.Guards.stringValue(ROUTES_SOURCE, "request.pathParams.id", request.pathParams.id);
|
|
462
462
|
const component = core.ComponentFactory.get(componentName);
|
|
463
|
-
await component.update(request.pathParams.id, request.body.encodingFormat, request.body.fileExtension, request.body.
|
|
463
|
+
await component.update(request.pathParams.id, request.body.encodingFormat, request.body.fileExtension, request.body.metadata, httpRequestContext.userIdentity, httpRequestContext.nodeIdentity);
|
|
464
464
|
return {
|
|
465
465
|
statusCode: web.HttpStatusCode.noContent
|
|
466
466
|
};
|
|
@@ -523,7 +523,7 @@ class BlobStorageService {
|
|
|
523
523
|
*/
|
|
524
524
|
_defaultNamespace;
|
|
525
525
|
/**
|
|
526
|
-
* The storage connector for the
|
|
526
|
+
* The storage connector for the metadata.
|
|
527
527
|
* @internal
|
|
528
528
|
*/
|
|
529
529
|
_entryEntityStorage;
|
|
@@ -567,17 +567,17 @@ class BlobStorageService {
|
|
|
567
567
|
standardsSchemaOrg.SchemaOrgDataTypes.registerRedirects();
|
|
568
568
|
}
|
|
569
569
|
/**
|
|
570
|
-
* Create the blob with some
|
|
570
|
+
* Create the blob with some metadata.
|
|
571
571
|
* @param blob The data for the blob in base64 format.
|
|
572
572
|
* @param encodingFormat Mime type for the blob, will be detected if left undefined.
|
|
573
573
|
* @param fileExtension Extension for the blob, will be detected if left undefined.
|
|
574
|
-
* @param
|
|
574
|
+
* @param metadata Data for the custom metadata as JSON-LD.
|
|
575
575
|
* @param namespace The namespace to use for storing, defaults to component configured namespace.
|
|
576
576
|
* @param userIdentity The user identity to use with storage operations.
|
|
577
577
|
* @param nodeIdentity The node identity to use with storage operations.
|
|
578
578
|
* @returns The id of the stored blob in urn format.
|
|
579
579
|
*/
|
|
580
|
-
async create(blob, encodingFormat, fileExtension,
|
|
580
|
+
async create(blob, encodingFormat, fileExtension, metadata, namespace, userIdentity, nodeIdentity) {
|
|
581
581
|
core.Guards.stringBase64(this.CLASS_NAME, "blob", blob);
|
|
582
582
|
if (this._includeUserIdentity) {
|
|
583
583
|
core.Guards.stringValue(this.CLASS_NAME, "userIdentity", userIdentity);
|
|
@@ -600,10 +600,10 @@ class BlobStorageService {
|
|
|
600
600
|
if (!core.Is.stringValue(fileExtension) && core.Is.stringValue(encodingFormat)) {
|
|
601
601
|
fileExtension = await web.MimeTypeHelper.defaultExtension(encodingFormat);
|
|
602
602
|
}
|
|
603
|
-
if (core.Is.object(
|
|
603
|
+
if (core.Is.object(metadata)) {
|
|
604
604
|
const validationFailures = [];
|
|
605
|
-
dataJsonLd.JsonLdHelper.validate(
|
|
606
|
-
core.Validation.asValidationError(this.CLASS_NAME, "
|
|
605
|
+
dataJsonLd.JsonLdHelper.validate(metadata, validationFailures);
|
|
606
|
+
core.Validation.asValidationError(this.CLASS_NAME, "metadata", validationFailures);
|
|
607
607
|
}
|
|
608
608
|
const blobHash = `sha256:${core.Converter.bytesToBase64(crypto.Sha256.sum256(storeBlob))}`;
|
|
609
609
|
// If we have a vault connector then encrypt the data.
|
|
@@ -620,7 +620,7 @@ class BlobStorageService {
|
|
|
620
620
|
blobHash,
|
|
621
621
|
encodingFormat,
|
|
622
622
|
fileExtension,
|
|
623
|
-
|
|
623
|
+
metadata
|
|
624
624
|
};
|
|
625
625
|
const conditions = [];
|
|
626
626
|
if (this._includeUserIdentity) {
|
|
@@ -641,7 +641,7 @@ class BlobStorageService {
|
|
|
641
641
|
/**
|
|
642
642
|
* Get the blob entry.
|
|
643
643
|
* @param id The id of the blob to get in urn format.
|
|
644
|
-
* @param includeContent Include the content, or just get the
|
|
644
|
+
* @param includeContent Include the content, or just get the metadata.
|
|
645
645
|
* @param userIdentity The user identity to use with storage operations.
|
|
646
646
|
* @param nodeIdentity The node identity to use with storage operations.
|
|
647
647
|
* @returns The entry and data for the blob if it can be found.
|
|
@@ -688,17 +688,17 @@ class BlobStorageService {
|
|
|
688
688
|
}
|
|
689
689
|
}
|
|
690
690
|
/**
|
|
691
|
-
* Update the blob with
|
|
691
|
+
* Update the blob with metadata.
|
|
692
692
|
* @param id The id of the blob entry to update.
|
|
693
693
|
* @param encodingFormat Mime type for the blob, will be detected if left undefined.
|
|
694
694
|
* @param fileExtension Extension for the blob, will be detected if left undefined.
|
|
695
|
-
* @param
|
|
695
|
+
* @param metadata Data for the custom metadata as JSON-LD.
|
|
696
696
|
* @param userIdentity The user identity to use with storage operations.
|
|
697
697
|
* @param nodeIdentity The node identity to use with storage operations.
|
|
698
698
|
* @returns Nothing.
|
|
699
699
|
* @throws Not found error if the blob cannot be found.
|
|
700
700
|
*/
|
|
701
|
-
async update(id, encodingFormat, fileExtension,
|
|
701
|
+
async update(id, encodingFormat, fileExtension, metadata, userIdentity, nodeIdentity) {
|
|
702
702
|
core.Urn.guard(this.CLASS_NAME, "id", id);
|
|
703
703
|
if (this._includeUserIdentity) {
|
|
704
704
|
core.Guards.stringValue(this.CLASS_NAME, "userIdentity", userIdentity);
|
|
@@ -711,10 +711,10 @@ class BlobStorageService {
|
|
|
711
711
|
if (core.Is.undefined(blobEntry)) {
|
|
712
712
|
throw new core.NotFoundError(this.CLASS_NAME, "blobNotFound", id);
|
|
713
713
|
}
|
|
714
|
-
if (core.Is.object(
|
|
714
|
+
if (core.Is.object(metadata)) {
|
|
715
715
|
const validationFailures = [];
|
|
716
|
-
await dataJsonLd.JsonLdHelper.validate(
|
|
717
|
-
core.Validation.asValidationError(this.CLASS_NAME, "
|
|
716
|
+
await dataJsonLd.JsonLdHelper.validate(metadata, validationFailures);
|
|
717
|
+
core.Validation.asValidationError(this.CLASS_NAME, "metadata", validationFailures);
|
|
718
718
|
}
|
|
719
719
|
// Now store the entry in entity storage
|
|
720
720
|
const updatedBlobEntry = {
|
|
@@ -725,7 +725,7 @@ class BlobStorageService {
|
|
|
725
725
|
blobHash: blobEntry.blobHash,
|
|
726
726
|
encodingFormat: encodingFormat ?? blobEntry.encodingFormat,
|
|
727
727
|
fileExtension: fileExtension ?? blobEntry.fileExtension,
|
|
728
|
-
|
|
728
|
+
metadata: metadata ?? blobEntry.metadata
|
|
729
729
|
};
|
|
730
730
|
const conditions = [];
|
|
731
731
|
if (this._includeUserIdentity) {
|
|
@@ -824,15 +824,21 @@ class BlobStorageService {
|
|
|
824
824
|
core.ObjectHelper.propertyDelete(entity, "nodeIdentity");
|
|
825
825
|
core.ObjectHelper.propertyDelete(entity, "userIdentity");
|
|
826
826
|
}
|
|
827
|
+
let context = [
|
|
828
|
+
blobStorageModels.BlobStorageTypes.ContextRoot,
|
|
829
|
+
blobStorageModels.BlobStorageTypes.ContextRootCommon,
|
|
830
|
+
standardsSchemaOrg.SchemaOrgTypes.ContextRoot
|
|
831
|
+
];
|
|
832
|
+
const entriesJsonLd = [];
|
|
833
|
+
for (const entry of result.entities) {
|
|
834
|
+
// The entries are never Partial as we don't allow custom property requests.
|
|
835
|
+
entriesJsonLd.push(this.entryToJsonLd(entry));
|
|
836
|
+
context = dataJsonLd.JsonLdProcessor.combineContexts(context, entry.metadata?.["@context"]);
|
|
837
|
+
}
|
|
827
838
|
const jsonLd = {
|
|
828
|
-
"@context":
|
|
829
|
-
blobStorageModels.BlobStorageTypes.ContextRoot,
|
|
830
|
-
blobStorageModels.BlobStorageTypes.ContextRootCommon,
|
|
831
|
-
standardsSchemaOrg.SchemaOrgTypes.ContextRoot
|
|
832
|
-
],
|
|
839
|
+
"@context": context,
|
|
833
840
|
type: blobStorageModels.BlobStorageTypes.EntryList,
|
|
834
|
-
|
|
835
|
-
entries: result.entities.map(entry => this.entryToJsonLd(entry)),
|
|
841
|
+
entries: entriesJsonLd,
|
|
836
842
|
cursor: result.cursor
|
|
837
843
|
};
|
|
838
844
|
return dataJsonLd.JsonLdProcessor.compact(jsonLd, jsonLd["@context"]);
|
|
@@ -913,12 +919,12 @@ class BlobStorageService {
|
|
|
913
919
|
* @internal
|
|
914
920
|
*/
|
|
915
921
|
entryToJsonLd(entry, blob) {
|
|
916
|
-
|
|
917
|
-
"@context": [
|
|
922
|
+
const jsonLd = {
|
|
923
|
+
"@context": dataJsonLd.JsonLdProcessor.combineContexts([
|
|
918
924
|
blobStorageModels.BlobStorageTypes.ContextRoot,
|
|
919
925
|
blobStorageModels.BlobStorageTypes.ContextRootCommon,
|
|
920
926
|
standardsSchemaOrg.SchemaOrgTypes.ContextRoot
|
|
921
|
-
],
|
|
927
|
+
], entry?.metadata?.["@context"]),
|
|
922
928
|
id: entry.id,
|
|
923
929
|
type: blobStorageModels.BlobStorageTypes.Entry,
|
|
924
930
|
dateCreated: entry.dateCreated,
|
|
@@ -927,9 +933,10 @@ class BlobStorageService {
|
|
|
927
933
|
blobHash: entry.blobHash,
|
|
928
934
|
encodingFormat: entry?.encodingFormat,
|
|
929
935
|
fileExtension: entry?.fileExtension,
|
|
930
|
-
|
|
936
|
+
metadata: entry?.metadata,
|
|
931
937
|
blob: core.Is.uint8Array(blob) ? core.Converter.bytesToBase64(blob) : undefined
|
|
932
938
|
};
|
|
939
|
+
return jsonLd;
|
|
933
940
|
}
|
|
934
941
|
}
|
|
935
942
|
|
|
@@ -966,9 +973,9 @@ exports.BlobStorageEntry = class BlobStorageEntry {
|
|
|
966
973
|
*/
|
|
967
974
|
fileExtension;
|
|
968
975
|
/**
|
|
969
|
-
* The
|
|
976
|
+
* The metadata for the blob as JSON-LD.
|
|
970
977
|
*/
|
|
971
|
-
|
|
978
|
+
metadata;
|
|
972
979
|
/**
|
|
973
980
|
* The user identity that created the blob.
|
|
974
981
|
*/
|
|
@@ -1009,7 +1016,7 @@ __decorate([
|
|
|
1009
1016
|
__decorate([
|
|
1010
1017
|
entity.property({ type: "object", itemTypeRef: "IJsonLdNodeObject" }),
|
|
1011
1018
|
__metadata("design:type", Object)
|
|
1012
|
-
], exports.BlobStorageEntry.prototype, "
|
|
1019
|
+
], exports.BlobStorageEntry.prototype, "metadata", void 0);
|
|
1013
1020
|
__decorate([
|
|
1014
1021
|
entity.property({ type: "string" }),
|
|
1015
1022
|
__metadata("design:type", String)
|
package/dist/esm/index.mjs
CHANGED
|
@@ -52,7 +52,7 @@ function generateRestRoutesBlobStorage(baseRouteName, componentName, options) {
|
|
|
52
52
|
request: {
|
|
53
53
|
body: {
|
|
54
54
|
blob: "VGhlIHF1aWNrIGJyb3duIGZveCBqdW1wcyBvdmVyIHRoZSBsYXp5IGRvZw==",
|
|
55
|
-
|
|
55
|
+
metadata: {
|
|
56
56
|
"@context": "https://schema.org",
|
|
57
57
|
"@type": "DigitalDocument",
|
|
58
58
|
name: "myfile.pdf"
|
|
@@ -81,7 +81,7 @@ function generateRestRoutesBlobStorage(baseRouteName, componentName, options) {
|
|
|
81
81
|
};
|
|
82
82
|
const blobStorageGetRoute = {
|
|
83
83
|
operationId: `${camelTypeName}Get`,
|
|
84
|
-
summary: `Get the
|
|
84
|
+
summary: `Get the metadata for an item from ${lowerName}`,
|
|
85
85
|
tag: options?.tagName ?? tagsBlobStorage[0].name,
|
|
86
86
|
method: "GET",
|
|
87
87
|
path: `${baseRouteName}/:id`,
|
|
@@ -122,7 +122,7 @@ function generateRestRoutesBlobStorage(baseRouteName, componentName, options) {
|
|
|
122
122
|
blobSize: 42,
|
|
123
123
|
blobHash: "sha256:c57d94b088f4c6d2cb32ded014813d0c786aa00134c8ee22f84b1e2545602a70",
|
|
124
124
|
fileExtension: "pdf",
|
|
125
|
-
|
|
125
|
+
metadata: {
|
|
126
126
|
"@context": "https://schema.org",
|
|
127
127
|
"@type": "DigitalDocument",
|
|
128
128
|
name: "myfile.pdf"
|
|
@@ -153,7 +153,7 @@ function generateRestRoutesBlobStorage(baseRouteName, componentName, options) {
|
|
|
153
153
|
blobSize: 42,
|
|
154
154
|
blobHash: "sha256:c57d94b088f4c6d2cb32ded014813d0c786aa00134c8ee22f84b1e2545602a70",
|
|
155
155
|
fileExtension: "pdf",
|
|
156
|
-
|
|
156
|
+
metadata: {
|
|
157
157
|
"@context": "https://schema.org",
|
|
158
158
|
"@type": "DigitalDocument",
|
|
159
159
|
name: "myfile.pdf"
|
|
@@ -214,7 +214,7 @@ function generateRestRoutesBlobStorage(baseRouteName, componentName, options) {
|
|
|
214
214
|
};
|
|
215
215
|
const blobStorageUpdateRoute = {
|
|
216
216
|
operationId: `${camelTypeName}Update`,
|
|
217
|
-
summary: `Update the
|
|
217
|
+
summary: `Update the metadata for an item in ${lowerName}`,
|
|
218
218
|
tag: options?.tagName ?? tagsBlobStorage[0].name,
|
|
219
219
|
method: "PUT",
|
|
220
220
|
path: `${baseRouteName}/:id`,
|
|
@@ -229,7 +229,7 @@ function generateRestRoutesBlobStorage(baseRouteName, componentName, options) {
|
|
|
229
229
|
id: "blob-memory:c57d94b088f4c6d2cb32ded014813d0c786aa00134c8ee22f84b1e2545602a70"
|
|
230
230
|
},
|
|
231
231
|
body: {
|
|
232
|
-
|
|
232
|
+
metadata: {
|
|
233
233
|
"@context": "https://schema.org",
|
|
234
234
|
"@type": "DigitalDocument",
|
|
235
235
|
name: "myfile.pdf"
|
|
@@ -314,7 +314,7 @@ function generateRestRoutesBlobStorage(baseRouteName, componentName, options) {
|
|
|
314
314
|
blobSize: 42,
|
|
315
315
|
blobHash: "sha256:c57d94b088f4c6d2cb32ded014813d0c786aa00134c8ee22f84b1e2545602a70",
|
|
316
316
|
fileExtension: "pdf",
|
|
317
|
-
|
|
317
|
+
metadata: {
|
|
318
318
|
"@context": "https://schema.org",
|
|
319
319
|
"@type": "DigitalDocument",
|
|
320
320
|
name: "myfile.pdf"
|
|
@@ -351,7 +351,7 @@ function generateRestRoutesBlobStorage(baseRouteName, componentName, options) {
|
|
|
351
351
|
blobSize: 42,
|
|
352
352
|
blobHash: "sha256:c57d94b088f4c6d2cb32ded014813d0c786aa00134c8ee22f84b1e2545602a70",
|
|
353
353
|
fileExtension: "pdf",
|
|
354
|
-
|
|
354
|
+
metadata: {
|
|
355
355
|
"@context": "https://schema.org",
|
|
356
356
|
"@type": "DigitalDocument",
|
|
357
357
|
name: "myfile.pdf"
|
|
@@ -390,7 +390,7 @@ async function blobStorageCreate(httpRequestContext, componentName, request) {
|
|
|
390
390
|
Guards.object(ROUTES_SOURCE, "request.body", request.body);
|
|
391
391
|
Guards.stringBase64(ROUTES_SOURCE, "request.body.blob", request.body.blob);
|
|
392
392
|
const component = ComponentFactory.get(componentName);
|
|
393
|
-
const id = await component.create(request.body.blob, request.body.encodingFormat, request.body.fileExtension, request.body.
|
|
393
|
+
const id = await component.create(request.body.blob, request.body.encodingFormat, request.body.fileExtension, request.body.metadata, request.body.namespace, httpRequestContext.userIdentity, httpRequestContext.nodeIdentity);
|
|
394
394
|
return {
|
|
395
395
|
statusCode: HttpStatusCode.created,
|
|
396
396
|
headers: {
|
|
@@ -447,7 +447,7 @@ async function blobStorageGetContent(httpRequestContext, componentName, request)
|
|
|
447
447
|
};
|
|
448
448
|
}
|
|
449
449
|
/**
|
|
450
|
-
* Update the blob storage
|
|
450
|
+
* Update the blob storage metadata.
|
|
451
451
|
* @param httpRequestContext The request context for the API.
|
|
452
452
|
* @param componentName The name of the component to use in the routes.
|
|
453
453
|
* @param request The request.
|
|
@@ -458,7 +458,7 @@ async function blobStorageUpdate(httpRequestContext, componentName, request) {
|
|
|
458
458
|
Guards.object(ROUTES_SOURCE, "request.pathParams", request.pathParams);
|
|
459
459
|
Guards.stringValue(ROUTES_SOURCE, "request.pathParams.id", request.pathParams.id);
|
|
460
460
|
const component = ComponentFactory.get(componentName);
|
|
461
|
-
await component.update(request.pathParams.id, request.body.encodingFormat, request.body.fileExtension, request.body.
|
|
461
|
+
await component.update(request.pathParams.id, request.body.encodingFormat, request.body.fileExtension, request.body.metadata, httpRequestContext.userIdentity, httpRequestContext.nodeIdentity);
|
|
462
462
|
return {
|
|
463
463
|
statusCode: HttpStatusCode.noContent
|
|
464
464
|
};
|
|
@@ -521,7 +521,7 @@ class BlobStorageService {
|
|
|
521
521
|
*/
|
|
522
522
|
_defaultNamespace;
|
|
523
523
|
/**
|
|
524
|
-
* The storage connector for the
|
|
524
|
+
* The storage connector for the metadata.
|
|
525
525
|
* @internal
|
|
526
526
|
*/
|
|
527
527
|
_entryEntityStorage;
|
|
@@ -565,17 +565,17 @@ class BlobStorageService {
|
|
|
565
565
|
SchemaOrgDataTypes.registerRedirects();
|
|
566
566
|
}
|
|
567
567
|
/**
|
|
568
|
-
* Create the blob with some
|
|
568
|
+
* Create the blob with some metadata.
|
|
569
569
|
* @param blob The data for the blob in base64 format.
|
|
570
570
|
* @param encodingFormat Mime type for the blob, will be detected if left undefined.
|
|
571
571
|
* @param fileExtension Extension for the blob, will be detected if left undefined.
|
|
572
|
-
* @param
|
|
572
|
+
* @param metadata Data for the custom metadata as JSON-LD.
|
|
573
573
|
* @param namespace The namespace to use for storing, defaults to component configured namespace.
|
|
574
574
|
* @param userIdentity The user identity to use with storage operations.
|
|
575
575
|
* @param nodeIdentity The node identity to use with storage operations.
|
|
576
576
|
* @returns The id of the stored blob in urn format.
|
|
577
577
|
*/
|
|
578
|
-
async create(blob, encodingFormat, fileExtension,
|
|
578
|
+
async create(blob, encodingFormat, fileExtension, metadata, namespace, userIdentity, nodeIdentity) {
|
|
579
579
|
Guards.stringBase64(this.CLASS_NAME, "blob", blob);
|
|
580
580
|
if (this._includeUserIdentity) {
|
|
581
581
|
Guards.stringValue(this.CLASS_NAME, "userIdentity", userIdentity);
|
|
@@ -598,10 +598,10 @@ class BlobStorageService {
|
|
|
598
598
|
if (!Is.stringValue(fileExtension) && Is.stringValue(encodingFormat)) {
|
|
599
599
|
fileExtension = await MimeTypeHelper.defaultExtension(encodingFormat);
|
|
600
600
|
}
|
|
601
|
-
if (Is.object(
|
|
601
|
+
if (Is.object(metadata)) {
|
|
602
602
|
const validationFailures = [];
|
|
603
|
-
JsonLdHelper.validate(
|
|
604
|
-
Validation.asValidationError(this.CLASS_NAME, "
|
|
603
|
+
JsonLdHelper.validate(metadata, validationFailures);
|
|
604
|
+
Validation.asValidationError(this.CLASS_NAME, "metadata", validationFailures);
|
|
605
605
|
}
|
|
606
606
|
const blobHash = `sha256:${Converter.bytesToBase64(Sha256.sum256(storeBlob))}`;
|
|
607
607
|
// If we have a vault connector then encrypt the data.
|
|
@@ -618,7 +618,7 @@ class BlobStorageService {
|
|
|
618
618
|
blobHash,
|
|
619
619
|
encodingFormat,
|
|
620
620
|
fileExtension,
|
|
621
|
-
|
|
621
|
+
metadata
|
|
622
622
|
};
|
|
623
623
|
const conditions = [];
|
|
624
624
|
if (this._includeUserIdentity) {
|
|
@@ -639,7 +639,7 @@ class BlobStorageService {
|
|
|
639
639
|
/**
|
|
640
640
|
* Get the blob entry.
|
|
641
641
|
* @param id The id of the blob to get in urn format.
|
|
642
|
-
* @param includeContent Include the content, or just get the
|
|
642
|
+
* @param includeContent Include the content, or just get the metadata.
|
|
643
643
|
* @param userIdentity The user identity to use with storage operations.
|
|
644
644
|
* @param nodeIdentity The node identity to use with storage operations.
|
|
645
645
|
* @returns The entry and data for the blob if it can be found.
|
|
@@ -686,17 +686,17 @@ class BlobStorageService {
|
|
|
686
686
|
}
|
|
687
687
|
}
|
|
688
688
|
/**
|
|
689
|
-
* Update the blob with
|
|
689
|
+
* Update the blob with metadata.
|
|
690
690
|
* @param id The id of the blob entry to update.
|
|
691
691
|
* @param encodingFormat Mime type for the blob, will be detected if left undefined.
|
|
692
692
|
* @param fileExtension Extension for the blob, will be detected if left undefined.
|
|
693
|
-
* @param
|
|
693
|
+
* @param metadata Data for the custom metadata as JSON-LD.
|
|
694
694
|
* @param userIdentity The user identity to use with storage operations.
|
|
695
695
|
* @param nodeIdentity The node identity to use with storage operations.
|
|
696
696
|
* @returns Nothing.
|
|
697
697
|
* @throws Not found error if the blob cannot be found.
|
|
698
698
|
*/
|
|
699
|
-
async update(id, encodingFormat, fileExtension,
|
|
699
|
+
async update(id, encodingFormat, fileExtension, metadata, userIdentity, nodeIdentity) {
|
|
700
700
|
Urn.guard(this.CLASS_NAME, "id", id);
|
|
701
701
|
if (this._includeUserIdentity) {
|
|
702
702
|
Guards.stringValue(this.CLASS_NAME, "userIdentity", userIdentity);
|
|
@@ -709,10 +709,10 @@ class BlobStorageService {
|
|
|
709
709
|
if (Is.undefined(blobEntry)) {
|
|
710
710
|
throw new NotFoundError(this.CLASS_NAME, "blobNotFound", id);
|
|
711
711
|
}
|
|
712
|
-
if (Is.object(
|
|
712
|
+
if (Is.object(metadata)) {
|
|
713
713
|
const validationFailures = [];
|
|
714
|
-
await JsonLdHelper.validate(
|
|
715
|
-
Validation.asValidationError(this.CLASS_NAME, "
|
|
714
|
+
await JsonLdHelper.validate(metadata, validationFailures);
|
|
715
|
+
Validation.asValidationError(this.CLASS_NAME, "metadata", validationFailures);
|
|
716
716
|
}
|
|
717
717
|
// Now store the entry in entity storage
|
|
718
718
|
const updatedBlobEntry = {
|
|
@@ -723,7 +723,7 @@ class BlobStorageService {
|
|
|
723
723
|
blobHash: blobEntry.blobHash,
|
|
724
724
|
encodingFormat: encodingFormat ?? blobEntry.encodingFormat,
|
|
725
725
|
fileExtension: fileExtension ?? blobEntry.fileExtension,
|
|
726
|
-
|
|
726
|
+
metadata: metadata ?? blobEntry.metadata
|
|
727
727
|
};
|
|
728
728
|
const conditions = [];
|
|
729
729
|
if (this._includeUserIdentity) {
|
|
@@ -822,15 +822,21 @@ class BlobStorageService {
|
|
|
822
822
|
ObjectHelper.propertyDelete(entity, "nodeIdentity");
|
|
823
823
|
ObjectHelper.propertyDelete(entity, "userIdentity");
|
|
824
824
|
}
|
|
825
|
+
let context = [
|
|
826
|
+
BlobStorageTypes.ContextRoot,
|
|
827
|
+
BlobStorageTypes.ContextRootCommon,
|
|
828
|
+
SchemaOrgTypes.ContextRoot
|
|
829
|
+
];
|
|
830
|
+
const entriesJsonLd = [];
|
|
831
|
+
for (const entry of result.entities) {
|
|
832
|
+
// The entries are never Partial as we don't allow custom property requests.
|
|
833
|
+
entriesJsonLd.push(this.entryToJsonLd(entry));
|
|
834
|
+
context = JsonLdProcessor.combineContexts(context, entry.metadata?.["@context"]);
|
|
835
|
+
}
|
|
825
836
|
const jsonLd = {
|
|
826
|
-
"@context":
|
|
827
|
-
BlobStorageTypes.ContextRoot,
|
|
828
|
-
BlobStorageTypes.ContextRootCommon,
|
|
829
|
-
SchemaOrgTypes.ContextRoot
|
|
830
|
-
],
|
|
837
|
+
"@context": context,
|
|
831
838
|
type: BlobStorageTypes.EntryList,
|
|
832
|
-
|
|
833
|
-
entries: result.entities.map(entry => this.entryToJsonLd(entry)),
|
|
839
|
+
entries: entriesJsonLd,
|
|
834
840
|
cursor: result.cursor
|
|
835
841
|
};
|
|
836
842
|
return JsonLdProcessor.compact(jsonLd, jsonLd["@context"]);
|
|
@@ -911,12 +917,12 @@ class BlobStorageService {
|
|
|
911
917
|
* @internal
|
|
912
918
|
*/
|
|
913
919
|
entryToJsonLd(entry, blob) {
|
|
914
|
-
|
|
915
|
-
"@context": [
|
|
920
|
+
const jsonLd = {
|
|
921
|
+
"@context": JsonLdProcessor.combineContexts([
|
|
916
922
|
BlobStorageTypes.ContextRoot,
|
|
917
923
|
BlobStorageTypes.ContextRootCommon,
|
|
918
924
|
SchemaOrgTypes.ContextRoot
|
|
919
|
-
],
|
|
925
|
+
], entry?.metadata?.["@context"]),
|
|
920
926
|
id: entry.id,
|
|
921
927
|
type: BlobStorageTypes.Entry,
|
|
922
928
|
dateCreated: entry.dateCreated,
|
|
@@ -925,9 +931,10 @@ class BlobStorageService {
|
|
|
925
931
|
blobHash: entry.blobHash,
|
|
926
932
|
encodingFormat: entry?.encodingFormat,
|
|
927
933
|
fileExtension: entry?.fileExtension,
|
|
928
|
-
|
|
934
|
+
metadata: entry?.metadata,
|
|
929
935
|
blob: Is.uint8Array(blob) ? Converter.bytesToBase64(blob) : undefined
|
|
930
936
|
};
|
|
937
|
+
return jsonLd;
|
|
931
938
|
}
|
|
932
939
|
}
|
|
933
940
|
|
|
@@ -964,9 +971,9 @@ let BlobStorageEntry = class BlobStorageEntry {
|
|
|
964
971
|
*/
|
|
965
972
|
fileExtension;
|
|
966
973
|
/**
|
|
967
|
-
* The
|
|
974
|
+
* The metadata for the blob as JSON-LD.
|
|
968
975
|
*/
|
|
969
|
-
|
|
976
|
+
metadata;
|
|
970
977
|
/**
|
|
971
978
|
* The user identity that created the blob.
|
|
972
979
|
*/
|
|
@@ -1007,7 +1014,7 @@ __decorate([
|
|
|
1007
1014
|
__decorate([
|
|
1008
1015
|
property({ type: "object", itemTypeRef: "IJsonLdNodeObject" }),
|
|
1009
1016
|
__metadata("design:type", Object)
|
|
1010
|
-
], BlobStorageEntry.prototype, "
|
|
1017
|
+
], BlobStorageEntry.prototype, "metadata", void 0);
|
|
1011
1018
|
__decorate([
|
|
1012
1019
|
property({ type: "string" }),
|
|
1013
1020
|
__metadata("design:type", String)
|
|
@@ -42,7 +42,7 @@ export declare function blobStorageGet(httpRequestContext: IHttpRequestContext,
|
|
|
42
42
|
*/
|
|
43
43
|
export declare function blobStorageGetContent(httpRequestContext: IHttpRequestContext, componentName: string, request: IBlobStorageGetContentRequest): Promise<IBlobStorageGetContentResponse & IRestRouteResponseOptions>;
|
|
44
44
|
/**
|
|
45
|
-
* Update the blob storage
|
|
45
|
+
* Update the blob storage metadata.
|
|
46
46
|
* @param httpRequestContext The request context for the API.
|
|
47
47
|
* @param componentName The name of the component to use in the routes.
|
|
48
48
|
* @param request The request.
|
|
@@ -20,21 +20,21 @@ export declare class BlobStorageService implements IBlobStorageComponent {
|
|
|
20
20
|
*/
|
|
21
21
|
constructor(options?: IBlobStorageServiceConstructorOptions);
|
|
22
22
|
/**
|
|
23
|
-
* Create the blob with some
|
|
23
|
+
* Create the blob with some metadata.
|
|
24
24
|
* @param blob The data for the blob in base64 format.
|
|
25
25
|
* @param encodingFormat Mime type for the blob, will be detected if left undefined.
|
|
26
26
|
* @param fileExtension Extension for the blob, will be detected if left undefined.
|
|
27
|
-
* @param
|
|
27
|
+
* @param metadata Data for the custom metadata as JSON-LD.
|
|
28
28
|
* @param namespace The namespace to use for storing, defaults to component configured namespace.
|
|
29
29
|
* @param userIdentity The user identity to use with storage operations.
|
|
30
30
|
* @param nodeIdentity The node identity to use with storage operations.
|
|
31
31
|
* @returns The id of the stored blob in urn format.
|
|
32
32
|
*/
|
|
33
|
-
create(blob: string, encodingFormat?: string, fileExtension?: string,
|
|
33
|
+
create(blob: string, encodingFormat?: string, fileExtension?: string, metadata?: IJsonLdNodeObject, namespace?: string, userIdentity?: string, nodeIdentity?: string): Promise<string>;
|
|
34
34
|
/**
|
|
35
35
|
* Get the blob entry.
|
|
36
36
|
* @param id The id of the blob to get in urn format.
|
|
37
|
-
* @param includeContent Include the content, or just get the
|
|
37
|
+
* @param includeContent Include the content, or just get the metadata.
|
|
38
38
|
* @param userIdentity The user identity to use with storage operations.
|
|
39
39
|
* @param nodeIdentity The node identity to use with storage operations.
|
|
40
40
|
* @returns The entry and data for the blob if it can be found.
|
|
@@ -42,17 +42,17 @@ export declare class BlobStorageService implements IBlobStorageComponent {
|
|
|
42
42
|
*/
|
|
43
43
|
get(id: string, includeContent: boolean, userIdentity?: string, nodeIdentity?: string): Promise<IBlobStorageEntry>;
|
|
44
44
|
/**
|
|
45
|
-
* Update the blob with
|
|
45
|
+
* Update the blob with metadata.
|
|
46
46
|
* @param id The id of the blob entry to update.
|
|
47
47
|
* @param encodingFormat Mime type for the blob, will be detected if left undefined.
|
|
48
48
|
* @param fileExtension Extension for the blob, will be detected if left undefined.
|
|
49
|
-
* @param
|
|
49
|
+
* @param metadata Data for the custom metadata as JSON-LD.
|
|
50
50
|
* @param userIdentity The user identity to use with storage operations.
|
|
51
51
|
* @param nodeIdentity The node identity to use with storage operations.
|
|
52
52
|
* @returns Nothing.
|
|
53
53
|
* @throws Not found error if the blob cannot be found.
|
|
54
54
|
*/
|
|
55
|
-
update(id: string, encodingFormat?: string, fileExtension?: string,
|
|
55
|
+
update(id: string, encodingFormat?: string, fileExtension?: string, metadata?: IJsonLdNodeObject, userIdentity?: string, nodeIdentity?: string): Promise<void>;
|
|
56
56
|
/**
|
|
57
57
|
* Remove the blob.
|
|
58
58
|
* @param id The id of the blob to remove in urn format.
|
|
@@ -32,9 +32,9 @@ export declare class BlobStorageEntry {
|
|
|
32
32
|
*/
|
|
33
33
|
fileExtension?: string;
|
|
34
34
|
/**
|
|
35
|
-
* The
|
|
35
|
+
* The metadata for the blob as JSON-LD.
|
|
36
36
|
*/
|
|
37
|
-
|
|
37
|
+
metadata?: IJsonLdNodeObject;
|
|
38
38
|
/**
|
|
39
39
|
* The user identity that created the blob.
|
|
40
40
|
*/
|
|
@@ -4,7 +4,7 @@ import type { IBlobStorageServiceConfig } from "./IBlobStorageServiceConfig";
|
|
|
4
4
|
*/
|
|
5
5
|
export interface IBlobStorageServiceConstructorOptions {
|
|
6
6
|
/**
|
|
7
|
-
* The type of the storage connector for the
|
|
7
|
+
* The type of the storage connector for the metadata.
|
|
8
8
|
* @default blob-storage-entry
|
|
9
9
|
*/
|
|
10
10
|
entryEntityStorageType?: string;
|
package/docs/changelog.md
CHANGED
package/docs/open-api/spec.json
CHANGED
|
@@ -45,7 +45,7 @@
|
|
|
45
45
|
"blobStorageCreateRequestExample": {
|
|
46
46
|
"value": {
|
|
47
47
|
"blob": "VGhlIHF1aWNrIGJyb3duIGZveCBqdW1wcyBvdmVyIHRoZSBsYXp5IGRvZw==",
|
|
48
|
-
"
|
|
48
|
+
"metadata": {
|
|
49
49
|
"@context": "https://schema.org",
|
|
50
50
|
"@type": "DigitalDocument",
|
|
51
51
|
"name": "myfile.pdf"
|
|
@@ -228,7 +228,7 @@
|
|
|
228
228
|
"blobSize": 42,
|
|
229
229
|
"blobHash": "sha256:c57d94b088f4c6d2cb32ded014813d0c786aa00134c8ee22f84b1e2545602a70",
|
|
230
230
|
"fileExtension": "pdf",
|
|
231
|
-
"
|
|
231
|
+
"metadata": {
|
|
232
232
|
"@context": "https://schema.org",
|
|
233
233
|
"@type": "DigitalDocument",
|
|
234
234
|
"name": "myfile.pdf"
|
|
@@ -266,7 +266,7 @@
|
|
|
266
266
|
"blobSize": 42,
|
|
267
267
|
"blobHash": "sha256:c57d94b088f4c6d2cb32ded014813d0c786aa00134c8ee22f84b1e2545602a70",
|
|
268
268
|
"fileExtension": "pdf",
|
|
269
|
-
"
|
|
269
|
+
"metadata": {
|
|
270
270
|
"@context": "https://schema.org",
|
|
271
271
|
"@type": "DigitalDocument",
|
|
272
272
|
"name": "myfile.pdf"
|
|
@@ -364,7 +364,7 @@
|
|
|
364
364
|
"/blob-storage/{id}": {
|
|
365
365
|
"get": {
|
|
366
366
|
"operationId": "blobStorageGet",
|
|
367
|
-
"summary": "Get the
|
|
367
|
+
"summary": "Get the metadata for an item from blob storage",
|
|
368
368
|
"tags": [
|
|
369
369
|
"Blob Storage"
|
|
370
370
|
],
|
|
@@ -382,7 +382,7 @@
|
|
|
382
382
|
},
|
|
383
383
|
{
|
|
384
384
|
"name": "includeContent",
|
|
385
|
-
"description": "Include the content in the response, otherwise only
|
|
385
|
+
"description": "Include the content in the response, otherwise only metadata is returned.",
|
|
386
386
|
"in": "query",
|
|
387
387
|
"required": false,
|
|
388
388
|
"schema": {
|
|
@@ -428,7 +428,7 @@
|
|
|
428
428
|
"blobSize": 42,
|
|
429
429
|
"blobHash": "sha256:c57d94b088f4c6d2cb32ded014813d0c786aa00134c8ee22f84b1e2545602a70",
|
|
430
430
|
"fileExtension": "pdf",
|
|
431
|
-
"
|
|
431
|
+
"metadata": {
|
|
432
432
|
"@context": "https://schema.org",
|
|
433
433
|
"@type": "DigitalDocument",
|
|
434
434
|
"name": "myfile.pdf"
|
|
@@ -457,7 +457,7 @@
|
|
|
457
457
|
"blobSize": 42,
|
|
458
458
|
"blobHash": "sha256:c57d94b088f4c6d2cb32ded014813d0c786aa00134c8ee22f84b1e2545602a70",
|
|
459
459
|
"fileExtension": "pdf",
|
|
460
|
-
"
|
|
460
|
+
"metadata": {
|
|
461
461
|
"@context": "https://schema.org",
|
|
462
462
|
"@type": "DigitalDocument",
|
|
463
463
|
"name": "myfile.pdf"
|
|
@@ -551,7 +551,7 @@
|
|
|
551
551
|
},
|
|
552
552
|
"put": {
|
|
553
553
|
"operationId": "blobStorageUpdate",
|
|
554
|
-
"summary": "Update the
|
|
554
|
+
"summary": "Update the metadata for an item in blob storage",
|
|
555
555
|
"tags": [
|
|
556
556
|
"Blob Storage"
|
|
557
557
|
],
|
|
@@ -584,7 +584,7 @@
|
|
|
584
584
|
"examples": {
|
|
585
585
|
"blobStorageUpdateRequestExample": {
|
|
586
586
|
"value": {
|
|
587
|
-
"
|
|
587
|
+
"metadata": {
|
|
588
588
|
"@context": "https://schema.org",
|
|
589
589
|
"@type": "DigitalDocument",
|
|
590
590
|
"name": "myfile.pdf"
|
|
@@ -921,7 +921,7 @@
|
|
|
921
921
|
"type": "string",
|
|
922
922
|
"description": "The extension of the blob, will be detected if left undefined."
|
|
923
923
|
},
|
|
924
|
-
"
|
|
924
|
+
"metadata": {
|
|
925
925
|
"$ref": "#/components/schemas/JsonLdNodeObject"
|
|
926
926
|
},
|
|
927
927
|
"namespace": {
|
|
@@ -989,7 +989,7 @@
|
|
|
989
989
|
"type": "string",
|
|
990
990
|
"description": "The extension."
|
|
991
991
|
},
|
|
992
|
-
"
|
|
992
|
+
"metadata": {
|
|
993
993
|
"$ref": "#/components/schemas/JsonLdNodeObject"
|
|
994
994
|
},
|
|
995
995
|
"blob": {
|
|
@@ -1065,7 +1065,7 @@
|
|
|
1065
1065
|
"type": "string",
|
|
1066
1066
|
"description": "The extension of the blob, will be detected if left undefined."
|
|
1067
1067
|
},
|
|
1068
|
-
"
|
|
1068
|
+
"metadata": {
|
|
1069
1069
|
"$ref": "#/components/schemas/JsonLdNodeObject"
|
|
1070
1070
|
}
|
|
1071
1071
|
},
|
|
@@ -70,11 +70,11 @@ The extension.
|
|
|
70
70
|
|
|
71
71
|
***
|
|
72
72
|
|
|
73
|
-
###
|
|
73
|
+
### metadata?
|
|
74
74
|
|
|
75
|
-
> `optional` **
|
|
75
|
+
> `optional` **metadata**: `IJsonLdNodeObject`
|
|
76
76
|
|
|
77
|
-
The
|
|
77
|
+
The metadata for the blob as JSON-LD.
|
|
78
78
|
|
|
79
79
|
***
|
|
80
80
|
|
|
@@ -50,9 +50,9 @@ Runtime name for the class.
|
|
|
50
50
|
|
|
51
51
|
### create()
|
|
52
52
|
|
|
53
|
-
> **create**(`blob`, `encodingFormat`?, `fileExtension`?, `
|
|
53
|
+
> **create**(`blob`, `encodingFormat`?, `fileExtension`?, `metadata`?, `namespace`?, `userIdentity`?, `nodeIdentity`?): `Promise`\<`string`\>
|
|
54
54
|
|
|
55
|
-
Create the blob with some
|
|
55
|
+
Create the blob with some metadata.
|
|
56
56
|
|
|
57
57
|
#### Parameters
|
|
58
58
|
|
|
@@ -74,11 +74,11 @@ Mime type for the blob, will be detected if left undefined.
|
|
|
74
74
|
|
|
75
75
|
Extension for the blob, will be detected if left undefined.
|
|
76
76
|
|
|
77
|
-
#####
|
|
77
|
+
##### metadata?
|
|
78
78
|
|
|
79
79
|
`IJsonLdNodeObject`
|
|
80
80
|
|
|
81
|
-
Data for the custom
|
|
81
|
+
Data for the custom metadata as JSON-LD.
|
|
82
82
|
|
|
83
83
|
##### namespace?
|
|
84
84
|
|
|
@@ -128,7 +128,7 @@ The id of the blob to get in urn format.
|
|
|
128
128
|
|
|
129
129
|
`boolean`
|
|
130
130
|
|
|
131
|
-
Include the content, or just get the
|
|
131
|
+
Include the content, or just get the metadata.
|
|
132
132
|
|
|
133
133
|
##### userIdentity?
|
|
134
134
|
|
|
@@ -160,9 +160,9 @@ Not found error if the blob cannot be found.
|
|
|
160
160
|
|
|
161
161
|
### update()
|
|
162
162
|
|
|
163
|
-
> **update**(`id`, `encodingFormat`?, `fileExtension`?, `
|
|
163
|
+
> **update**(`id`, `encodingFormat`?, `fileExtension`?, `metadata`?, `userIdentity`?, `nodeIdentity`?): `Promise`\<`void`\>
|
|
164
164
|
|
|
165
|
-
Update the blob with
|
|
165
|
+
Update the blob with metadata.
|
|
166
166
|
|
|
167
167
|
#### Parameters
|
|
168
168
|
|
|
@@ -184,11 +184,11 @@ Mime type for the blob, will be detected if left undefined.
|
|
|
184
184
|
|
|
185
185
|
Extension for the blob, will be detected if left undefined.
|
|
186
186
|
|
|
187
|
-
#####
|
|
187
|
+
##### metadata?
|
|
188
188
|
|
|
189
189
|
`IJsonLdNodeObject`
|
|
190
190
|
|
|
191
|
-
Data for the custom
|
|
191
|
+
Data for the custom metadata as JSON-LD.
|
|
192
192
|
|
|
193
193
|
##### userIdentity?
|
|
194
194
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@twin.org/blob-storage-service",
|
|
3
|
-
"version": "0.0.1-next.
|
|
3
|
+
"version": "0.0.1-next.26",
|
|
4
4
|
"description": "Blob storage contract implementation and REST endpoint definitions",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -15,7 +15,7 @@
|
|
|
15
15
|
},
|
|
16
16
|
"dependencies": {
|
|
17
17
|
"@twin.org/api-models": "next",
|
|
18
|
-
"@twin.org/blob-storage-models": "0.0.1-next.
|
|
18
|
+
"@twin.org/blob-storage-models": "0.0.1-next.26",
|
|
19
19
|
"@twin.org/core": "next",
|
|
20
20
|
"@twin.org/crypto": "next",
|
|
21
21
|
"@twin.org/data-json-ld": "next",
|