@twin.org/blob-storage-models 0.0.2-next.5 → 0.0.3-next.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/es/dataTypes/blobStorageDataTypes.js +30 -0
- package/dist/es/dataTypes/blobStorageDataTypes.js.map +1 -0
- package/dist/es/factories/blobStorageConnectorFactory.js +9 -0
- package/dist/es/factories/blobStorageConnectorFactory.js.map +1 -0
- package/dist/es/index.js +21 -0
- package/dist/es/index.js.map +1 -0
- package/dist/es/models/IBlobStorageComponent.js +2 -0
- package/dist/es/models/IBlobStorageComponent.js.map +1 -0
- package/dist/es/models/IBlobStorageConnector.js +2 -0
- package/dist/es/models/IBlobStorageConnector.js.map +1 -0
- package/dist/es/models/IBlobStorageEntry.js +2 -0
- package/dist/es/models/IBlobStorageEntry.js.map +1 -0
- package/dist/es/models/IBlobStorageEntryList.js +2 -0
- package/dist/es/models/IBlobStorageEntryList.js.map +1 -0
- package/dist/es/models/api/IBlobStorageCreateRequest.js +2 -0
- package/dist/es/models/api/IBlobStorageCreateRequest.js.map +1 -0
- package/dist/es/models/api/IBlobStorageGetContentRequest.js +4 -0
- package/dist/es/models/api/IBlobStorageGetContentRequest.js.map +1 -0
- package/dist/es/models/api/IBlobStorageGetContentResponse.js +4 -0
- package/dist/es/models/api/IBlobStorageGetContentResponse.js.map +1 -0
- package/dist/es/models/api/IBlobStorageGetRequest.js +2 -0
- package/dist/es/models/api/IBlobStorageGetRequest.js.map +1 -0
- package/dist/es/models/api/IBlobStorageGetResponse.js +2 -0
- package/dist/es/models/api/IBlobStorageGetResponse.js.map +1 -0
- package/dist/es/models/api/IBlobStorageListRequest.js +2 -0
- package/dist/es/models/api/IBlobStorageListRequest.js.map +1 -0
- package/dist/es/models/api/IBlobStorageListResponse.js +2 -0
- package/dist/es/models/api/IBlobStorageListResponse.js.map +1 -0
- package/dist/es/models/api/IBlobStorageRemoveRequest.js +4 -0
- package/dist/es/models/api/IBlobStorageRemoveRequest.js.map +1 -0
- package/dist/es/models/api/IBlobStorageUpdateRequest.js +2 -0
- package/dist/es/models/api/IBlobStorageUpdateRequest.js.map +1 -0
- package/dist/es/models/blobStorageCompressionType.js +17 -0
- package/dist/es/models/blobStorageCompressionType.js.map +1 -0
- package/dist/es/models/blobStorageContexts.js +17 -0
- package/dist/es/models/blobStorageContexts.js.map +1 -0
- package/dist/es/models/blobStorageTypes.js +17 -0
- package/dist/es/models/blobStorageTypes.js.map +1 -0
- package/dist/es/schemas/BlobStorageCompressionType.json +10 -0
- package/dist/es/schemas/BlobStorageEntry.json +84 -0
- package/dist/types/factories/blobStorageConnectorFactory.d.ts +1 -1
- package/dist/types/index.d.ts +18 -18
- package/dist/types/models/IBlobStorageComponent.d.ts +8 -15
- package/dist/types/models/IBlobStorageEntry.d.ts +5 -5
- package/dist/types/models/IBlobStorageEntryList.d.ts +5 -5
- package/dist/types/models/api/IBlobStorageCreateRequest.d.ts +1 -1
- package/dist/types/models/api/IBlobStorageGetContentRequest.d.ts +2 -2
- package/dist/types/models/api/IBlobStorageGetRequest.d.ts +2 -2
- package/dist/types/models/api/IBlobStorageGetResponse.d.ts +1 -1
- package/dist/types/models/api/IBlobStorageListRequest.d.ts +1 -1
- package/dist/types/models/api/IBlobStorageListResponse.d.ts +1 -1
- package/dist/types/models/blobStorageContexts.d.ts +2 -2
- package/docs/changelog.md +31 -0
- package/docs/reference/interfaces/IBlobStorageComponent.md +5 -55
- package/docs/reference/interfaces/IBlobStorageConnector.md +2 -10
- package/docs/reference/interfaces/IBlobStorageGetContentRequest.md +2 -2
- package/docs/reference/interfaces/IBlobStorageGetRequest.md +2 -2
- package/docs/reference/variables/BlobStorageContexts.md +4 -4
- package/package.json +5 -7
- package/dist/cjs/index.cjs +0 -201
- package/dist/esm/index.mjs +0 -195
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
// Copyright 2024 IOTA Stiftung.
|
|
2
|
+
// SPDX-License-Identifier: Apache-2.0.
|
|
3
|
+
import { DataTypeHandlerFactory } from "@twin.org/data-core";
|
|
4
|
+
import { BlobStorageContexts } from "../models/blobStorageContexts.js";
|
|
5
|
+
import { BlobStorageTypes } from "../models/blobStorageTypes.js";
|
|
6
|
+
import BlobStorageCompressionTypeSchema from "../schemas/BlobStorageCompressionType.json" with { type: "json" };
|
|
7
|
+
import BlobStorageEntrySchema from "../schemas/BlobStorageEntry.json" with { type: "json" };
|
|
8
|
+
/**
|
|
9
|
+
* Handle all the data types for blob storage.
|
|
10
|
+
*/
|
|
11
|
+
export class BlobStorageDataTypes {
|
|
12
|
+
/**
|
|
13
|
+
* Register all the data types.
|
|
14
|
+
*/
|
|
15
|
+
static registerTypes() {
|
|
16
|
+
DataTypeHandlerFactory.register(`${BlobStorageContexts.Namespace}${BlobStorageTypes.Entry}`, () => ({
|
|
17
|
+
namespace: BlobStorageContexts.Namespace,
|
|
18
|
+
type: BlobStorageTypes.Entry,
|
|
19
|
+
defaultValue: {},
|
|
20
|
+
jsonSchema: async () => BlobStorageEntrySchema
|
|
21
|
+
}));
|
|
22
|
+
DataTypeHandlerFactory.register(`${BlobStorageContexts.Namespace}${BlobStorageTypes.CompressionType}`, () => ({
|
|
23
|
+
namespace: BlobStorageContexts.Namespace,
|
|
24
|
+
type: BlobStorageTypes.CompressionType,
|
|
25
|
+
defaultValue: {},
|
|
26
|
+
jsonSchema: async () => BlobStorageCompressionTypeSchema
|
|
27
|
+
}));
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
//# sourceMappingURL=blobStorageDataTypes.js.map
|
|
@@ -0,0 +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,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"]}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
// Copyright 2024 IOTA Stiftung.
|
|
2
|
+
// SPDX-License-Identifier: Apache-2.0.
|
|
3
|
+
import { Factory } from "@twin.org/core";
|
|
4
|
+
/**
|
|
5
|
+
* Factory for creating blob storage connectors.
|
|
6
|
+
*/
|
|
7
|
+
// eslint-disable-next-line @typescript-eslint/naming-convention
|
|
8
|
+
export const BlobStorageConnectorFactory = Factory.createFactory("blob-storage");
|
|
9
|
+
//# sourceMappingURL=blobStorageConnectorFactory.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"blobStorageConnectorFactory.js","sourceRoot":"","sources":["../../../src/factories/blobStorageConnectorFactory.ts"],"names":[],"mappings":"AAAA,gCAAgC;AAChC,uCAAuC;AACvC,OAAO,EAAE,OAAO,EAAE,MAAM,gBAAgB,CAAC;AAGzC;;GAEG;AACH,gEAAgE;AAChE,MAAM,CAAC,MAAM,2BAA2B,GACvC,OAAO,CAAC,aAAa,CAAwB,cAAc,CAAC,CAAC","sourcesContent":["// Copyright 2024 IOTA Stiftung.\n// SPDX-License-Identifier: Apache-2.0.\nimport { Factory } from \"@twin.org/core\";\nimport type { IBlobStorageConnector } from \"../models/IBlobStorageConnector.js\";\n\n/**\n * Factory for creating blob storage connectors.\n */\n// eslint-disable-next-line @typescript-eslint/naming-convention\nexport const BlobStorageConnectorFactory =\n\tFactory.createFactory<IBlobStorageConnector>(\"blob-storage\");\n"]}
|
package/dist/es/index.js
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
// Copyright 2024 IOTA Stiftung.
|
|
2
|
+
// SPDX-License-Identifier: Apache-2.0.
|
|
3
|
+
export * from "./dataTypes/blobStorageDataTypes.js";
|
|
4
|
+
export * from "./factories/blobStorageConnectorFactory.js";
|
|
5
|
+
export * from "./models/api/IBlobStorageCreateRequest.js";
|
|
6
|
+
export * from "./models/api/IBlobStorageGetContentRequest.js";
|
|
7
|
+
export * from "./models/api/IBlobStorageGetContentResponse.js";
|
|
8
|
+
export * from "./models/api/IBlobStorageGetRequest.js";
|
|
9
|
+
export * from "./models/api/IBlobStorageGetResponse.js";
|
|
10
|
+
export * from "./models/api/IBlobStorageListRequest.js";
|
|
11
|
+
export * from "./models/api/IBlobStorageListResponse.js";
|
|
12
|
+
export * from "./models/api/IBlobStorageRemoveRequest.js";
|
|
13
|
+
export * from "./models/api/IBlobStorageUpdateRequest.js";
|
|
14
|
+
export * from "./models/blobStorageCompressionType.js";
|
|
15
|
+
export * from "./models/blobStorageContexts.js";
|
|
16
|
+
export * from "./models/blobStorageTypes.js";
|
|
17
|
+
export * from "./models/IBlobStorageComponent.js";
|
|
18
|
+
export * from "./models/IBlobStorageConnector.js";
|
|
19
|
+
export * from "./models/IBlobStorageEntry.js";
|
|
20
|
+
export * from "./models/IBlobStorageEntryList.js";
|
|
21
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +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"]}
|
|
@@ -0,0 +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"]}
|
|
@@ -0,0 +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"]}
|
|
@@ -0,0 +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.Namespace,\n\t\ttypeof BlobStorageContexts.NamespaceCommon,\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"]}
|
|
@@ -0,0 +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.Namespace,\n\t\ttypeof BlobStorageContexts.Namespace,\n\t\ttypeof BlobStorageContexts.NamespaceCommon,\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"]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"IBlobStorageCreateRequest.js","sourceRoot":"","sources":["../../../../src/models/api/IBlobStorageCreateRequest.ts"],"names":[],"mappings":"","sourcesContent":["// Copyright 2024 IOTA Stiftung.\n// SPDX-License-Identifier: Apache-2.0.\nimport type { IJsonLdNodeObject } from \"@twin.org/data-json-ld\";\nimport type { BlobStorageCompressionType } from \"../blobStorageCompressionType.js\";\n\n/**\n * Request to create an entry in blob storage.\n */\nexport interface IBlobStorageCreateRequest {\n\t/**\n\t * The body parameters.\n\t */\n\tbody: {\n\t\t/**\n\t\t * The data to store in base64 encoding.\n\t\t */\n\t\tblob: string;\n\n\t\t/**\n\t\t * The mime type of the blob, will be detected if left undefined.\n\t\t */\n\t\tencodingFormat?: string;\n\n\t\t/**\n\t\t * The extension of the blob, will be detected if left undefined.\n\t\t */\n\t\tfileExtension?: string;\n\n\t\t/**\n\t\t * Custom metadata to associate with the blob as JSON-LD.\n\t\t */\n\t\tmetadata?: IJsonLdNodeObject;\n\n\t\t/**\n\t\t * Disables encryption if enabled by default.\n\t\t * @default false\n\t\t */\n\t\tdisableEncryption?: boolean;\n\n\t\t/**\n\t\t * Optional compression type to use for the blob, defaults to no compression.\n\t\t */\n\t\tcompress?: BlobStorageCompressionType;\n\n\t\t/**\n\t\t * Use a different vault key id for encryption, 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 * The namespace to store the data in, defaults to component configured namespace.\n\t\t */\n\t\tnamespace?: string;\n\t};\n}\n"]}
|
|
@@ -0,0 +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?: 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"]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"IBlobStorageGetContentResponse.js","sourceRoot":"","sources":["../../../../src/models/api/IBlobStorageGetContentResponse.ts"],"names":[],"mappings":"AAAA,gCAAgC;AAChC,uCAAuC","sourcesContent":["// Copyright 2024 IOTA Stiftung.\n// SPDX-License-Identifier: Apache-2.0.\n\n/**\n * Response to get an entry from blob storage.\n */\nexport interface IBlobStorageGetContentResponse {\n\t/**\n\t * The body parameters.\n\t */\n\tbody: Uint8Array;\n}\n"]}
|
|
@@ -0,0 +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?: 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"]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"IBlobStorageGetResponse.js","sourceRoot":"","sources":["../../../../src/models/api/IBlobStorageGetResponse.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 { IBlobStorageEntry } from \"../IBlobStorageEntry.js\";\n\n/**\n * Response to get an entry from blob storage.\n */\nexport interface IBlobStorageGetResponse {\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 body parameters.\n\t */\n\tbody: IBlobStorageEntry;\n}\n"]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"IBlobStorageListRequest.js","sourceRoot":"","sources":["../../../../src/models/api/IBlobStorageListRequest.ts"],"names":[],"mappings":"","sourcesContent":["// Copyright 2024 IOTA Stiftung.\n// SPDX-License-Identifier: Apache-2.0.\nimport type { SortDirection } from \"@twin.org/entity\";\nimport type { HeaderTypes, MimeTypes } from \"@twin.org/web\";\nimport type { IBlobStorageEntry } from \"../IBlobStorageEntry.js\";\n\n/**\n * Query the entries from blob storage.\n */\nexport interface IBlobStorageListRequest {\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 parameters from the query.\n\t */\n\tquery?: {\n\t\t/**\n\t\t * The condition for the query as JSON version of EntityCondition type.\n\t\t */\n\t\tconditions?: string;\n\n\t\t/**\n\t\t * The order for the results, default to created.\n\t\t */\n\t\torderBy?: keyof Pick<IBlobStorageEntry, \"dateCreated\" | \"dateModified\">;\n\n\t\t/**\n\t\t * The direction for the order, defaults to desc.\n\t\t */\n\t\torderByDirection?: SortDirection;\n\n\t\t/**\n\t\t * Limit the number of entities to return.\n\t\t */\n\t\tlimit?: string;\n\n\t\t/**\n\t\t * The cursor to get next chunk of data, returned in previous response.\n\t\t */\n\t\tcursor?: string;\n\t};\n}\n"]}
|
|
@@ -0,0 +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"]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"IBlobStorageRemoveRequest.js","sourceRoot":"","sources":["../../../../src/models/api/IBlobStorageRemoveRequest.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 an entry from blob storage.\n */\nexport interface IBlobStorageRemoveRequest {\n\t/**\n\t * The path parameters.\n\t */\n\tpathParams: {\n\t\t/**\n\t\t * The id of the blob to remove in urn format.\n\t\t */\n\t\tid: string;\n\t};\n}\n"]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"IBlobStorageUpdateRequest.js","sourceRoot":"","sources":["../../../../src/models/api/IBlobStorageUpdateRequest.ts"],"names":[],"mappings":"","sourcesContent":["// Copyright 2024 IOTA Stiftung.\n// SPDX-License-Identifier: Apache-2.0.\nimport type { IJsonLdNodeObject } from \"@twin.org/data-json-ld\";\n\n/**\n * Request to update a blob entry.\n */\nexport interface IBlobStorageUpdateRequest {\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 body parameters.\n\t */\n\tbody: {\n\t\t/**\n\t\t * The mime type of the blob, will be detected if left undefined.\n\t\t */\n\t\tencodingFormat?: string;\n\n\t\t/**\n\t\t * The extension of the blob, will be detected if left undefined.\n\t\t */\n\t\tfileExtension?: string;\n\n\t\t/**\n\t\t * Custom metadata to associate with the blob as JSON-LD.\n\t\t */\n\t\tmetadata?: IJsonLdNodeObject;\n\t};\n}\n"]}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
// Copyright 2024 IOTA Stiftung.
|
|
2
|
+
// SPDX-License-Identifier: Apache-2.0.
|
|
3
|
+
/**
|
|
4
|
+
* The types of compression for blob storage data.
|
|
5
|
+
*/
|
|
6
|
+
// eslint-disable-next-line @typescript-eslint/naming-convention
|
|
7
|
+
export const BlobStorageCompressionType = {
|
|
8
|
+
/**
|
|
9
|
+
* Gzip.
|
|
10
|
+
*/
|
|
11
|
+
Gzip: "gzip",
|
|
12
|
+
/**
|
|
13
|
+
* Deflate.
|
|
14
|
+
*/
|
|
15
|
+
Deflate: "deflate"
|
|
16
|
+
};
|
|
17
|
+
//# sourceMappingURL=blobStorageCompressionType.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"blobStorageCompressionType.js","sourceRoot":"","sources":["../../../src/models/blobStorageCompressionType.ts"],"names":[],"mappings":"AAAA,gCAAgC;AAChC,uCAAuC;AAEvC;;GAEG;AACH,gEAAgE;AAChE,MAAM,CAAC,MAAM,0BAA0B,GAAG;IACzC;;OAEG;IACH,IAAI,EAAE,MAAM;IACZ;;OAEG;IACH,OAAO,EAAE,SAAS;CACT,CAAC","sourcesContent":["// Copyright 2024 IOTA Stiftung.\n// SPDX-License-Identifier: Apache-2.0.\n\n/**\n * The types of compression for blob storage data.\n */\n// eslint-disable-next-line @typescript-eslint/naming-convention\nexport const BlobStorageCompressionType = {\n\t/**\n\t * Gzip.\n\t */\n\tGzip: \"gzip\",\n\t/**\n\t * Deflate.\n\t */\n\tDeflate: \"deflate\"\n} as const;\n\n/**\n * The types of compression for blob storage data.\n */\nexport type BlobStorageCompressionType =\n\t(typeof BlobStorageCompressionType)[keyof typeof BlobStorageCompressionType];\n"]}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
// Copyright 2024 IOTA Stiftung.
|
|
2
|
+
// SPDX-License-Identifier: Apache-2.0.
|
|
3
|
+
/**
|
|
4
|
+
* The contexts of blob storage data.
|
|
5
|
+
*/
|
|
6
|
+
// eslint-disable-next-line @typescript-eslint/naming-convention
|
|
7
|
+
export const BlobStorageContexts = {
|
|
8
|
+
/**
|
|
9
|
+
* The context root for the blob storage types.
|
|
10
|
+
*/
|
|
11
|
+
Namespace: "https://schema.twindev.org/blob-storage/",
|
|
12
|
+
/**
|
|
13
|
+
* The context root for the common types.
|
|
14
|
+
*/
|
|
15
|
+
NamespaceCommon: "https://schema.twindev.org/common/"
|
|
16
|
+
};
|
|
17
|
+
//# sourceMappingURL=blobStorageContexts.js.map
|
|
@@ -0,0 +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,SAAS,EAAE,0CAA0C;IAErD;;OAEG;IACH,eAAe,EAAE,oCAAoC;CAC5C,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\tNamespace: \"https://schema.twindev.org/blob-storage/\",\n\n\t/**\n\t * The context root for the common types.\n\t */\n\tNamespaceCommon: \"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"]}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
// Copyright 2024 IOTA Stiftung.
|
|
2
|
+
// SPDX-License-Identifier: Apache-2.0.
|
|
3
|
+
/**
|
|
4
|
+
* The types of blob storage data.
|
|
5
|
+
*/
|
|
6
|
+
// eslint-disable-next-line @typescript-eslint/naming-convention
|
|
7
|
+
export const BlobStorageTypes = {
|
|
8
|
+
/**
|
|
9
|
+
* Represents blob storage entry.
|
|
10
|
+
*/
|
|
11
|
+
Entry: "BlobStorageEntry",
|
|
12
|
+
/**
|
|
13
|
+
* Represents blob storage entry compression.
|
|
14
|
+
*/
|
|
15
|
+
CompressionType: "BlobStorageCompressionType"
|
|
16
|
+
};
|
|
17
|
+
//# sourceMappingURL=blobStorageTypes.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"blobStorageTypes.js","sourceRoot":"","sources":["../../../src/models/blobStorageTypes.ts"],"names":[],"mappings":"AAAA,gCAAgC;AAChC,uCAAuC;AAEvC;;GAEG;AACH,gEAAgE;AAChE,MAAM,CAAC,MAAM,gBAAgB,GAAG;IAC/B;;OAEG;IACH,KAAK,EAAE,kBAAkB;IAEzB;;OAEG;IACH,eAAe,EAAE,4BAA4B;CACpC,CAAC","sourcesContent":["// Copyright 2024 IOTA Stiftung.\n// SPDX-License-Identifier: Apache-2.0.\n\n/**\n * The types of blob storage data.\n */\n// eslint-disable-next-line @typescript-eslint/naming-convention\nexport const BlobStorageTypes = {\n\t/**\n\t * Represents blob storage entry.\n\t */\n\tEntry: \"BlobStorageEntry\",\n\n\t/**\n\t * Represents blob storage entry compression.\n\t */\n\tCompressionType: \"BlobStorageCompressionType\"\n} as const;\n\n/**\n * The types of blob storage data.\n */\nexport type BlobStorageTypes = (typeof BlobStorageTypes)[keyof typeof BlobStorageTypes];\n"]}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
{
|
|
2
|
+
"$schema": "https://json-schema.org/draft/2020-12/schema",
|
|
3
|
+
"$id": "https://schema.twindev.org/blob-storage/BlobStorageCompressionType",
|
|
4
|
+
"description": "The types of compression for blob storage data.",
|
|
5
|
+
"type": "string",
|
|
6
|
+
"enum": [
|
|
7
|
+
"gzip",
|
|
8
|
+
"deflate"
|
|
9
|
+
]
|
|
10
|
+
}
|
|
@@ -0,0 +1,84 @@
|
|
|
1
|
+
{
|
|
2
|
+
"$schema": "https://json-schema.org/draft/2020-12/schema",
|
|
3
|
+
"$id": "https://schema.twindev.org/blob-storage/BlobStorageEntry",
|
|
4
|
+
"description": "Interface describing a blob storage entry.",
|
|
5
|
+
"type": "object",
|
|
6
|
+
"properties": {
|
|
7
|
+
"@context": {
|
|
8
|
+
"type": "array",
|
|
9
|
+
"minItems": 2,
|
|
10
|
+
"description": "JSON-LD Context.",
|
|
11
|
+
"prefixItems": [
|
|
12
|
+
{
|
|
13
|
+
"type": "string",
|
|
14
|
+
"const": "https://schema.twindev.org/blob-storage/"
|
|
15
|
+
},
|
|
16
|
+
{
|
|
17
|
+
"type": "string",
|
|
18
|
+
"const": "https://schema.twindev.org/common/"
|
|
19
|
+
}
|
|
20
|
+
],
|
|
21
|
+
"items": {
|
|
22
|
+
"$ref": "https://schema.twindev.org/json-ld/JsonLdContextDefinitionElement"
|
|
23
|
+
}
|
|
24
|
+
},
|
|
25
|
+
"type": {
|
|
26
|
+
"type": "string",
|
|
27
|
+
"const": "BlobStorageEntry",
|
|
28
|
+
"description": "JSON-LD Type."
|
|
29
|
+
},
|
|
30
|
+
"id": {
|
|
31
|
+
"type": "string",
|
|
32
|
+
"description": "The id for the blob."
|
|
33
|
+
},
|
|
34
|
+
"dateCreated": {
|
|
35
|
+
"type": "string",
|
|
36
|
+
"description": "The date/time when the entry was created."
|
|
37
|
+
},
|
|
38
|
+
"dateModified": {
|
|
39
|
+
"type": "string",
|
|
40
|
+
"description": "The date/time when the entry was modified."
|
|
41
|
+
},
|
|
42
|
+
"blobSize": {
|
|
43
|
+
"type": "number",
|
|
44
|
+
"description": "The size of the data in the blob."
|
|
45
|
+
},
|
|
46
|
+
"blobHash": {
|
|
47
|
+
"type": "string",
|
|
48
|
+
"description": "The hash of the data in the blob."
|
|
49
|
+
},
|
|
50
|
+
"encodingFormat": {
|
|
51
|
+
"type": "string",
|
|
52
|
+
"description": "The mime type for the blob."
|
|
53
|
+
},
|
|
54
|
+
"isEncrypted": {
|
|
55
|
+
"type": "boolean",
|
|
56
|
+
"description": "Indicates if the blob is encrypted."
|
|
57
|
+
},
|
|
58
|
+
"compression": {
|
|
59
|
+
"$ref": "https://schema.twindev.org/blob-storage/BlobStorageCompressionType",
|
|
60
|
+
"description": "The type of compression used for the blob, if not set it is not stored with compression."
|
|
61
|
+
},
|
|
62
|
+
"fileExtension": {
|
|
63
|
+
"type": "string",
|
|
64
|
+
"description": "The extension."
|
|
65
|
+
},
|
|
66
|
+
"metadata": {
|
|
67
|
+
"$ref": "https://schema.twindev.org/json-ld/JsonLdNodeObject",
|
|
68
|
+
"description": "The metadata for the blob as JSON-LD."
|
|
69
|
+
},
|
|
70
|
+
"blob": {
|
|
71
|
+
"type": "string",
|
|
72
|
+
"description": "The blob in base64 format, included if the includeContent flag was set in the request."
|
|
73
|
+
}
|
|
74
|
+
},
|
|
75
|
+
"required": [
|
|
76
|
+
"@context",
|
|
77
|
+
"type",
|
|
78
|
+
"id",
|
|
79
|
+
"dateCreated",
|
|
80
|
+
"blobSize",
|
|
81
|
+
"blobHash"
|
|
82
|
+
],
|
|
83
|
+
"additionalProperties": false
|
|
84
|
+
}
|
package/dist/types/index.d.ts
CHANGED
|
@@ -1,18 +1,18 @@
|
|
|
1
|
-
export * from "./dataTypes/blobStorageDataTypes";
|
|
2
|
-
export * from "./factories/blobStorageConnectorFactory";
|
|
3
|
-
export * from "./models/api/IBlobStorageCreateRequest";
|
|
4
|
-
export * from "./models/api/IBlobStorageGetContentRequest";
|
|
5
|
-
export * from "./models/api/IBlobStorageGetContentResponse";
|
|
6
|
-
export * from "./models/api/IBlobStorageGetRequest";
|
|
7
|
-
export * from "./models/api/IBlobStorageGetResponse";
|
|
8
|
-
export * from "./models/api/IBlobStorageListRequest";
|
|
9
|
-
export * from "./models/api/IBlobStorageListResponse";
|
|
10
|
-
export * from "./models/api/IBlobStorageRemoveRequest";
|
|
11
|
-
export * from "./models/api/IBlobStorageUpdateRequest";
|
|
12
|
-
export * from "./models/blobStorageCompressionType";
|
|
13
|
-
export * from "./models/blobStorageContexts";
|
|
14
|
-
export * from "./models/blobStorageTypes";
|
|
15
|
-
export * from "./models/IBlobStorageComponent";
|
|
16
|
-
export * from "./models/IBlobStorageConnector";
|
|
17
|
-
export * from "./models/IBlobStorageEntry";
|
|
18
|
-
export * from "./models/IBlobStorageEntryList";
|
|
1
|
+
export * from "./dataTypes/blobStorageDataTypes.js";
|
|
2
|
+
export * from "./factories/blobStorageConnectorFactory.js";
|
|
3
|
+
export * from "./models/api/IBlobStorageCreateRequest.js";
|
|
4
|
+
export * from "./models/api/IBlobStorageGetContentRequest.js";
|
|
5
|
+
export * from "./models/api/IBlobStorageGetContentResponse.js";
|
|
6
|
+
export * from "./models/api/IBlobStorageGetRequest.js";
|
|
7
|
+
export * from "./models/api/IBlobStorageGetResponse.js";
|
|
8
|
+
export * from "./models/api/IBlobStorageListRequest.js";
|
|
9
|
+
export * from "./models/api/IBlobStorageListResponse.js";
|
|
10
|
+
export * from "./models/api/IBlobStorageRemoveRequest.js";
|
|
11
|
+
export * from "./models/api/IBlobStorageUpdateRequest.js";
|
|
12
|
+
export * from "./models/blobStorageCompressionType.js";
|
|
13
|
+
export * from "./models/blobStorageContexts.js";
|
|
14
|
+
export * from "./models/blobStorageTypes.js";
|
|
15
|
+
export * from "./models/IBlobStorageComponent.js";
|
|
16
|
+
export * from "./models/IBlobStorageConnector.js";
|
|
17
|
+
export * from "./models/IBlobStorageEntry.js";
|
|
18
|
+
export * from "./models/IBlobStorageEntryList.js";
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import type { IComponent } from "@twin.org/core";
|
|
2
2
|
import type { IJsonLdNodeObject } from "@twin.org/data-json-ld";
|
|
3
3
|
import type { EntityCondition, SortDirection } from "@twin.org/entity";
|
|
4
|
-
import type { BlobStorageCompressionType } from "./blobStorageCompressionType";
|
|
5
|
-
import type { IBlobStorageEntry } from "./IBlobStorageEntry";
|
|
6
|
-
import type { IBlobStorageEntryList } from "./IBlobStorageEntryList";
|
|
4
|
+
import type { BlobStorageCompressionType } from "./blobStorageCompressionType.js";
|
|
5
|
+
import type { IBlobStorageEntry } from "./IBlobStorageEntry.js";
|
|
6
|
+
import type { IBlobStorageEntryList } from "./IBlobStorageEntryList.js";
|
|
7
7
|
/**
|
|
8
8
|
* Interface describing an blob storage component.
|
|
9
9
|
*/
|
|
@@ -19,8 +19,6 @@ export interface IBlobStorageComponent extends IComponent {
|
|
|
19
19
|
* @param options.overrideVaultKeyId Use a different vault key id for encryption, if not provided the default vault key id will be used.
|
|
20
20
|
* @param options.compress Optional compression type to use for the blob, defaults to no compression.
|
|
21
21
|
* @param options.namespace The namespace to use for storing, defaults to component configured namespace.
|
|
22
|
-
* @param userIdentity The user identity to use with storage operations.
|
|
23
|
-
* @param nodeIdentity The node identity to use with storage operations.
|
|
24
22
|
* @returns The id of the stored blob in urn format.
|
|
25
23
|
*/
|
|
26
24
|
create(blob: string, encodingFormat?: string, fileExtension?: string, metadata?: IJsonLdNodeObject, options?: {
|
|
@@ -28,7 +26,7 @@ export interface IBlobStorageComponent extends IComponent {
|
|
|
28
26
|
overrideVaultKeyId?: string;
|
|
29
27
|
compress?: BlobStorageCompressionType;
|
|
30
28
|
namespace?: string;
|
|
31
|
-
}
|
|
29
|
+
}): Promise<string>;
|
|
32
30
|
/**
|
|
33
31
|
* Get the blob and metadata.
|
|
34
32
|
* @param id The id of the blob to get in urn format.
|
|
@@ -36,8 +34,6 @@ export interface IBlobStorageComponent extends IComponent {
|
|
|
36
34
|
* @param options.includeContent Include the content, or just get the metadata.
|
|
37
35
|
* @param options.overrideVaultKeyId Use a different vault key id for decryption, if not provided the default vault key id will be used.
|
|
38
36
|
* @param options.decompress If the content should be decompressed, if it was compressed when stored, defaults to true.
|
|
39
|
-
* @param userIdentity The user identity to use with storage operations.
|
|
40
|
-
* @param nodeIdentity The node identity to use with storage operations.
|
|
41
37
|
* @returns The data and metadata for the blob if it can be found.
|
|
42
38
|
* @throws Not found error if the blob cannot be found.
|
|
43
39
|
*/
|
|
@@ -45,26 +41,24 @@ export interface IBlobStorageComponent extends IComponent {
|
|
|
45
41
|
includeContent?: boolean;
|
|
46
42
|
decompress?: boolean;
|
|
47
43
|
overrideVaultKeyId?: string;
|
|
48
|
-
}
|
|
44
|
+
}): Promise<IBlobStorageEntry>;
|
|
49
45
|
/**
|
|
50
46
|
* Update the blob with metadata.
|
|
51
47
|
* @param id The id of the blob metadata to update.
|
|
52
48
|
* @param encodingFormat Mime type for the blob, will be detected if left undefined.
|
|
53
49
|
* @param fileExtension Extension for the blob, will be detected if left undefined.
|
|
54
50
|
* @param metadata Data for the custom metadata as JSON-LD.
|
|
55
|
-
* @param userIdentity The user identity to use with storage operations.
|
|
56
51
|
* @returns Nothing.
|
|
57
52
|
* @throws Not found error if the blob cannot be found.
|
|
58
53
|
*/
|
|
59
|
-
update(id: string, encodingFormat?: string, fileExtension?: string, metadata?: IJsonLdNodeObject
|
|
54
|
+
update(id: string, encodingFormat?: string, fileExtension?: string, metadata?: IJsonLdNodeObject): Promise<void>;
|
|
60
55
|
/**
|
|
61
56
|
* Remove the blob.
|
|
62
57
|
* @param id The id of the blob to remove in urn format.
|
|
63
|
-
* @param userIdentity The user identity to use with storage operations.
|
|
64
58
|
* @returns Nothing.
|
|
65
59
|
* @throws Not found error if the blob cannot be found.
|
|
66
60
|
*/
|
|
67
|
-
remove(id: string
|
|
61
|
+
remove(id: string): Promise<void>;
|
|
68
62
|
/**
|
|
69
63
|
* Query all the blob storage entries which match the conditions.
|
|
70
64
|
* @param conditions The conditions to match for the entries.
|
|
@@ -72,9 +66,8 @@ export interface IBlobStorageComponent extends IComponent {
|
|
|
72
66
|
* @param orderByDirection The direction for the order, defaults to descending.
|
|
73
67
|
* @param cursor The cursor to request the next page of entries.
|
|
74
68
|
* @param limit The suggested number of entries to return in each chunk, in some scenarios can return a different amount.
|
|
75
|
-
* @param userIdentity The user identity to use with storage operations.
|
|
76
69
|
* @returns All the entries for the storage matching the conditions,
|
|
77
70
|
* and a cursor which can be used to request more entities.
|
|
78
71
|
*/
|
|
79
|
-
query(conditions?: EntityCondition<IBlobStorageEntry>, orderBy?: keyof Pick<IBlobStorageEntry, "dateCreated" | "dateModified">, orderByDirection?: SortDirection, cursor?: string, limit?: number
|
|
72
|
+
query(conditions?: EntityCondition<IBlobStorageEntry>, orderBy?: keyof Pick<IBlobStorageEntry, "dateCreated" | "dateModified">, orderByDirection?: SortDirection, cursor?: string, limit?: number): Promise<IBlobStorageEntryList>;
|
|
80
73
|
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import type { IJsonLdContextDefinitionElement, IJsonLdNodeObject } from "@twin.org/data-json-ld";
|
|
2
|
-
import type { BlobStorageCompressionType } from "./blobStorageCompressionType";
|
|
3
|
-
import type { BlobStorageContexts } from "./blobStorageContexts";
|
|
4
|
-
import type { BlobStorageTypes } from "./blobStorageTypes";
|
|
2
|
+
import type { BlobStorageCompressionType } from "./blobStorageCompressionType.js";
|
|
3
|
+
import type { BlobStorageContexts } from "./blobStorageContexts.js";
|
|
4
|
+
import type { BlobStorageTypes } from "./blobStorageTypes.js";
|
|
5
5
|
/**
|
|
6
6
|
* Interface describing a blob storage entry.
|
|
7
7
|
*/
|
|
@@ -10,8 +10,8 @@ export interface IBlobStorageEntry {
|
|
|
10
10
|
* JSON-LD Context.
|
|
11
11
|
*/
|
|
12
12
|
"@context": [
|
|
13
|
-
typeof BlobStorageContexts.
|
|
14
|
-
typeof BlobStorageContexts.
|
|
13
|
+
typeof BlobStorageContexts.Namespace,
|
|
14
|
+
typeof BlobStorageContexts.NamespaceCommon,
|
|
15
15
|
...IJsonLdContextDefinitionElement[]
|
|
16
16
|
];
|
|
17
17
|
/**
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import type { IJsonLdContextDefinitionElement } from "@twin.org/data-json-ld";
|
|
2
2
|
import type { SchemaOrgContexts, SchemaOrgTypes } from "@twin.org/standards-schema-org";
|
|
3
|
-
import type { BlobStorageContexts } from "./blobStorageContexts";
|
|
4
|
-
import type { IBlobStorageEntry } from "./IBlobStorageEntry";
|
|
3
|
+
import type { BlobStorageContexts } from "./blobStorageContexts.js";
|
|
4
|
+
import type { IBlobStorageEntry } from "./IBlobStorageEntry.js";
|
|
5
5
|
/**
|
|
6
6
|
* Interface describing an blob storage entry list.
|
|
7
7
|
*/
|
|
@@ -10,9 +10,9 @@ export interface IBlobStorageEntryList {
|
|
|
10
10
|
* JSON-LD Context.
|
|
11
11
|
*/
|
|
12
12
|
"@context": [
|
|
13
|
-
typeof SchemaOrgContexts.
|
|
14
|
-
typeof BlobStorageContexts.
|
|
15
|
-
typeof BlobStorageContexts.
|
|
13
|
+
typeof SchemaOrgContexts.Namespace,
|
|
14
|
+
typeof BlobStorageContexts.Namespace,
|
|
15
|
+
typeof BlobStorageContexts.NamespaceCommon,
|
|
16
16
|
...IJsonLdContextDefinitionElement[]
|
|
17
17
|
];
|
|
18
18
|
/**
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { IJsonLdNodeObject } from "@twin.org/data-json-ld";
|
|
2
|
-
import type { BlobStorageCompressionType } from "../blobStorageCompressionType";
|
|
2
|
+
import type { BlobStorageCompressionType } from "../blobStorageCompressionType.js";
|
|
3
3
|
/**
|
|
4
4
|
* Request to create an entry in blob storage.
|
|
5
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?:
|
|
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?:
|
|
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?:
|
|
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?:
|
|
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
|