@twin.org/blob-storage-service 0.0.1-next.25 → 0.0.1-next.27

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.
@@ -54,7 +54,7 @@ function generateRestRoutesBlobStorage(baseRouteName, componentName, options) {
54
54
  request: {
55
55
  body: {
56
56
  blob: "VGhlIHF1aWNrIGJyb3duIGZveCBqdW1wcyBvdmVyIHRoZSBsYXp5IGRvZw==",
57
- annotationObject: {
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 annotation for an item from ${lowerName}`,
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
- annotationObject: {
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
- annotationObject: {
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 annotation for an item in ${lowerName}`,
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
- annotationObject: {
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
- annotationObject: {
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
- annotationObject: {
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.annotationObject, request.body.namespace, httpRequestContext.userIdentity, httpRequestContext.nodeIdentity);
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 annotation.
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.annotationObject, httpRequestContext.userIdentity, httpRequestContext.nodeIdentity);
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 annotation.
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 annotation.
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 annotationObject Data for the custom annotation as JSON-LD.
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, annotationObject, namespace, userIdentity, nodeIdentity) {
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(annotationObject)) {
603
+ if (core.Is.object(metadata)) {
604
604
  const validationFailures = [];
605
- dataJsonLd.JsonLdHelper.validate(annotationObject, validationFailures);
606
- core.Validation.asValidationError(this.CLASS_NAME, "annotationObject", validationFailures);
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
- annotationObject
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 annotation.
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 annotation.
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 annotationObject Data for the custom annotation as JSON-LD.
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, annotationObject, userIdentity, nodeIdentity) {
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(annotationObject)) {
714
+ if (core.Is.object(metadata)) {
715
715
  const validationFailures = [];
716
- await dataJsonLd.JsonLdHelper.validate(annotationObject, validationFailures);
717
- core.Validation.asValidationError(this.CLASS_NAME, "annotationObject", validationFailures);
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
- annotationObject: annotationObject ?? blobEntry.annotationObject
728
+ metadata: metadata ?? blobEntry.metadata
729
729
  };
730
730
  const conditions = [];
731
731
  if (this._includeUserIdentity) {
@@ -833,7 +833,7 @@ class BlobStorageService {
833
833
  for (const entry of result.entities) {
834
834
  // The entries are never Partial as we don't allow custom property requests.
835
835
  entriesJsonLd.push(this.entryToJsonLd(entry));
836
- context = dataJsonLd.JsonLdProcessor.combineContexts(context, entry.annotationObject?.["@context"]);
836
+ context = dataJsonLd.JsonLdProcessor.combineContexts(context, entry.metadata?.["@context"]);
837
837
  }
838
838
  const jsonLd = {
839
839
  "@context": context,
@@ -924,7 +924,7 @@ class BlobStorageService {
924
924
  blobStorageModels.BlobStorageTypes.ContextRoot,
925
925
  blobStorageModels.BlobStorageTypes.ContextRootCommon,
926
926
  standardsSchemaOrg.SchemaOrgTypes.ContextRoot
927
- ], entry?.annotationObject?.["@context"]),
927
+ ], entry?.metadata?.["@context"]),
928
928
  id: entry.id,
929
929
  type: blobStorageModels.BlobStorageTypes.Entry,
930
930
  dateCreated: entry.dateCreated,
@@ -933,7 +933,7 @@ class BlobStorageService {
933
933
  blobHash: entry.blobHash,
934
934
  encodingFormat: entry?.encodingFormat,
935
935
  fileExtension: entry?.fileExtension,
936
- annotationObject: entry?.annotationObject,
936
+ metadata: entry?.metadata,
937
937
  blob: core.Is.uint8Array(blob) ? core.Converter.bytesToBase64(blob) : undefined
938
938
  };
939
939
  return jsonLd;
@@ -973,9 +973,9 @@ exports.BlobStorageEntry = class BlobStorageEntry {
973
973
  */
974
974
  fileExtension;
975
975
  /**
976
- * The annotation object for the blob as JSON-LD.
976
+ * The metadata for the blob as JSON-LD.
977
977
  */
978
- annotationObject;
978
+ metadata;
979
979
  /**
980
980
  * The user identity that created the blob.
981
981
  */
@@ -994,7 +994,12 @@ __decorate([
994
994
  __metadata("design:type", String)
995
995
  ], exports.BlobStorageEntry.prototype, "dateCreated", void 0);
996
996
  __decorate([
997
- entity.property({ type: "string", format: "date-time", sortDirection: entity.SortDirection.Descending }),
997
+ entity.property({
998
+ type: "string",
999
+ format: "date-time",
1000
+ sortDirection: entity.SortDirection.Descending,
1001
+ optional: true
1002
+ }),
998
1003
  __metadata("design:type", String)
999
1004
  ], exports.BlobStorageEntry.prototype, "dateModified", void 0);
1000
1005
  __decorate([
@@ -1006,23 +1011,23 @@ __decorate([
1006
1011
  __metadata("design:type", String)
1007
1012
  ], exports.BlobStorageEntry.prototype, "blobHash", void 0);
1008
1013
  __decorate([
1009
- entity.property({ type: "string" }),
1014
+ entity.property({ type: "string", optional: true }),
1010
1015
  __metadata("design:type", String)
1011
1016
  ], exports.BlobStorageEntry.prototype, "encodingFormat", void 0);
1012
1017
  __decorate([
1013
- entity.property({ type: "string" }),
1018
+ entity.property({ type: "string", optional: true }),
1014
1019
  __metadata("design:type", String)
1015
1020
  ], exports.BlobStorageEntry.prototype, "fileExtension", void 0);
1016
1021
  __decorate([
1017
- entity.property({ type: "object", itemTypeRef: "IJsonLdNodeObject" }),
1022
+ entity.property({ type: "object", itemTypeRef: "IJsonLdNodeObject", optional: true }),
1018
1023
  __metadata("design:type", Object)
1019
- ], exports.BlobStorageEntry.prototype, "annotationObject", void 0);
1024
+ ], exports.BlobStorageEntry.prototype, "metadata", void 0);
1020
1025
  __decorate([
1021
- entity.property({ type: "string" }),
1026
+ entity.property({ type: "string", optional: true }),
1022
1027
  __metadata("design:type", String)
1023
1028
  ], exports.BlobStorageEntry.prototype, "userIdentity", void 0);
1024
1029
  __decorate([
1025
- entity.property({ type: "string" }),
1030
+ entity.property({ type: "string", optional: true }),
1026
1031
  __metadata("design:type", String)
1027
1032
  ], exports.BlobStorageEntry.prototype, "nodeIdentity", void 0);
1028
1033
  exports.BlobStorageEntry = __decorate([
@@ -52,7 +52,7 @@ function generateRestRoutesBlobStorage(baseRouteName, componentName, options) {
52
52
  request: {
53
53
  body: {
54
54
  blob: "VGhlIHF1aWNrIGJyb3duIGZveCBqdW1wcyBvdmVyIHRoZSBsYXp5IGRvZw==",
55
- annotationObject: {
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 annotation for an item from ${lowerName}`,
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
- annotationObject: {
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
- annotationObject: {
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 annotation for an item in ${lowerName}`,
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
- annotationObject: {
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
- annotationObject: {
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
- annotationObject: {
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.annotationObject, request.body.namespace, httpRequestContext.userIdentity, httpRequestContext.nodeIdentity);
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 annotation.
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.annotationObject, httpRequestContext.userIdentity, httpRequestContext.nodeIdentity);
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 annotation.
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 annotation.
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 annotationObject Data for the custom annotation as JSON-LD.
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, annotationObject, namespace, userIdentity, nodeIdentity) {
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(annotationObject)) {
601
+ if (Is.object(metadata)) {
602
602
  const validationFailures = [];
603
- JsonLdHelper.validate(annotationObject, validationFailures);
604
- Validation.asValidationError(this.CLASS_NAME, "annotationObject", validationFailures);
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
- annotationObject
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 annotation.
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 annotation.
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 annotationObject Data for the custom annotation as JSON-LD.
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, annotationObject, userIdentity, nodeIdentity) {
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(annotationObject)) {
712
+ if (Is.object(metadata)) {
713
713
  const validationFailures = [];
714
- await JsonLdHelper.validate(annotationObject, validationFailures);
715
- Validation.asValidationError(this.CLASS_NAME, "annotationObject", validationFailures);
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
- annotationObject: annotationObject ?? blobEntry.annotationObject
726
+ metadata: metadata ?? blobEntry.metadata
727
727
  };
728
728
  const conditions = [];
729
729
  if (this._includeUserIdentity) {
@@ -831,7 +831,7 @@ class BlobStorageService {
831
831
  for (const entry of result.entities) {
832
832
  // The entries are never Partial as we don't allow custom property requests.
833
833
  entriesJsonLd.push(this.entryToJsonLd(entry));
834
- context = JsonLdProcessor.combineContexts(context, entry.annotationObject?.["@context"]);
834
+ context = JsonLdProcessor.combineContexts(context, entry.metadata?.["@context"]);
835
835
  }
836
836
  const jsonLd = {
837
837
  "@context": context,
@@ -922,7 +922,7 @@ class BlobStorageService {
922
922
  BlobStorageTypes.ContextRoot,
923
923
  BlobStorageTypes.ContextRootCommon,
924
924
  SchemaOrgTypes.ContextRoot
925
- ], entry?.annotationObject?.["@context"]),
925
+ ], entry?.metadata?.["@context"]),
926
926
  id: entry.id,
927
927
  type: BlobStorageTypes.Entry,
928
928
  dateCreated: entry.dateCreated,
@@ -931,7 +931,7 @@ class BlobStorageService {
931
931
  blobHash: entry.blobHash,
932
932
  encodingFormat: entry?.encodingFormat,
933
933
  fileExtension: entry?.fileExtension,
934
- annotationObject: entry?.annotationObject,
934
+ metadata: entry?.metadata,
935
935
  blob: Is.uint8Array(blob) ? Converter.bytesToBase64(blob) : undefined
936
936
  };
937
937
  return jsonLd;
@@ -971,9 +971,9 @@ let BlobStorageEntry = class BlobStorageEntry {
971
971
  */
972
972
  fileExtension;
973
973
  /**
974
- * The annotation object for the blob as JSON-LD.
974
+ * The metadata for the blob as JSON-LD.
975
975
  */
976
- annotationObject;
976
+ metadata;
977
977
  /**
978
978
  * The user identity that created the blob.
979
979
  */
@@ -992,7 +992,12 @@ __decorate([
992
992
  __metadata("design:type", String)
993
993
  ], BlobStorageEntry.prototype, "dateCreated", void 0);
994
994
  __decorate([
995
- property({ type: "string", format: "date-time", sortDirection: SortDirection.Descending }),
995
+ property({
996
+ type: "string",
997
+ format: "date-time",
998
+ sortDirection: SortDirection.Descending,
999
+ optional: true
1000
+ }),
996
1001
  __metadata("design:type", String)
997
1002
  ], BlobStorageEntry.prototype, "dateModified", void 0);
998
1003
  __decorate([
@@ -1004,23 +1009,23 @@ __decorate([
1004
1009
  __metadata("design:type", String)
1005
1010
  ], BlobStorageEntry.prototype, "blobHash", void 0);
1006
1011
  __decorate([
1007
- property({ type: "string" }),
1012
+ property({ type: "string", optional: true }),
1008
1013
  __metadata("design:type", String)
1009
1014
  ], BlobStorageEntry.prototype, "encodingFormat", void 0);
1010
1015
  __decorate([
1011
- property({ type: "string" }),
1016
+ property({ type: "string", optional: true }),
1012
1017
  __metadata("design:type", String)
1013
1018
  ], BlobStorageEntry.prototype, "fileExtension", void 0);
1014
1019
  __decorate([
1015
- property({ type: "object", itemTypeRef: "IJsonLdNodeObject" }),
1020
+ property({ type: "object", itemTypeRef: "IJsonLdNodeObject", optional: true }),
1016
1021
  __metadata("design:type", Object)
1017
- ], BlobStorageEntry.prototype, "annotationObject", void 0);
1022
+ ], BlobStorageEntry.prototype, "metadata", void 0);
1018
1023
  __decorate([
1019
- property({ type: "string" }),
1024
+ property({ type: "string", optional: true }),
1020
1025
  __metadata("design:type", String)
1021
1026
  ], BlobStorageEntry.prototype, "userIdentity", void 0);
1022
1027
  __decorate([
1023
- property({ type: "string" }),
1028
+ property({ type: "string", optional: true }),
1024
1029
  __metadata("design:type", String)
1025
1030
  ], BlobStorageEntry.prototype, "nodeIdentity", void 0);
1026
1031
  BlobStorageEntry = __decorate([
@@ -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 annotation.
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 annotation.
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 annotationObject Data for the custom annotation as JSON-LD.
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, annotationObject?: IJsonLdNodeObject, namespace?: string, userIdentity?: string, nodeIdentity?: string): Promise<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 annotation.
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 annotation.
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 annotationObject Data for the custom annotation as JSON-LD.
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, annotationObject?: IJsonLdNodeObject, userIdentity?: string, nodeIdentity?: string): Promise<void>;
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 annotation object for the blob as JSON-LD.
35
+ * The metadata for the blob as JSON-LD.
36
36
  */
37
- annotationObject?: IJsonLdNodeObject;
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 annotation.
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
@@ -1,5 +1,5 @@
1
1
  # @twin.org/blob-storage-service - Changelog
2
2
 
3
- ## v0.0.1-next.25
3
+ ## v0.0.1-next.27
4
4
 
5
5
  - Initial Release
@@ -45,7 +45,7 @@
45
45
  "blobStorageCreateRequestExample": {
46
46
  "value": {
47
47
  "blob": "VGhlIHF1aWNrIGJyb3duIGZveCBqdW1wcyBvdmVyIHRoZSBsYXp5IGRvZw==",
48
- "annotationObject": {
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
- "annotationObject": {
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
- "annotationObject": {
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 annotation for an item from blob storage",
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 annotation is returned.",
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
- "annotationObject": {
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
- "annotationObject": {
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 annotation for an item in blob storage",
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
- "annotationObject": {
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
- "annotationObject": {
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
- "annotationObject": {
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
- "annotationObject": {
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
- ### annotationObject?
73
+ ### metadata?
74
74
 
75
- > `optional` **annotationObject**: `IJsonLdNodeObject`
75
+ > `optional` **metadata**: `IJsonLdNodeObject`
76
76
 
77
- The annotation object for the blob as JSON-LD.
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`?, `annotationObject`?, `namespace`?, `userIdentity`?, `nodeIdentity`?): `Promise`\<`string`\>
53
+ > **create**(`blob`, `encodingFormat`?, `fileExtension`?, `metadata`?, `namespace`?, `userIdentity`?, `nodeIdentity`?): `Promise`\<`string`\>
54
54
 
55
- Create the blob with some annotation.
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
- ##### annotationObject?
77
+ ##### metadata?
78
78
 
79
79
  `IJsonLdNodeObject`
80
80
 
81
- Data for the custom annotation as JSON-LD.
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 annotation.
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`?, `annotationObject`?, `userIdentity`?, `nodeIdentity`?): `Promise`\<`void`\>
163
+ > **update**(`id`, `encodingFormat`?, `fileExtension`?, `metadata`?, `userIdentity`?, `nodeIdentity`?): `Promise`\<`void`\>
164
164
 
165
- Update the blob with annotation.
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
- ##### annotationObject?
187
+ ##### metadata?
188
188
 
189
189
  `IJsonLdNodeObject`
190
190
 
191
- Data for the custom annotation as JSON-LD.
191
+ Data for the custom metadata as JSON-LD.
192
192
 
193
193
  ##### userIdentity?
194
194
 
@@ -2,7 +2,7 @@
2
2
 
3
3
  > **blobStorageUpdate**(`httpRequestContext`, `componentName`, `request`): `Promise`\<`INoContentResponse`\>
4
4
 
5
- Update the blob storage annotation.
5
+ Update the blob storage metadata.
6
6
 
7
7
  ## Parameters
8
8
 
@@ -8,7 +8,7 @@ Options for the Blob Storage Service constructor.
8
8
 
9
9
  > `optional` **entryEntityStorageType**: `string`
10
10
 
11
- The type of the storage connector for the annotation.
11
+ The type of the storage connector for the metadata.
12
12
 
13
13
  #### Default
14
14
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@twin.org/blob-storage-service",
3
- "version": "0.0.1-next.25",
3
+ "version": "0.0.1-next.27",
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.25",
18
+ "@twin.org/blob-storage-models": "0.0.1-next.27",
19
19
  "@twin.org/core": "next",
20
20
  "@twin.org/crypto": "next",
21
21
  "@twin.org/data-json-ld": "next",