@twin.org/blob-storage-models 0.0.3-next.1 → 0.0.3-next.11

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (50) hide show
  1. package/README.md +1 -1
  2. package/dist/es/dataTypes/blobStorageDataTypes.js +4 -4
  3. package/dist/es/dataTypes/blobStorageDataTypes.js.map +1 -1
  4. package/dist/es/index.js +1 -0
  5. package/dist/es/index.js.map +1 -1
  6. package/dist/es/models/IBlobStorageComponent.js.map +1 -1
  7. package/dist/es/models/IBlobStorageConnector.js.map +1 -1
  8. package/dist/es/models/IBlobStorageEntry.js.map +1 -1
  9. package/dist/es/models/IBlobStorageEntryList.js.map +1 -1
  10. package/dist/es/models/api/IBlobStorageEmptyRequest.js +4 -0
  11. package/dist/es/models/api/IBlobStorageEmptyRequest.js.map +1 -0
  12. package/dist/es/models/api/IBlobStorageGetContentRequest.js.map +1 -1
  13. package/dist/es/models/api/IBlobStorageGetRequest.js.map +1 -1
  14. package/dist/es/models/api/IBlobStorageListResponse.js.map +1 -1
  15. package/dist/es/models/blobStorageContexts.js +20 -4
  16. package/dist/es/models/blobStorageContexts.js.map +1 -1
  17. package/dist/es/schemas/BlobStorageCompressionType.json +10 -4
  18. package/dist/es/schemas/BlobStorageEntry.json +8 -11
  19. package/dist/types/index.d.ts +1 -0
  20. package/dist/types/models/IBlobStorageComponent.d.ts +9 -1
  21. package/dist/types/models/IBlobStorageConnector.d.ts +5 -0
  22. package/dist/types/models/IBlobStorageEntry.d.ts +14 -4
  23. package/dist/types/models/IBlobStorageEntryList.d.ts +3 -7
  24. package/dist/types/models/api/IBlobStorageEmptyRequest.d.ts +5 -0
  25. package/dist/types/models/api/IBlobStorageGetContentRequest.d.ts +2 -2
  26. package/dist/types/models/api/IBlobStorageGetRequest.d.ts +2 -2
  27. package/dist/types/models/api/IBlobStorageListResponse.d.ts +1 -0
  28. package/dist/types/models/blobStorageContexts.d.ts +20 -4
  29. package/docs/changelog.md +150 -53
  30. package/docs/examples.md +23 -1
  31. package/docs/reference/classes/BlobStorageDataTypes.md +1 -1
  32. package/docs/reference/index.md +1 -0
  33. package/docs/reference/interfaces/IBlobStorageComponent.md +23 -9
  34. package/docs/reference/interfaces/IBlobStorageConnector.md +17 -3
  35. package/docs/reference/interfaces/IBlobStorageCreateRequest.md +8 -8
  36. package/docs/reference/interfaces/IBlobStorageEmptyRequest.md +3 -0
  37. package/docs/reference/interfaces/IBlobStorageEntry.md +22 -22
  38. package/docs/reference/interfaces/IBlobStorageEntryList.md +3 -11
  39. package/docs/reference/interfaces/IBlobStorageGetContentRequest.md +7 -7
  40. package/docs/reference/interfaces/IBlobStorageGetContentResponse.md +1 -1
  41. package/docs/reference/interfaces/IBlobStorageGetRequest.md +8 -8
  42. package/docs/reference/interfaces/IBlobStorageGetResponse.md +3 -3
  43. package/docs/reference/interfaces/IBlobStorageListRequest.md +9 -9
  44. package/docs/reference/interfaces/IBlobStorageListResponse.md +7 -3
  45. package/docs/reference/interfaces/IBlobStorageRemoveRequest.md +1 -1
  46. package/docs/reference/interfaces/IBlobStorageUpdateRequest.md +5 -5
  47. package/docs/reference/variables/BlobStorageCompressionType.md +2 -2
  48. package/docs/reference/variables/BlobStorageContexts.md +30 -6
  49. package/docs/reference/variables/BlobStorageTypes.md +2 -2
  50. package/package.json +4 -4
package/README.md CHANGED
@@ -1,6 +1,6 @@
1
1
  # TWIN Blob Storage Models
2
2
 
3
- Models which define the structure of the blob storage contracts and connectors.
3
+ This package defines shared models, contracts, and schemas for blob identifiers, metadata, and storage operations. It provides the common language used by service, client, and connector packages so integrations remain consistent across environments.
4
4
 
5
5
  ## Installation
6
6
 
@@ -13,14 +13,14 @@ export class BlobStorageDataTypes {
13
13
  * Register all the data types.
14
14
  */
15
15
  static registerTypes() {
16
- DataTypeHandlerFactory.register(`${BlobStorageContexts.ContextRoot}${BlobStorageTypes.Entry}`, () => ({
17
- context: BlobStorageContexts.ContextRoot,
16
+ DataTypeHandlerFactory.register(`${BlobStorageContexts.Namespace}${BlobStorageTypes.Entry}`, () => ({
17
+ namespace: BlobStorageContexts.Namespace,
18
18
  type: BlobStorageTypes.Entry,
19
19
  defaultValue: {},
20
20
  jsonSchema: async () => BlobStorageEntrySchema
21
21
  }));
22
- DataTypeHandlerFactory.register(`${BlobStorageContexts.ContextRoot}${BlobStorageTypes.CompressionType}`, () => ({
23
- context: BlobStorageContexts.ContextRoot,
22
+ DataTypeHandlerFactory.register(`${BlobStorageContexts.Namespace}${BlobStorageTypes.CompressionType}`, () => ({
23
+ namespace: BlobStorageContexts.Namespace,
24
24
  type: BlobStorageTypes.CompressionType,
25
25
  defaultValue: {},
26
26
  jsonSchema: async () => BlobStorageCompressionTypeSchema
@@ -1 +1 @@
1
- {"version":3,"file":"blobStorageDataTypes.js","sourceRoot":"","sources":["../../../src/dataTypes/blobStorageDataTypes.ts"],"names":[],"mappings":"AAAA,gCAAgC;AAChC,uCAAuC;AACvC,OAAO,EAAE,sBAAsB,EAAoB,MAAM,qBAAqB,CAAC;AAC/E,OAAO,EAAE,mBAAmB,EAAE,MAAM,kCAAkC,CAAC;AACvE,OAAO,EAAE,gBAAgB,EAAE,MAAM,+BAA+B,CAAC;AACjE,OAAO,gCAAgC,MAAM,4CAA4C,CAAC,OAAO,IAAI,EAAE,MAAM,EAAE,CAAC;AAChH,OAAO,sBAAsB,MAAM,kCAAkC,CAAC,OAAO,IAAI,EAAE,MAAM,EAAE,CAAC;AAE5F;;GAEG;AACH,MAAM,OAAO,oBAAoB;IAChC;;OAEG;IACI,MAAM,CAAC,aAAa;QAC1B,sBAAsB,CAAC,QAAQ,CAC9B,GAAG,mBAAmB,CAAC,WAAW,GAAG,gBAAgB,CAAC,KAAK,EAAE,EAC7D,GAAG,EAAE,CAAC,CAAC;YACN,OAAO,EAAE,mBAAmB,CAAC,WAAW;YACxC,IAAI,EAAE,gBAAgB,CAAC,KAAK;YAC5B,YAAY,EAAE,EAAE;YAChB,UAAU,EAAE,KAAK,IAAI,EAAE,CAAC,sBAAqC;SAC7D,CAAC,CACF,CAAC;QAEF,sBAAsB,CAAC,QAAQ,CAC9B,GAAG,mBAAmB,CAAC,WAAW,GAAG,gBAAgB,CAAC,eAAe,EAAE,EACvE,GAAG,EAAE,CAAC,CAAC;YACN,OAAO,EAAE,mBAAmB,CAAC,WAAW;YACxC,IAAI,EAAE,gBAAgB,CAAC,eAAe;YACtC,YAAY,EAAE,EAAE;YAChB,UAAU,EAAE,KAAK,IAAI,EAAE,CAAC,gCAA+C;SACvE,CAAC,CACF,CAAC;IACH,CAAC;CACD","sourcesContent":["// Copyright 2024 IOTA Stiftung.\n// SPDX-License-Identifier: Apache-2.0.\nimport { DataTypeHandlerFactory, type IJsonSchema } from \"@twin.org/data-core\";\nimport { BlobStorageContexts } from \"../models/blobStorageContexts.js\";\nimport { BlobStorageTypes } from \"../models/blobStorageTypes.js\";\nimport BlobStorageCompressionTypeSchema from \"../schemas/BlobStorageCompressionType.json\" with { type: \"json\" };\nimport BlobStorageEntrySchema from \"../schemas/BlobStorageEntry.json\" with { type: \"json\" };\n\n/**\n * Handle all the data types for blob storage.\n */\nexport class BlobStorageDataTypes {\n\t/**\n\t * Register all the data types.\n\t */\n\tpublic static registerTypes(): void {\n\t\tDataTypeHandlerFactory.register(\n\t\t\t`${BlobStorageContexts.ContextRoot}${BlobStorageTypes.Entry}`,\n\t\t\t() => ({\n\t\t\t\tcontext: BlobStorageContexts.ContextRoot,\n\t\t\t\ttype: BlobStorageTypes.Entry,\n\t\t\t\tdefaultValue: {},\n\t\t\t\tjsonSchema: async () => BlobStorageEntrySchema as IJsonSchema\n\t\t\t})\n\t\t);\n\n\t\tDataTypeHandlerFactory.register(\n\t\t\t`${BlobStorageContexts.ContextRoot}${BlobStorageTypes.CompressionType}`,\n\t\t\t() => ({\n\t\t\t\tcontext: BlobStorageContexts.ContextRoot,\n\t\t\t\ttype: BlobStorageTypes.CompressionType,\n\t\t\t\tdefaultValue: {},\n\t\t\t\tjsonSchema: async () => BlobStorageCompressionTypeSchema as IJsonSchema\n\t\t\t})\n\t\t);\n\t}\n}\n"]}
1
+ {"version":3,"file":"blobStorageDataTypes.js","sourceRoot":"","sources":["../../../src/dataTypes/blobStorageDataTypes.ts"],"names":[],"mappings":"AAAA,gCAAgC;AAChC,uCAAuC;AACvC,OAAO,EAAE,sBAAsB,EAAoB,MAAM,qBAAqB,CAAC;AAC/E,OAAO,EAAE,mBAAmB,EAAE,MAAM,kCAAkC,CAAC;AACvE,OAAO,EAAE,gBAAgB,EAAE,MAAM,+BAA+B,CAAC;AACjE,OAAO,gCAAgC,MAAM,4CAA4C,CAAC,OAAO,IAAI,EAAE,MAAM,EAAE,CAAC;AAChH,OAAO,sBAAsB,MAAM,kCAAkC,CAAC,OAAO,IAAI,EAAE,MAAM,EAAE,CAAC;AAE5F;;GAEG;AACH,MAAM,OAAO,oBAAoB;IAChC;;OAEG;IACI,MAAM,CAAC,aAAa;QAC1B,sBAAsB,CAAC,QAAQ,CAC9B,GAAG,mBAAmB,CAAC,SAAS,GAAG,gBAAgB,CAAC,KAAK,EAAE,EAC3D,GAAG,EAAE,CAAC,CAAC;YACN,SAAS,EAAE,mBAAmB,CAAC,SAAS;YACxC,IAAI,EAAE,gBAAgB,CAAC,KAAK;YAC5B,YAAY,EAAE,EAAE;YAChB,UAAU,EAAE,KAAK,IAAI,EAAE,CAAC,sBAAqC;SAC7D,CAAC,CACF,CAAC;QAEF,sBAAsB,CAAC,QAAQ,CAC9B,GAAG,mBAAmB,CAAC,SAAS,GAAG,gBAAgB,CAAC,eAAe,EAAE,EACrE,GAAG,EAAE,CAAC,CAAC;YACN,SAAS,EAAE,mBAAmB,CAAC,SAAS;YACxC,IAAI,EAAE,gBAAgB,CAAC,eAAe;YACtC,YAAY,EAAE,EAAE;YAChB,UAAU,EAAE,KAAK,IAAI,EAAE,CAAC,gCAA+C;SACvE,CAAC,CACF,CAAC;IACH,CAAC;CACD","sourcesContent":["// Copyright 2024 IOTA Stiftung.\n// SPDX-License-Identifier: Apache-2.0.\nimport { DataTypeHandlerFactory, type IJsonSchema } from \"@twin.org/data-core\";\nimport { BlobStorageContexts } from \"../models/blobStorageContexts.js\";\nimport { BlobStorageTypes } from \"../models/blobStorageTypes.js\";\nimport BlobStorageCompressionTypeSchema from \"../schemas/BlobStorageCompressionType.json\" with { type: \"json\" };\nimport BlobStorageEntrySchema from \"../schemas/BlobStorageEntry.json\" with { type: \"json\" };\n\n/**\n * Handle all the data types for blob storage.\n */\nexport class BlobStorageDataTypes {\n\t/**\n\t * Register all the data types.\n\t */\n\tpublic static registerTypes(): void {\n\t\tDataTypeHandlerFactory.register(\n\t\t\t`${BlobStorageContexts.Namespace}${BlobStorageTypes.Entry}`,\n\t\t\t() => ({\n\t\t\t\tnamespace: BlobStorageContexts.Namespace,\n\t\t\t\ttype: BlobStorageTypes.Entry,\n\t\t\t\tdefaultValue: {},\n\t\t\t\tjsonSchema: async () => BlobStorageEntrySchema as IJsonSchema\n\t\t\t})\n\t\t);\n\n\t\tDataTypeHandlerFactory.register(\n\t\t\t`${BlobStorageContexts.Namespace}${BlobStorageTypes.CompressionType}`,\n\t\t\t() => ({\n\t\t\t\tnamespace: BlobStorageContexts.Namespace,\n\t\t\t\ttype: BlobStorageTypes.CompressionType,\n\t\t\t\tdefaultValue: {},\n\t\t\t\tjsonSchema: async () => BlobStorageCompressionTypeSchema as IJsonSchema\n\t\t\t})\n\t\t);\n\t}\n}\n"]}
package/dist/es/index.js CHANGED
@@ -3,6 +3,7 @@
3
3
  export * from "./dataTypes/blobStorageDataTypes.js";
4
4
  export * from "./factories/blobStorageConnectorFactory.js";
5
5
  export * from "./models/api/IBlobStorageCreateRequest.js";
6
+ export * from "./models/api/IBlobStorageEmptyRequest.js";
6
7
  export * from "./models/api/IBlobStorageGetContentRequest.js";
7
8
  export * from "./models/api/IBlobStorageGetContentResponse.js";
8
9
  export * from "./models/api/IBlobStorageGetRequest.js";
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,gCAAgC;AAChC,uCAAuC;AACvC,cAAc,qCAAqC,CAAC;AACpD,cAAc,4CAA4C,CAAC;AAC3D,cAAc,2CAA2C,CAAC;AAC1D,cAAc,+CAA+C,CAAC;AAC9D,cAAc,gDAAgD,CAAC;AAC/D,cAAc,wCAAwC,CAAC;AACvD,cAAc,yCAAyC,CAAC;AACxD,cAAc,yCAAyC,CAAC;AACxD,cAAc,0CAA0C,CAAC;AACzD,cAAc,2CAA2C,CAAC;AAC1D,cAAc,2CAA2C,CAAC;AAC1D,cAAc,wCAAwC,CAAC;AACvD,cAAc,iCAAiC,CAAC;AAChD,cAAc,8BAA8B,CAAC;AAC7C,cAAc,mCAAmC,CAAC;AAClD,cAAc,mCAAmC,CAAC;AAClD,cAAc,+BAA+B,CAAC;AAC9C,cAAc,mCAAmC,CAAC","sourcesContent":["// Copyright 2024 IOTA Stiftung.\n// SPDX-License-Identifier: Apache-2.0.\nexport * from \"./dataTypes/blobStorageDataTypes.js\";\nexport * from \"./factories/blobStorageConnectorFactory.js\";\nexport * from \"./models/api/IBlobStorageCreateRequest.js\";\nexport * from \"./models/api/IBlobStorageGetContentRequest.js\";\nexport * from \"./models/api/IBlobStorageGetContentResponse.js\";\nexport * from \"./models/api/IBlobStorageGetRequest.js\";\nexport * from \"./models/api/IBlobStorageGetResponse.js\";\nexport * from \"./models/api/IBlobStorageListRequest.js\";\nexport * from \"./models/api/IBlobStorageListResponse.js\";\nexport * from \"./models/api/IBlobStorageRemoveRequest.js\";\nexport * from \"./models/api/IBlobStorageUpdateRequest.js\";\nexport * from \"./models/blobStorageCompressionType.js\";\nexport * from \"./models/blobStorageContexts.js\";\nexport * from \"./models/blobStorageTypes.js\";\nexport * from \"./models/IBlobStorageComponent.js\";\nexport * from \"./models/IBlobStorageConnector.js\";\nexport * from \"./models/IBlobStorageEntry.js\";\nexport * from \"./models/IBlobStorageEntryList.js\";\n"]}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,gCAAgC;AAChC,uCAAuC;AACvC,cAAc,qCAAqC,CAAC;AACpD,cAAc,4CAA4C,CAAC;AAC3D,cAAc,2CAA2C,CAAC;AAC1D,cAAc,0CAA0C,CAAC;AACzD,cAAc,+CAA+C,CAAC;AAC9D,cAAc,gDAAgD,CAAC;AAC/D,cAAc,wCAAwC,CAAC;AACvD,cAAc,yCAAyC,CAAC;AACxD,cAAc,yCAAyC,CAAC;AACxD,cAAc,0CAA0C,CAAC;AACzD,cAAc,2CAA2C,CAAC;AAC1D,cAAc,2CAA2C,CAAC;AAC1D,cAAc,wCAAwC,CAAC;AACvD,cAAc,iCAAiC,CAAC;AAChD,cAAc,8BAA8B,CAAC;AAC7C,cAAc,mCAAmC,CAAC;AAClD,cAAc,mCAAmC,CAAC;AAClD,cAAc,+BAA+B,CAAC;AAC9C,cAAc,mCAAmC,CAAC","sourcesContent":["// Copyright 2024 IOTA Stiftung.\n// SPDX-License-Identifier: Apache-2.0.\nexport * from \"./dataTypes/blobStorageDataTypes.js\";\nexport * from \"./factories/blobStorageConnectorFactory.js\";\nexport * from \"./models/api/IBlobStorageCreateRequest.js\";\nexport * from \"./models/api/IBlobStorageEmptyRequest.js\";\nexport * from \"./models/api/IBlobStorageGetContentRequest.js\";\nexport * from \"./models/api/IBlobStorageGetContentResponse.js\";\nexport * from \"./models/api/IBlobStorageGetRequest.js\";\nexport * from \"./models/api/IBlobStorageGetResponse.js\";\nexport * from \"./models/api/IBlobStorageListRequest.js\";\nexport * from \"./models/api/IBlobStorageListResponse.js\";\nexport * from \"./models/api/IBlobStorageRemoveRequest.js\";\nexport * from \"./models/api/IBlobStorageUpdateRequest.js\";\nexport * from \"./models/blobStorageCompressionType.js\";\nexport * from \"./models/blobStorageContexts.js\";\nexport * from \"./models/blobStorageTypes.js\";\nexport * from \"./models/IBlobStorageComponent.js\";\nexport * from \"./models/IBlobStorageConnector.js\";\nexport * from \"./models/IBlobStorageEntry.js\";\nexport * from \"./models/IBlobStorageEntryList.js\";\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"IBlobStorageComponent.js","sourceRoot":"","sources":["../../../src/models/IBlobStorageComponent.ts"],"names":[],"mappings":"","sourcesContent":["// Copyright 2024 IOTA Stiftung.\n// SPDX-License-Identifier: Apache-2.0.\nimport type { IComponent } from \"@twin.org/core\";\nimport type { IJsonLdNodeObject } from \"@twin.org/data-json-ld\";\nimport type { EntityCondition, SortDirection } from \"@twin.org/entity\";\nimport type { BlobStorageCompressionType } from \"./blobStorageCompressionType.js\";\nimport type { IBlobStorageEntry } from \"./IBlobStorageEntry.js\";\nimport type { IBlobStorageEntryList } from \"./IBlobStorageEntryList.js\";\n\n/**\n * Interface describing an blob storage component.\n */\nexport interface IBlobStorageComponent extends IComponent {\n\t/**\n\t * Create the blob with some metadata.\n\t * @param blob The data for the blob in base64 format.\n\t * @param encodingFormat Mime type for the blob, will be detected if left undefined.\n\t * @param fileExtension Extension for the blob, will be detected if left undefined.\n\t * @param metadata Data for the custom metadata as JSON-LD.\n\t * @param options Optional options for the creation of the blob.\n\t * @param options.disableEncryption Disables encryption if enabled by default.\n\t * @param options.overrideVaultKeyId Use a different vault key id for encryption, if not provided the default vault key id will be used.\n\t * @param options.compress Optional compression type to use for the blob, defaults to no compression.\n\t * @param options.namespace The namespace to use for storing, defaults to component configured namespace.\n\t * @returns The id of the stored blob in urn format.\n\t */\n\tcreate(\n\t\tblob: string,\n\t\tencodingFormat?: string,\n\t\tfileExtension?: string,\n\t\tmetadata?: IJsonLdNodeObject,\n\t\toptions?: {\n\t\t\tdisableEncryption?: boolean;\n\t\t\toverrideVaultKeyId?: string;\n\t\t\tcompress?: BlobStorageCompressionType;\n\t\t\tnamespace?: string;\n\t\t}\n\t): Promise<string>;\n\n\t/**\n\t * Get the blob and metadata.\n\t * @param id The id of the blob to get in urn format.\n\t * @param options Optional options for the retrieval of the blob.\n\t * @param options.includeContent Include the content, or just get the metadata.\n\t * @param options.overrideVaultKeyId Use a different vault key id for decryption, if not provided the default vault key id will be used.\n\t * @param options.decompress If the content should be decompressed, if it was compressed when stored, defaults to true.\n\t * @returns The data and metadata for the blob if it can be found.\n\t * @throws Not found error if the blob cannot be found.\n\t */\n\tget(\n\t\tid: string,\n\t\toptions?: {\n\t\t\tincludeContent?: boolean;\n\t\t\tdecompress?: boolean;\n\t\t\toverrideVaultKeyId?: string;\n\t\t}\n\t): Promise<IBlobStorageEntry>;\n\n\t/**\n\t * Update the blob with metadata.\n\t * @param id The id of the blob metadata to update.\n\t * @param encodingFormat Mime type for the blob, will be detected if left undefined.\n\t * @param fileExtension Extension for the blob, will be detected if left undefined.\n\t * @param metadata Data for the custom metadata as JSON-LD.\n\t * @returns Nothing.\n\t * @throws Not found error if the blob cannot be found.\n\t */\n\tupdate(\n\t\tid: string,\n\t\tencodingFormat?: string,\n\t\tfileExtension?: string,\n\t\tmetadata?: IJsonLdNodeObject\n\t): Promise<void>;\n\n\t/**\n\t * Remove the blob.\n\t * @param id The id of the blob to remove in urn format.\n\t * @returns Nothing.\n\t * @throws Not found error if the blob cannot be found.\n\t */\n\tremove(id: string): Promise<void>;\n\n\t/**\n\t * Query all the blob storage entries which match the conditions.\n\t * @param conditions The conditions to match for the entries.\n\t * @param orderBy The order for the results, defaults to created.\n\t * @param orderByDirection The direction for the order, defaults to descending.\n\t * @param cursor The cursor to request the next page of entries.\n\t * @param limit The suggested number of entries to return in each chunk, in some scenarios can return a different amount.\n\t * @returns All the entries for the storage matching the conditions,\n\t * and a cursor which can be used to request more entities.\n\t */\n\tquery(\n\t\tconditions?: EntityCondition<IBlobStorageEntry>,\n\t\torderBy?: keyof Pick<IBlobStorageEntry, \"dateCreated\" | \"dateModified\">,\n\t\torderByDirection?: SortDirection,\n\t\tcursor?: string,\n\t\tlimit?: number\n\t): Promise<IBlobStorageEntryList>;\n}\n"]}
1
+ {"version":3,"file":"IBlobStorageComponent.js","sourceRoot":"","sources":["../../../src/models/IBlobStorageComponent.ts"],"names":[],"mappings":"","sourcesContent":["// Copyright 2024 IOTA Stiftung.\n// SPDX-License-Identifier: Apache-2.0.\nimport type { IComponent } from \"@twin.org/core\";\nimport type { IJsonLdNodeObject } from \"@twin.org/data-json-ld\";\nimport type { EntityCondition, SortDirection } from \"@twin.org/entity\";\nimport type { BlobStorageCompressionType } from \"./blobStorageCompressionType.js\";\nimport type { IBlobStorageEntry } from \"./IBlobStorageEntry.js\";\nimport type { IBlobStorageEntryList } from \"./IBlobStorageEntryList.js\";\n\n/**\n * Interface describing an blob storage component.\n */\nexport interface IBlobStorageComponent extends IComponent {\n\t/**\n\t * Create the blob with some metadata.\n\t * @param blob The data for the blob in base64 format.\n\t * @param encodingFormat Mime type for the blob, will be detected if left undefined.\n\t * @param fileExtension Extension for the blob, will be detected if left undefined.\n\t * @param metadata Data for the custom metadata as JSON-LD.\n\t * @param options Optional options for the creation of the blob.\n\t * @param options.disableEncryption Disables encryption if enabled by default.\n\t * @param options.overrideVaultKeyId Use a different vault key id for encryption, if not provided the default vault key id will be used.\n\t * @param options.compress Optional compression type to use for the blob, defaults to no compression.\n\t * @param options.namespace The namespace to use for storing, defaults to component configured namespace.\n\t * @returns The id of the stored blob in urn format.\n\t */\n\tcreate(\n\t\tblob: string,\n\t\tencodingFormat?: string,\n\t\tfileExtension?: string,\n\t\tmetadata?: IJsonLdNodeObject,\n\t\toptions?: {\n\t\t\tdisableEncryption?: boolean;\n\t\t\toverrideVaultKeyId?: string;\n\t\t\tcompress?: BlobStorageCompressionType;\n\t\t\tnamespace?: string;\n\t\t}\n\t): Promise<string>;\n\n\t/**\n\t * Get the blob and metadata.\n\t * @param id The id of the blob to get in urn format.\n\t * @param options Optional options for the retrieval of the blob.\n\t * @param options.includeContent Include the content, or just get the metadata.\n\t * @param options.overrideVaultKeyId Use a different vault key id for decryption, if not provided the default vault key id will be used.\n\t * @param options.decompress If the content should be decompressed, if it was compressed when stored, defaults to true.\n\t * @returns The data and metadata for the blob if it can be found.\n\t * @throws Not found error if the blob cannot be found.\n\t */\n\tget(\n\t\tid: string,\n\t\toptions?: {\n\t\t\tincludeContent?: boolean;\n\t\t\tdecompress?: boolean;\n\t\t\toverrideVaultKeyId?: string;\n\t\t}\n\t): Promise<IBlobStorageEntry>;\n\n\t/**\n\t * Update the blob with metadata.\n\t * @param id The id of the blob metadata to update.\n\t * @param encodingFormat Mime type for the blob, will be detected if left undefined.\n\t * @param fileExtension Extension for the blob, will be detected if left undefined.\n\t * @param metadata Data for the custom metadata as JSON-LD.\n\t * @returns Nothing.\n\t * @throws Not found error if the blob cannot be found.\n\t */\n\tupdate(\n\t\tid: string,\n\t\tencodingFormat?: string,\n\t\tfileExtension?: string,\n\t\tmetadata?: IJsonLdNodeObject\n\t): Promise<void>;\n\n\t/**\n\t * Remove the blob.\n\t * @param id The id of the blob to remove in urn format.\n\t * @returns Nothing.\n\t * @throws Not found error if the blob cannot be found.\n\t */\n\tremove(id: string): Promise<void>;\n\n\t/**\n\t * Remove all blobs from the storage.\n\t * @returns Nothing.\n\t */\n\tempty(): Promise<void>;\n\n\t/**\n\t * Query all the blob storage entries which match the conditions.\n\t * @param conditions The conditions to match for the entries.\n\t * @param orderBy The order for the results, defaults to created.\n\t * @param orderByDirection The direction for the order, defaults to descending.\n\t * @param cursor The cursor to request the next page of entries.\n\t * @param limit The suggested number of entries to return in each chunk, in some scenarios can return a different amount.\n\t * @returns All the entries for the storage matching the conditions,\n\t * and a cursor which can be used to request more entities.\n\t */\n\tquery(\n\t\tconditions?: EntityCondition<IBlobStorageEntry>,\n\t\torderBy?: keyof Pick<IBlobStorageEntry, \"dateCreated\" | \"dateModified\">,\n\t\torderByDirection?: SortDirection,\n\t\tcursor?: string,\n\t\tlimit?: number\n\t): Promise<{\n\t\tentries: IBlobStorageEntryList;\n\t\tcursor?: string;\n\t}>;\n}\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"IBlobStorageConnector.js","sourceRoot":"","sources":["../../../src/models/IBlobStorageConnector.ts"],"names":[],"mappings":"","sourcesContent":["// Copyright 2024 IOTA Stiftung.\n// SPDX-License-Identifier: Apache-2.0.\nimport type { IComponent } from \"@twin.org/core\";\n\n/**\n * Interface describing an blob storage connector.\n */\nexport interface IBlobStorageConnector extends IComponent {\n\t/**\n\t * Set the blob.\n\t * @param blob The data for the blob.\n\t * @returns The id of the stored blob in urn format.\n\t */\n\tset(blob: Uint8Array): Promise<string>;\n\n\t/**\n\t * Get the blob.\n\t * @param id The id of the blob to get in urn format.\n\t * @returns The data for the blob if it can be found or undefined.\n\t */\n\tget(id: string): Promise<Uint8Array | undefined>;\n\n\t/**\n\t * Remove the blob.\n\t * @param id The id of the blob to remove in urn format.\n\t * @returns True if the blob was found.\n\t */\n\tremove(id: string): Promise<boolean>;\n}\n"]}
1
+ {"version":3,"file":"IBlobStorageConnector.js","sourceRoot":"","sources":["../../../src/models/IBlobStorageConnector.ts"],"names":[],"mappings":"","sourcesContent":["// Copyright 2024 IOTA Stiftung.\n// SPDX-License-Identifier: Apache-2.0.\nimport type { IComponent } from \"@twin.org/core\";\n\n/**\n * Interface describing an blob storage connector.\n */\nexport interface IBlobStorageConnector extends IComponent {\n\t/**\n\t * Set the blob.\n\t * @param blob The data for the blob.\n\t * @returns The id of the stored blob in urn format.\n\t */\n\tset(blob: Uint8Array): Promise<string>;\n\n\t/**\n\t * Get the blob.\n\t * @param id The id of the blob to get in urn format.\n\t * @returns The data for the blob if it can be found or undefined.\n\t */\n\tget(id: string): Promise<Uint8Array | undefined>;\n\n\t/**\n\t * Remove the blob.\n\t * @param id The id of the blob to remove in urn format.\n\t * @returns True if the blob was found.\n\t */\n\tremove(id: string): Promise<boolean>;\n\n\t/**\n\t * Remove all blobs from the storage.\n\t * @returns Nothing.\n\t */\n\tempty(): Promise<void>;\n}\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"IBlobStorageEntry.js","sourceRoot":"","sources":["../../../src/models/IBlobStorageEntry.ts"],"names":[],"mappings":"","sourcesContent":["// Copyright 2024 IOTA Stiftung.\n// SPDX-License-Identifier: Apache-2.0.\nimport type { IJsonLdContextDefinitionElement, IJsonLdNodeObject } from \"@twin.org/data-json-ld\";\nimport type { BlobStorageCompressionType } from \"./blobStorageCompressionType.js\";\nimport type { BlobStorageContexts } from \"./blobStorageContexts.js\";\nimport type { BlobStorageTypes } from \"./blobStorageTypes.js\";\n\n/**\n * Interface describing a blob storage entry.\n */\nexport interface IBlobStorageEntry {\n\t/**\n\t * JSON-LD Context.\n\t */\n\t\"@context\": [\n\t\ttypeof BlobStorageContexts.ContextRoot,\n\t\ttypeof BlobStorageContexts.ContextRootCommon,\n\t\t...IJsonLdContextDefinitionElement[]\n\t];\n\n\t/**\n\t * JSON-LD Type.\n\t */\n\ttype: typeof BlobStorageTypes.Entry;\n\n\t/**\n\t * The id for the blob.\n\t */\n\tid: string;\n\n\t/**\n\t * The date/time when the entry was created.\n\t */\n\tdateCreated: string;\n\n\t/**\n\t * The date/time when the entry was modified.\n\t */\n\tdateModified?: string;\n\n\t/**\n\t * The size of the data in the blob.\n\t */\n\tblobSize: number;\n\n\t/**\n\t * The hash of the data in the blob.\n\t */\n\tblobHash: string;\n\n\t/**\n\t * The mime type for the blob.\n\t */\n\tencodingFormat?: string;\n\n\t/**\n\t * Indicates if the blob is encrypted.\n\t */\n\tisEncrypted?: boolean;\n\n\t/**\n\t * The type of compression used for the blob, if not set it is not stored with compression.\n\t */\n\tcompression?: BlobStorageCompressionType;\n\n\t/**\n\t * The extension.\n\t */\n\tfileExtension?: string;\n\n\t/**\n\t * The metadata for the blob as JSON-LD.\n\t */\n\tmetadata?: IJsonLdNodeObject;\n\n\t/**\n\t * The blob in base64 format, included if the includeContent flag was set in the request.\n\t */\n\tblob?: string;\n}\n"]}
1
+ {"version":3,"file":"IBlobStorageEntry.js","sourceRoot":"","sources":["../../../src/models/IBlobStorageEntry.ts"],"names":[],"mappings":"","sourcesContent":["// Copyright 2024 IOTA Stiftung.\n// SPDX-License-Identifier: Apache-2.0.\nimport type { IJsonLdContextDefinitionElement, IJsonLdNodeObject } from \"@twin.org/data-json-ld\";\nimport type { BlobStorageCompressionType } from \"./blobStorageCompressionType.js\";\nimport type { BlobStorageContexts } from \"./blobStorageContexts.js\";\nimport type { BlobStorageTypes } from \"./blobStorageTypes.js\";\n\n/**\n * Interface describing a blob storage entry.\n */\nexport interface IBlobStorageEntry {\n\t/**\n\t * JSON-LD Context.\n\t */\n\t\"@context\": [\n\t\ttypeof BlobStorageContexts.Context,\n\t\ttypeof BlobStorageContexts.ContextCommon,\n\t\t...IJsonLdContextDefinitionElement[]\n\t];\n\n\t/**\n\t * JSON-LD Type.\n\t */\n\ttype: typeof BlobStorageTypes.Entry;\n\n\t/**\n\t * The id for the blob.\n\t */\n\tid: string;\n\n\t/**\n\t * The date/time when the entry was created.\n\t * @json-ld namespace:schema\n\t */\n\tdateCreated: string;\n\n\t/**\n\t * The date/time when the entry was modified.\n\t * @json-ld namespace:schema\n\t */\n\tdateModified?: string;\n\n\t/**\n\t * The size of the data in the blob.\n\t * @json-ld type:schema:Integer\n\t */\n\tblobSize: number;\n\n\t/**\n\t * The integrity of the data in the blob.\n\t * @json-ld namespace:twin-common\n\t */\n\tintegrity: string;\n\n\t/**\n\t * The mime type for the blob.\n\t * @json-ld namespace:schema\n\t */\n\tencodingFormat?: string;\n\n\t/**\n\t * Indicates if the blob is encrypted.\n\t * @json-ld type:schema:Boolean\n\t */\n\tisEncrypted?: boolean;\n\n\t/**\n\t * The type of compression used for the blob, if not set it is not stored with compression.\n\t * @json-ld type:schema:Text\n\t */\n\tcompression?: BlobStorageCompressionType;\n\n\t/**\n\t * The extension.\n\t * @json-ld type:schema:Text\n\t */\n\tfileExtension?: string;\n\n\t/**\n\t * The metadata for the blob as JSON-LD.\n\t * @json-ld id\n\t */\n\tmetadata?: IJsonLdNodeObject;\n\n\t/**\n\t * The blob in base64 format, included if the includeContent flag was set in the request.\n\t * @json-ld type:schema:Text\n\t */\n\tblob?: string;\n}\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"IBlobStorageEntryList.js","sourceRoot":"","sources":["../../../src/models/IBlobStorageEntryList.ts"],"names":[],"mappings":"","sourcesContent":["// Copyright 2024 IOTA Stiftung.\n// SPDX-License-Identifier: Apache-2.0.\nimport type { IJsonLdContextDefinitionElement } from \"@twin.org/data-json-ld\";\nimport type { SchemaOrgContexts, SchemaOrgTypes } from \"@twin.org/standards-schema-org\";\nimport type { BlobStorageContexts } from \"./blobStorageContexts.js\";\nimport type { IBlobStorageEntry } from \"./IBlobStorageEntry.js\";\n\n/**\n * Interface describing an blob storage entry list.\n */\nexport interface IBlobStorageEntryList {\n\t/**\n\t * JSON-LD Context.\n\t */\n\t\"@context\": [\n\t\ttypeof SchemaOrgContexts.ContextRoot,\n\t\ttypeof BlobStorageContexts.ContextRoot,\n\t\ttypeof BlobStorageContexts.ContextRootCommon,\n\t\t...IJsonLdContextDefinitionElement[]\n\t];\n\n\t/**\n\t * JSON-LD Type.\n\t */\n\ttype: typeof SchemaOrgTypes.ItemList;\n\n\t/**\n\t * The list of entries.\n\t */\n\t[SchemaOrgTypes.ItemListElement]: IBlobStorageEntry[];\n\n\t/**\n\t * The cursor to get the next chunk of entries.\n\t */\n\t[SchemaOrgTypes.NextItem]?: string;\n}\n"]}
1
+ {"version":3,"file":"IBlobStorageEntryList.js","sourceRoot":"","sources":["../../../src/models/IBlobStorageEntryList.ts"],"names":[],"mappings":"","sourcesContent":["// Copyright 2024 IOTA Stiftung.\n// SPDX-License-Identifier: Apache-2.0.\nimport type { IJsonLdContextDefinitionElement } from \"@twin.org/data-json-ld\";\nimport type { SchemaOrgContexts, SchemaOrgTypes } from \"@twin.org/standards-schema-org\";\nimport type { BlobStorageContexts } from \"./blobStorageContexts.js\";\nimport type { IBlobStorageEntry } from \"./IBlobStorageEntry.js\";\n\n/**\n * Interface describing an blob storage entry list.\n */\nexport interface IBlobStorageEntryList {\n\t/**\n\t * JSON-LD Context.\n\t */\n\t\"@context\": [\n\t\ttypeof SchemaOrgContexts.Context,\n\t\ttypeof BlobStorageContexts.Context,\n\t\ttypeof BlobStorageContexts.ContextCommon,\n\t\t...IJsonLdContextDefinitionElement[]\n\t];\n\n\t/**\n\t * JSON-LD Type.\n\t */\n\ttype: typeof SchemaOrgTypes.ItemList;\n\n\t/**\n\t * The list of entries.\n\t */\n\t[SchemaOrgTypes.ItemListElement]: IBlobStorageEntry[];\n}\n"]}
@@ -0,0 +1,4 @@
1
+ // Copyright 2024 IOTA Stiftung.
2
+ // SPDX-License-Identifier: Apache-2.0.
3
+ export {};
4
+ //# sourceMappingURL=IBlobStorageEmptyRequest.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"IBlobStorageEmptyRequest.js","sourceRoot":"","sources":["../../../../src/models/api/IBlobStorageEmptyRequest.ts"],"names":[],"mappings":"AAAA,gCAAgC;AAChC,uCAAuC","sourcesContent":["// Copyright 2024 IOTA Stiftung.\n// SPDX-License-Identifier: Apache-2.0.\n\n/**\n * Request to remove all entries from blob storage.\n */\n// eslint-disable-next-line @typescript-eslint/no-empty-interface\nexport interface IBlobStorageEmptyRequest {}\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"IBlobStorageGetContentRequest.js","sourceRoot":"","sources":["../../../../src/models/api/IBlobStorageGetContentRequest.ts"],"names":[],"mappings":"AAAA,gCAAgC;AAChC,uCAAuC","sourcesContent":["// Copyright 2024 IOTA Stiftung.\n// SPDX-License-Identifier: Apache-2.0.\n\n/**\n * Request to get the content from blob storage.\n */\nexport interface IBlobStorageGetContentRequest {\n\t/**\n\t * The path parameters.\n\t */\n\tpathParams: {\n\t\t/**\n\t\t * The id of the blob to get in urn format.\n\t\t */\n\t\tid: string;\n\t};\n\n\t/**\n\t * The query parameters.\n\t */\n\tquery?: {\n\t\t/**\n\t\t * If the content should be decompressed, if it was compressed when stored, defaults to true.\n\t\t * @default true\n\t\t */\n\t\tdecompress?: boolean | string;\n\n\t\t/**\n\t\t * Use a different vault key id for decryption, if not provided the default vault key id will be used.\n\t\t * @default undefined\n\t\t */\n\t\toverrideVaultKeyId?: string;\n\n\t\t/**\n\t\t * Set the download flag which should prompt the browser to save the file.\n\t\t * Otherwise the browser should show the content inside the page.\n\t\t * @default false\n\t\t */\n\t\tdownload?: boolean | string;\n\n\t\t/**\n\t\t * Set the filename to use when a download is triggered.\n\t\t * A filename will be generated if not provided.\n\t\t */\n\t\tfilename?: string;\n\t};\n}\n"]}
1
+ {"version":3,"file":"IBlobStorageGetContentRequest.js","sourceRoot":"","sources":["../../../../src/models/api/IBlobStorageGetContentRequest.ts"],"names":[],"mappings":"AAAA,gCAAgC;AAChC,uCAAuC","sourcesContent":["// Copyright 2024 IOTA Stiftung.\n// SPDX-License-Identifier: Apache-2.0.\n\n/**\n * Request to get the content from blob storage.\n */\nexport interface IBlobStorageGetContentRequest {\n\t/**\n\t * The path parameters.\n\t */\n\tpathParams: {\n\t\t/**\n\t\t * The id of the blob to get in urn format.\n\t\t */\n\t\tid: string;\n\t};\n\n\t/**\n\t * The query parameters.\n\t */\n\tquery?: {\n\t\t/**\n\t\t * If the content should be decompressed, if it was compressed when stored, defaults to true.\n\t\t * @default true\n\t\t */\n\t\tdecompress?: string;\n\n\t\t/**\n\t\t * Use a different vault key id for decryption, if not provided the default vault key id will be used.\n\t\t * @default undefined\n\t\t */\n\t\toverrideVaultKeyId?: string;\n\n\t\t/**\n\t\t * Set the download flag which should prompt the browser to save the file.\n\t\t * Otherwise the browser should show the content inside the page.\n\t\t * @default false\n\t\t */\n\t\tdownload?: string;\n\n\t\t/**\n\t\t * Set the filename to use when a download is triggered.\n\t\t * A filename will be generated if not provided.\n\t\t */\n\t\tfilename?: string;\n\t};\n}\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"IBlobStorageGetRequest.js","sourceRoot":"","sources":["../../../../src/models/api/IBlobStorageGetRequest.ts"],"names":[],"mappings":"","sourcesContent":["// Copyright 2024 IOTA Stiftung.\n// SPDX-License-Identifier: Apache-2.0.\nimport type { HeaderTypes, MimeTypes } from \"@twin.org/web\";\n\n/**\n * Request to get an entry from blob storage.\n */\nexport interface IBlobStorageGetRequest {\n\t/**\n\t * The headers which can be used to determine the response data type.\n\t */\n\theaders?: {\n\t\t[HeaderTypes.Accept]: typeof MimeTypes.Json | typeof MimeTypes.JsonLd;\n\t};\n\n\t/**\n\t * The path parameters.\n\t */\n\tpathParams: {\n\t\t/**\n\t\t * The id of the blob to get in urn format.\n\t\t */\n\t\tid: string;\n\t};\n\n\t/**\n\t * The query parameters.\n\t */\n\tquery?: {\n\t\t/**\n\t\t * Include the content in the response, otherwise only metadata is returned.\n\t\t * @default false\n\t\t */\n\t\tincludeContent?: boolean | string;\n\n\t\t/**\n\t\t * If the content should be decompressed, if it was compressed when stored, defaults to true.\n\t\t * @default true\n\t\t */\n\t\tdecompress?: boolean | string;\n\n\t\t/**\n\t\t * Use a different vault key id for decryption, if not provided the default vault key id will be used.\n\t\t * @default undefined\n\t\t */\n\t\toverrideVaultKeyId?: string;\n\t};\n}\n"]}
1
+ {"version":3,"file":"IBlobStorageGetRequest.js","sourceRoot":"","sources":["../../../../src/models/api/IBlobStorageGetRequest.ts"],"names":[],"mappings":"","sourcesContent":["// Copyright 2024 IOTA Stiftung.\n// SPDX-License-Identifier: Apache-2.0.\nimport type { HeaderTypes, MimeTypes } from \"@twin.org/web\";\n\n/**\n * Request to get an entry from blob storage.\n */\nexport interface IBlobStorageGetRequest {\n\t/**\n\t * The headers which can be used to determine the response data type.\n\t */\n\theaders?: {\n\t\t[HeaderTypes.Accept]: typeof MimeTypes.Json | typeof MimeTypes.JsonLd;\n\t};\n\n\t/**\n\t * The path parameters.\n\t */\n\tpathParams: {\n\t\t/**\n\t\t * The id of the blob to get in urn format.\n\t\t */\n\t\tid: string;\n\t};\n\n\t/**\n\t * The query parameters.\n\t */\n\tquery?: {\n\t\t/**\n\t\t * Include the content in the response, otherwise only metadata is returned.\n\t\t * @default false\n\t\t */\n\t\tincludeContent?: string;\n\n\t\t/**\n\t\t * If the content should be decompressed, if it was compressed when stored, defaults to true.\n\t\t * @default true\n\t\t */\n\t\tdecompress?: string;\n\n\t\t/**\n\t\t * Use a different vault key id for decryption, if not provided the default vault key id will be used.\n\t\t * @default undefined\n\t\t */\n\t\toverrideVaultKeyId?: string;\n\t};\n}\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"IBlobStorageListResponse.js","sourceRoot":"","sources":["../../../../src/models/api/IBlobStorageListResponse.ts"],"names":[],"mappings":"","sourcesContent":["// Copyright 2024 IOTA Stiftung.\n// SPDX-License-Identifier: Apache-2.0.\nimport type { HeaderTypes, MimeTypes } from \"@twin.org/web\";\nimport type { IBlobStorageEntryList } from \"../IBlobStorageEntryList.js\";\n\n/**\n * Response to getting the list of entries from a query.\n */\nexport interface IBlobStorageListResponse {\n\t/**\n\t * The headers which can be used to determine the response data type.\n\t */\n\theaders?: {\n\t\t[HeaderTypes.ContentType]: typeof MimeTypes.Json | typeof MimeTypes.JsonLd;\n\t};\n\n\t/**\n\t * The list of entries from the query.\n\t */\n\tbody: IBlobStorageEntryList;\n}\n"]}
1
+ {"version":3,"file":"IBlobStorageListResponse.js","sourceRoot":"","sources":["../../../../src/models/api/IBlobStorageListResponse.ts"],"names":[],"mappings":"","sourcesContent":["// Copyright 2024 IOTA Stiftung.\n// SPDX-License-Identifier: Apache-2.0.\nimport type { HeaderTypes, MimeTypes } from \"@twin.org/web\";\nimport type { IBlobStorageEntryList } from \"../IBlobStorageEntryList.js\";\n\n/**\n * Response to getting the list of entries from a query.\n */\nexport interface IBlobStorageListResponse {\n\t/**\n\t * The headers which can be used to determine the response data type.\n\t */\n\theaders?: {\n\t\t[HeaderTypes.ContentType]: typeof MimeTypes.Json | typeof MimeTypes.JsonLd;\n\t\t[HeaderTypes.Link]?: string | string[];\n\t};\n\n\t/**\n\t * The list of entries from the query.\n\t */\n\tbody: IBlobStorageEntryList;\n}\n"]}
@@ -6,12 +6,28 @@
6
6
  // eslint-disable-next-line @typescript-eslint/naming-convention
7
7
  export const BlobStorageContexts = {
8
8
  /**
9
- * The context root for the blob storage types.
9
+ * The canonical RDF namespace URI for Blob Storage.
10
10
  */
11
- ContextRoot: "https://schema.twindev.org/blob-storage/",
11
+ Namespace: "https://schema.twindev.org/blob-storage/",
12
12
  /**
13
- * The context root for the common types.
13
+ * The value to use in JSON-LD context for Blob Storage.
14
14
  */
15
- ContextRootCommon: "https://schema.twindev.org/common/"
15
+ Context: "https://schema.twindev.org/blob-storage/",
16
+ /**
17
+ * The JSON-LD Context URL.
18
+ */
19
+ JsonLdContext: "https://schema.twindev.org/blob-storage/types.jsonld",
20
+ /**
21
+ * The canonical RDF namespace URI for TWIN Common.
22
+ */
23
+ NamespaceCommon: "https://schema.twindev.org/common/",
24
+ /**
25
+ * The value to use in JSON-LD context for TWIN Common.
26
+ */
27
+ ContextCommon: "https://schema.twindev.org/common/",
28
+ /**
29
+ * The JSON-LD Context URL for TWIN Common.
30
+ */
31
+ JsonLdContextCommon: "https://schema.twindev.org/common/types.jsonld"
16
32
  };
17
33
  //# sourceMappingURL=blobStorageContexts.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"blobStorageContexts.js","sourceRoot":"","sources":["../../../src/models/blobStorageContexts.ts"],"names":[],"mappings":"AAAA,gCAAgC;AAChC,uCAAuC;AAEvC;;GAEG;AACH,gEAAgE;AAChE,MAAM,CAAC,MAAM,mBAAmB,GAAG;IAClC;;OAEG;IACH,WAAW,EAAE,0CAA0C;IAEvD;;OAEG;IACH,iBAAiB,EAAE,oCAAoC;CAC9C,CAAC","sourcesContent":["// Copyright 2024 IOTA Stiftung.\n// SPDX-License-Identifier: Apache-2.0.\n\n/**\n * The contexts of blob storage data.\n */\n// eslint-disable-next-line @typescript-eslint/naming-convention\nexport const BlobStorageContexts = {\n\t/**\n\t * The context root for the blob storage types.\n\t */\n\tContextRoot: \"https://schema.twindev.org/blob-storage/\",\n\n\t/**\n\t * The context root for the common types.\n\t */\n\tContextRootCommon: \"https://schema.twindev.org/common/\"\n} as const;\n\n/**\n * The contexts of blob storage data.\n */\nexport type BlobStorageContexts = (typeof BlobStorageContexts)[keyof typeof BlobStorageContexts];\n"]}
1
+ {"version":3,"file":"blobStorageContexts.js","sourceRoot":"","sources":["../../../src/models/blobStorageContexts.ts"],"names":[],"mappings":"AAAA,gCAAgC;AAChC,uCAAuC;AAEvC;;GAEG;AACH,gEAAgE;AAChE,MAAM,CAAC,MAAM,mBAAmB,GAAG;IAClC;;OAEG;IACH,SAAS,EAAE,0CAA0C;IAErD;;OAEG;IACH,OAAO,EAAE,0CAA0C;IAEnD;;OAEG;IACH,aAAa,EAAE,sDAAsD;IAErE;;OAEG;IACH,eAAe,EAAE,oCAAoC;IAErD;;OAEG;IACH,aAAa,EAAE,oCAAoC;IAEnD;;OAEG;IACH,mBAAmB,EAAE,gDAAgD;CAC5D,CAAC","sourcesContent":["// Copyright 2024 IOTA Stiftung.\n// SPDX-License-Identifier: Apache-2.0.\n\n/**\n * The contexts of blob storage data.\n */\n// eslint-disable-next-line @typescript-eslint/naming-convention\nexport const BlobStorageContexts = {\n\t/**\n\t * The canonical RDF namespace URI for Blob Storage.\n\t */\n\tNamespace: \"https://schema.twindev.org/blob-storage/\",\n\n\t/**\n\t * The value to use in JSON-LD context for Blob Storage.\n\t */\n\tContext: \"https://schema.twindev.org/blob-storage/\",\n\n\t/**\n\t * The JSON-LD Context URL.\n\t */\n\tJsonLdContext: \"https://schema.twindev.org/blob-storage/types.jsonld\",\n\n\t/**\n\t * The canonical RDF namespace URI for TWIN Common.\n\t */\n\tNamespaceCommon: \"https://schema.twindev.org/common/\",\n\n\t/**\n\t * The value to use in JSON-LD context for TWIN Common.\n\t */\n\tContextCommon: \"https://schema.twindev.org/common/\",\n\n\t/**\n\t * The JSON-LD Context URL for TWIN Common.\n\t */\n\tJsonLdContextCommon: \"https://schema.twindev.org/common/types.jsonld\"\n} as const;\n\n/**\n * The contexts of blob storage data.\n */\nexport type BlobStorageContexts = (typeof BlobStorageContexts)[keyof typeof BlobStorageContexts];\n"]}
@@ -1,10 +1,16 @@
1
1
  {
2
2
  "$schema": "https://json-schema.org/draft/2020-12/schema",
3
3
  "$id": "https://schema.twindev.org/blob-storage/BlobStorageCompressionType",
4
+ "title": "BlobStorageCompressionType",
4
5
  "description": "The types of compression for blob storage data.",
5
- "type": "string",
6
- "enum": [
7
- "gzip",
8
- "deflate"
6
+ "oneOf": [
7
+ {
8
+ "const": "gzip",
9
+ "description": "Gzip."
10
+ },
11
+ {
12
+ "const": "deflate",
13
+ "description": "Deflate."
14
+ }
9
15
  ]
10
16
  }
@@ -1,29 +1,27 @@
1
1
  {
2
2
  "$schema": "https://json-schema.org/draft/2020-12/schema",
3
3
  "$id": "https://schema.twindev.org/blob-storage/BlobStorageEntry",
4
+ "title": "BlobStorageEntry",
4
5
  "description": "Interface describing a blob storage entry.",
5
6
  "type": "object",
6
7
  "properties": {
7
8
  "@context": {
8
9
  "type": "array",
9
- "minItems": 2,
10
- "description": "JSON-LD Context.",
11
10
  "prefixItems": [
12
11
  {
13
- "type": "string",
14
12
  "const": "https://schema.twindev.org/blob-storage/"
15
13
  },
16
14
  {
17
- "type": "string",
18
15
  "const": "https://schema.twindev.org/common/"
19
16
  }
20
17
  ],
21
18
  "items": {
22
19
  "$ref": "https://schema.twindev.org/json-ld/JsonLdContextDefinitionElement"
23
- }
20
+ },
21
+ "minItems": 2,
22
+ "description": "JSON-LD Context."
24
23
  },
25
24
  "type": {
26
- "type": "string",
27
25
  "const": "BlobStorageEntry",
28
26
  "description": "JSON-LD Type."
29
27
  },
@@ -43,9 +41,9 @@
43
41
  "type": "number",
44
42
  "description": "The size of the data in the blob."
45
43
  },
46
- "blobHash": {
44
+ "integrity": {
47
45
  "type": "string",
48
- "description": "The hash of the data in the blob."
46
+ "description": "The integrity of the data in the blob."
49
47
  },
50
48
  "encodingFormat": {
51
49
  "type": "string",
@@ -78,7 +76,6 @@
78
76
  "id",
79
77
  "dateCreated",
80
78
  "blobSize",
81
- "blobHash"
82
- ],
83
- "additionalProperties": false
79
+ "integrity"
80
+ ]
84
81
  }
@@ -1,6 +1,7 @@
1
1
  export * from "./dataTypes/blobStorageDataTypes.js";
2
2
  export * from "./factories/blobStorageConnectorFactory.js";
3
3
  export * from "./models/api/IBlobStorageCreateRequest.js";
4
+ export * from "./models/api/IBlobStorageEmptyRequest.js";
4
5
  export * from "./models/api/IBlobStorageGetContentRequest.js";
5
6
  export * from "./models/api/IBlobStorageGetContentResponse.js";
6
7
  export * from "./models/api/IBlobStorageGetRequest.js";
@@ -59,6 +59,11 @@ export interface IBlobStorageComponent extends IComponent {
59
59
  * @throws Not found error if the blob cannot be found.
60
60
  */
61
61
  remove(id: string): Promise<void>;
62
+ /**
63
+ * Remove all blobs from the storage.
64
+ * @returns Nothing.
65
+ */
66
+ empty(): Promise<void>;
62
67
  /**
63
68
  * Query all the blob storage entries which match the conditions.
64
69
  * @param conditions The conditions to match for the entries.
@@ -69,5 +74,8 @@ export interface IBlobStorageComponent extends IComponent {
69
74
  * @returns All the entries for the storage matching the conditions,
70
75
  * and a cursor which can be used to request more entities.
71
76
  */
72
- query(conditions?: EntityCondition<IBlobStorageEntry>, orderBy?: keyof Pick<IBlobStorageEntry, "dateCreated" | "dateModified">, orderByDirection?: SortDirection, cursor?: string, limit?: number): Promise<IBlobStorageEntryList>;
77
+ query(conditions?: EntityCondition<IBlobStorageEntry>, orderBy?: keyof Pick<IBlobStorageEntry, "dateCreated" | "dateModified">, orderByDirection?: SortDirection, cursor?: string, limit?: number): Promise<{
78
+ entries: IBlobStorageEntryList;
79
+ cursor?: string;
80
+ }>;
73
81
  }
@@ -21,4 +21,9 @@ export interface IBlobStorageConnector extends IComponent {
21
21
  * @returns True if the blob was found.
22
22
  */
23
23
  remove(id: string): Promise<boolean>;
24
+ /**
25
+ * Remove all blobs from the storage.
26
+ * @returns Nothing.
27
+ */
28
+ empty(): Promise<void>;
24
29
  }
@@ -10,8 +10,8 @@ export interface IBlobStorageEntry {
10
10
  * JSON-LD Context.
11
11
  */
12
12
  "@context": [
13
- typeof BlobStorageContexts.ContextRoot,
14
- typeof BlobStorageContexts.ContextRootCommon,
13
+ typeof BlobStorageContexts.Context,
14
+ typeof BlobStorageContexts.ContextCommon,
15
15
  ...IJsonLdContextDefinitionElement[]
16
16
  ];
17
17
  /**
@@ -24,42 +24,52 @@ export interface IBlobStorageEntry {
24
24
  id: string;
25
25
  /**
26
26
  * The date/time when the entry was created.
27
+ * @json-ld namespace:schema
27
28
  */
28
29
  dateCreated: string;
29
30
  /**
30
31
  * The date/time when the entry was modified.
32
+ * @json-ld namespace:schema
31
33
  */
32
34
  dateModified?: string;
33
35
  /**
34
36
  * The size of the data in the blob.
37
+ * @json-ld type:schema:Integer
35
38
  */
36
39
  blobSize: number;
37
40
  /**
38
- * The hash of the data in the blob.
41
+ * The integrity of the data in the blob.
42
+ * @json-ld namespace:twin-common
39
43
  */
40
- blobHash: string;
44
+ integrity: string;
41
45
  /**
42
46
  * The mime type for the blob.
47
+ * @json-ld namespace:schema
43
48
  */
44
49
  encodingFormat?: string;
45
50
  /**
46
51
  * Indicates if the blob is encrypted.
52
+ * @json-ld type:schema:Boolean
47
53
  */
48
54
  isEncrypted?: boolean;
49
55
  /**
50
56
  * The type of compression used for the blob, if not set it is not stored with compression.
57
+ * @json-ld type:schema:Text
51
58
  */
52
59
  compression?: BlobStorageCompressionType;
53
60
  /**
54
61
  * The extension.
62
+ * @json-ld type:schema:Text
55
63
  */
56
64
  fileExtension?: string;
57
65
  /**
58
66
  * The metadata for the blob as JSON-LD.
67
+ * @json-ld id
59
68
  */
60
69
  metadata?: IJsonLdNodeObject;
61
70
  /**
62
71
  * The blob in base64 format, included if the includeContent flag was set in the request.
72
+ * @json-ld type:schema:Text
63
73
  */
64
74
  blob?: string;
65
75
  }
@@ -10,9 +10,9 @@ export interface IBlobStorageEntryList {
10
10
  * JSON-LD Context.
11
11
  */
12
12
  "@context": [
13
- typeof SchemaOrgContexts.ContextRoot,
14
- typeof BlobStorageContexts.ContextRoot,
15
- typeof BlobStorageContexts.ContextRootCommon,
13
+ typeof SchemaOrgContexts.Context,
14
+ typeof BlobStorageContexts.Context,
15
+ typeof BlobStorageContexts.ContextCommon,
16
16
  ...IJsonLdContextDefinitionElement[]
17
17
  ];
18
18
  /**
@@ -23,8 +23,4 @@ export interface IBlobStorageEntryList {
23
23
  * The list of entries.
24
24
  */
25
25
  [SchemaOrgTypes.ItemListElement]: IBlobStorageEntry[];
26
- /**
27
- * The cursor to get the next chunk of entries.
28
- */
29
- [SchemaOrgTypes.NextItem]?: string;
30
26
  }
@@ -0,0 +1,5 @@
1
+ /**
2
+ * Request to remove all entries from blob storage.
3
+ */
4
+ export interface IBlobStorageEmptyRequest {
5
+ }
@@ -19,7 +19,7 @@ export interface IBlobStorageGetContentRequest {
19
19
  * If the content should be decompressed, if it was compressed when stored, defaults to true.
20
20
  * @default true
21
21
  */
22
- decompress?: boolean | string;
22
+ decompress?: string;
23
23
  /**
24
24
  * Use a different vault key id for decryption, if not provided the default vault key id will be used.
25
25
  * @default undefined
@@ -30,7 +30,7 @@ export interface IBlobStorageGetContentRequest {
30
30
  * Otherwise the browser should show the content inside the page.
31
31
  * @default false
32
32
  */
33
- download?: boolean | string;
33
+ download?: string;
34
34
  /**
35
35
  * Set the filename to use when a download is triggered.
36
36
  * A filename will be generated if not provided.
@@ -26,12 +26,12 @@ export interface IBlobStorageGetRequest {
26
26
  * Include the content in the response, otherwise only metadata is returned.
27
27
  * @default false
28
28
  */
29
- includeContent?: boolean | string;
29
+ includeContent?: string;
30
30
  /**
31
31
  * If the content should be decompressed, if it was compressed when stored, defaults to true.
32
32
  * @default true
33
33
  */
34
- decompress?: boolean | string;
34
+ decompress?: string;
35
35
  /**
36
36
  * Use a different vault key id for decryption, if not provided the default vault key id will be used.
37
37
  * @default undefined
@@ -9,6 +9,7 @@ export interface IBlobStorageListResponse {
9
9
  */
10
10
  headers?: {
11
11
  [HeaderTypes.ContentType]: typeof MimeTypes.Json | typeof MimeTypes.JsonLd;
12
+ [HeaderTypes.Link]?: string | string[];
12
13
  };
13
14
  /**
14
15
  * The list of entries from the query.
@@ -3,13 +3,29 @@
3
3
  */
4
4
  export declare const BlobStorageContexts: {
5
5
  /**
6
- * The context root for the blob storage types.
6
+ * The canonical RDF namespace URI for Blob Storage.
7
7
  */
8
- readonly ContextRoot: "https://schema.twindev.org/blob-storage/";
8
+ readonly Namespace: "https://schema.twindev.org/blob-storage/";
9
9
  /**
10
- * The context root for the common types.
10
+ * The value to use in JSON-LD context for Blob Storage.
11
11
  */
12
- readonly ContextRootCommon: "https://schema.twindev.org/common/";
12
+ readonly Context: "https://schema.twindev.org/blob-storage/";
13
+ /**
14
+ * The JSON-LD Context URL.
15
+ */
16
+ readonly JsonLdContext: "https://schema.twindev.org/blob-storage/types.jsonld";
17
+ /**
18
+ * The canonical RDF namespace URI for TWIN Common.
19
+ */
20
+ readonly NamespaceCommon: "https://schema.twindev.org/common/";
21
+ /**
22
+ * The value to use in JSON-LD context for TWIN Common.
23
+ */
24
+ readonly ContextCommon: "https://schema.twindev.org/common/";
25
+ /**
26
+ * The JSON-LD Context URL for TWIN Common.
27
+ */
28
+ readonly JsonLdContextCommon: "https://schema.twindev.org/common/types.jsonld";
13
29
  };
14
30
  /**
15
31
  * The contexts of blob storage data.