@twin.org/blob-storage-models 0.0.2-next.5 → 0.0.3-next.1
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 +3 -3
- package/dist/types/models/IBlobStorageEntryList.d.ts +2 -2
- package/dist/types/models/api/IBlobStorageCreateRequest.d.ts +1 -1
- 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/docs/changelog.md +24 -0
- package/docs/reference/interfaces/IBlobStorageComponent.md +5 -55
- package/docs/reference/interfaces/IBlobStorageConnector.md +2 -10
- 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.ContextRoot}${BlobStorageTypes.Entry}`, () => ({
|
|
17
|
+
context: BlobStorageContexts.ContextRoot,
|
|
18
|
+
type: BlobStorageTypes.Entry,
|
|
19
|
+
defaultValue: {},
|
|
20
|
+
jsonSchema: async () => BlobStorageEntrySchema
|
|
21
|
+
}));
|
|
22
|
+
DataTypeHandlerFactory.register(`${BlobStorageContexts.ContextRoot}${BlobStorageTypes.CompressionType}`, () => ({
|
|
23
|
+
context: BlobStorageContexts.ContextRoot,
|
|
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,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"]}
|
|
@@ -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.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"]}
|
|
@@ -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.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"]}
|
|
@@ -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?: 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"]}
|
|
@@ -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?: 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"]}
|
|
@@ -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
|
+
ContextRoot: "https://schema.twindev.org/blob-storage/",
|
|
12
|
+
/**
|
|
13
|
+
* The context root for the common types.
|
|
14
|
+
*/
|
|
15
|
+
ContextRootCommon: "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,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"]}
|
|
@@ -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
|
*/
|
|
@@ -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
|
*/
|
|
@@ -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
|
*/
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { SortDirection } from "@twin.org/entity";
|
|
2
2
|
import type { HeaderTypes, MimeTypes } from "@twin.org/web";
|
|
3
|
-
import type { IBlobStorageEntry } from "../IBlobStorageEntry";
|
|
3
|
+
import type { IBlobStorageEntry } from "../IBlobStorageEntry.js";
|
|
4
4
|
/**
|
|
5
5
|
* Query the entries from blob storage.
|
|
6
6
|
*/
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { HeaderTypes, MimeTypes } from "@twin.org/web";
|
|
2
|
-
import type { IBlobStorageEntryList } from "../IBlobStorageEntryList";
|
|
2
|
+
import type { IBlobStorageEntryList } from "../IBlobStorageEntryList.js";
|
|
3
3
|
/**
|
|
4
4
|
* Response to getting the list of entries from a query.
|
|
5
5
|
*/
|
package/docs/changelog.md
CHANGED
|
@@ -1,5 +1,29 @@
|
|
|
1
1
|
# @twin.org/blob-storage-models - Changelog
|
|
2
2
|
|
|
3
|
+
## [0.0.3-next.1](https://github.com/twinfoundation/blob-storage/compare/blob-storage-models-v0.0.3-next.0...blob-storage-models-v0.0.3-next.1) (2025-11-11)
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
### Features
|
|
7
|
+
|
|
8
|
+
* add compression support ([67d239b](https://github.com/twinfoundation/blob-storage/commit/67d239bca8321bd90bf4ff93167c564130309730))
|
|
9
|
+
* add context id features ([#30](https://github.com/twinfoundation/blob-storage/issues/30)) ([fbf1c92](https://github.com/twinfoundation/blob-storage/commit/fbf1c9276424c841ef5ef3f4de8469ab3fba7e9c))
|
|
10
|
+
* add validate-locales ([f20fcec](https://github.com/twinfoundation/blob-storage/commit/f20fceced91e39a0c9edb770b2e43ce944c92f3c))
|
|
11
|
+
* additional encryption options on per item basis ([4b95a65](https://github.com/twinfoundation/blob-storage/commit/4b95a656d19e3b571cea905e36f29b679b13e1e8))
|
|
12
|
+
* eslint migration to flat config ([e4239dd](https://github.com/twinfoundation/blob-storage/commit/e4239dd1c721955cff7f0357255d2bba15319972))
|
|
13
|
+
* remove includeNodeIdentity flag ([13bc334](https://github.com/twinfoundation/blob-storage/commit/13bc33445b179879688af3c98e8be8a5609d3f46))
|
|
14
|
+
* update dependencies ([56f0094](https://github.com/twinfoundation/blob-storage/commit/56f0094b68d8bd22864cd899ac1b61d95540f719))
|
|
15
|
+
* update framework core ([ff339fe](https://github.com/twinfoundation/blob-storage/commit/ff339fe7e3f09ddff429907834bdf43617e9c05e))
|
|
16
|
+
* update to support fully qualified data type names ([3297d69](https://github.com/twinfoundation/blob-storage/commit/3297d69d332058b0f0141002087f56ba230620e1))
|
|
17
|
+
* update ts-to-schema generation ([03439c7](https://github.com/twinfoundation/blob-storage/commit/03439c726108bf645941290e41824c57a6a23de3))
|
|
18
|
+
* use shared store mechanism ([#12](https://github.com/twinfoundation/blob-storage/issues/12)) ([cae8110](https://github.com/twinfoundation/blob-storage/commit/cae8110681847a1ac4fcac968b8196694e49c320))
|
|
19
|
+
* use standard list json ld types ([d6bdfd6](https://github.com/twinfoundation/blob-storage/commit/d6bdfd68af47f70f3cc53658b4a12543497e1f48))
|
|
20
|
+
|
|
21
|
+
|
|
22
|
+
### Bug Fixes
|
|
23
|
+
|
|
24
|
+
* Adding the optional flag to the entity ([#10](https://github.com/twinfoundation/blob-storage/issues/10)) ([626677e](https://github.com/twinfoundation/blob-storage/commit/626677e5730d23535a0eb1f36f8394d941ff2447))
|
|
25
|
+
* query params force coercion ([a5e547a](https://github.com/twinfoundation/blob-storage/commit/a5e547a775f8997cb04780938c7a9561ddb048d1))
|
|
26
|
+
|
|
3
27
|
## [0.0.2-next.5](https://github.com/twinfoundation/blob-storage/compare/blob-storage-models-v0.0.2-next.4...blob-storage-models-v0.0.2-next.5) (2025-10-09)
|
|
4
28
|
|
|
5
29
|
|
|
@@ -6,19 +6,11 @@ Interface describing an blob storage component.
|
|
|
6
6
|
|
|
7
7
|
- `IComponent`
|
|
8
8
|
|
|
9
|
-
## Indexable
|
|
10
|
-
|
|
11
|
-
\[`key`: `string`\]: `any`
|
|
12
|
-
|
|
13
|
-
All methods are optional, so we introduce an index signature to allow
|
|
14
|
-
any additional properties or methods, which removes the TypeScript error where
|
|
15
|
-
the class has no properties in common with the type.
|
|
16
|
-
|
|
17
9
|
## Methods
|
|
18
10
|
|
|
19
11
|
### create()
|
|
20
12
|
|
|
21
|
-
> **create**(`blob`, `encodingFormat?`, `fileExtension?`, `metadata?`, `options
|
|
13
|
+
> **create**(`blob`, `encodingFormat?`, `fileExtension?`, `metadata?`, `options?`): `Promise`\<`string`\>
|
|
22
14
|
|
|
23
15
|
Create the blob with some metadata.
|
|
24
16
|
|
|
@@ -76,18 +68,6 @@ Optional compression type to use for the blob, defaults to no compression.
|
|
|
76
68
|
|
|
77
69
|
The namespace to use for storing, defaults to component configured namespace.
|
|
78
70
|
|
|
79
|
-
##### userIdentity?
|
|
80
|
-
|
|
81
|
-
`string`
|
|
82
|
-
|
|
83
|
-
The user identity to use with storage operations.
|
|
84
|
-
|
|
85
|
-
##### nodeIdentity?
|
|
86
|
-
|
|
87
|
-
`string`
|
|
88
|
-
|
|
89
|
-
The node identity to use with storage operations.
|
|
90
|
-
|
|
91
71
|
#### Returns
|
|
92
72
|
|
|
93
73
|
`Promise`\<`string`\>
|
|
@@ -98,7 +78,7 @@ The id of the stored blob in urn format.
|
|
|
98
78
|
|
|
99
79
|
### get()
|
|
100
80
|
|
|
101
|
-
> **get**(`id`, `options
|
|
81
|
+
> **get**(`id`, `options?`): `Promise`\<[`IBlobStorageEntry`](IBlobStorageEntry.md)\>
|
|
102
82
|
|
|
103
83
|
Get the blob and metadata.
|
|
104
84
|
|
|
@@ -132,18 +112,6 @@ If the content should be decompressed, if it was compressed when stored, default
|
|
|
132
112
|
|
|
133
113
|
Use a different vault key id for decryption, if not provided the default vault key id will be used.
|
|
134
114
|
|
|
135
|
-
##### userIdentity?
|
|
136
|
-
|
|
137
|
-
`string`
|
|
138
|
-
|
|
139
|
-
The user identity to use with storage operations.
|
|
140
|
-
|
|
141
|
-
##### nodeIdentity?
|
|
142
|
-
|
|
143
|
-
`string`
|
|
144
|
-
|
|
145
|
-
The node identity to use with storage operations.
|
|
146
|
-
|
|
147
115
|
#### Returns
|
|
148
116
|
|
|
149
117
|
`Promise`\<[`IBlobStorageEntry`](IBlobStorageEntry.md)\>
|
|
@@ -158,7 +126,7 @@ Not found error if the blob cannot be found.
|
|
|
158
126
|
|
|
159
127
|
### update()
|
|
160
128
|
|
|
161
|
-
> **update**(`id`, `encodingFormat?`, `fileExtension?`, `metadata
|
|
129
|
+
> **update**(`id`, `encodingFormat?`, `fileExtension?`, `metadata?`): `Promise`\<`void`\>
|
|
162
130
|
|
|
163
131
|
Update the blob with metadata.
|
|
164
132
|
|
|
@@ -188,12 +156,6 @@ Extension for the blob, will be detected if left undefined.
|
|
|
188
156
|
|
|
189
157
|
Data for the custom metadata as JSON-LD.
|
|
190
158
|
|
|
191
|
-
##### userIdentity?
|
|
192
|
-
|
|
193
|
-
`string`
|
|
194
|
-
|
|
195
|
-
The user identity to use with storage operations.
|
|
196
|
-
|
|
197
159
|
#### Returns
|
|
198
160
|
|
|
199
161
|
`Promise`\<`void`\>
|
|
@@ -208,7 +170,7 @@ Not found error if the blob cannot be found.
|
|
|
208
170
|
|
|
209
171
|
### remove()
|
|
210
172
|
|
|
211
|
-
> **remove**(`id
|
|
173
|
+
> **remove**(`id`): `Promise`\<`void`\>
|
|
212
174
|
|
|
213
175
|
Remove the blob.
|
|
214
176
|
|
|
@@ -220,12 +182,6 @@ Remove the blob.
|
|
|
220
182
|
|
|
221
183
|
The id of the blob to remove in urn format.
|
|
222
184
|
|
|
223
|
-
##### userIdentity?
|
|
224
|
-
|
|
225
|
-
`string`
|
|
226
|
-
|
|
227
|
-
The user identity to use with storage operations.
|
|
228
|
-
|
|
229
185
|
#### Returns
|
|
230
186
|
|
|
231
187
|
`Promise`\<`void`\>
|
|
@@ -240,7 +196,7 @@ Not found error if the blob cannot be found.
|
|
|
240
196
|
|
|
241
197
|
### query()
|
|
242
198
|
|
|
243
|
-
> **query**(`conditions?`, `orderBy?`, `orderByDirection?`, `cursor?`, `limit
|
|
199
|
+
> **query**(`conditions?`, `orderBy?`, `orderByDirection?`, `cursor?`, `limit?`): `Promise`\<[`IBlobStorageEntryList`](IBlobStorageEntryList.md)\>
|
|
244
200
|
|
|
245
201
|
Query all the blob storage entries which match the conditions.
|
|
246
202
|
|
|
@@ -276,12 +232,6 @@ The cursor to request the next page of entries.
|
|
|
276
232
|
|
|
277
233
|
The suggested number of entries to return in each chunk, in some scenarios can return a different amount.
|
|
278
234
|
|
|
279
|
-
##### userIdentity?
|
|
280
|
-
|
|
281
|
-
`string`
|
|
282
|
-
|
|
283
|
-
The user identity to use with storage operations.
|
|
284
|
-
|
|
285
235
|
#### Returns
|
|
286
236
|
|
|
287
237
|
`Promise`\<[`IBlobStorageEntryList`](IBlobStorageEntryList.md)\>
|
|
@@ -6,14 +6,6 @@ Interface describing an blob storage connector.
|
|
|
6
6
|
|
|
7
7
|
- `IComponent`
|
|
8
8
|
|
|
9
|
-
## Indexable
|
|
10
|
-
|
|
11
|
-
\[`key`: `string`\]: `any`
|
|
12
|
-
|
|
13
|
-
All methods are optional, so we introduce an index signature to allow
|
|
14
|
-
any additional properties or methods, which removes the TypeScript error where
|
|
15
|
-
the class has no properties in common with the type.
|
|
16
|
-
|
|
17
9
|
## Methods
|
|
18
10
|
|
|
19
11
|
### set()
|
|
@@ -40,7 +32,7 @@ The id of the stored blob in urn format.
|
|
|
40
32
|
|
|
41
33
|
### get()
|
|
42
34
|
|
|
43
|
-
> **get**(`id`): `Promise`\<`
|
|
35
|
+
> **get**(`id`): `Promise`\<`Uint8Array`\<`ArrayBufferLike`\> \| `undefined`\>
|
|
44
36
|
|
|
45
37
|
Get the blob.
|
|
46
38
|
|
|
@@ -54,7 +46,7 @@ The id of the blob to get in urn format.
|
|
|
54
46
|
|
|
55
47
|
#### Returns
|
|
56
48
|
|
|
57
|
-
`Promise`\<`
|
|
49
|
+
`Promise`\<`Uint8Array`\<`ArrayBufferLike`\> \| `undefined`\>
|
|
58
50
|
|
|
59
51
|
The data for the blob if it can be found or undefined.
|
|
60
52
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@twin.org/blob-storage-models",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.3-next.1",
|
|
4
4
|
"description": "Models which define the structure of the blob storage contracts and connectors",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -22,20 +22,18 @@
|
|
|
22
22
|
"@twin.org/standards-schema-org": "next",
|
|
23
23
|
"@twin.org/web": "next"
|
|
24
24
|
},
|
|
25
|
-
"main": "./dist/
|
|
26
|
-
"module": "./dist/esm/index.mjs",
|
|
25
|
+
"main": "./dist/es/index.js",
|
|
27
26
|
"types": "./dist/types/index.d.ts",
|
|
28
27
|
"exports": {
|
|
29
28
|
".": {
|
|
30
29
|
"types": "./dist/types/index.d.ts",
|
|
31
|
-
"
|
|
32
|
-
"
|
|
30
|
+
"import": "./dist/es/index.js",
|
|
31
|
+
"default": "./dist/es/index.js"
|
|
33
32
|
},
|
|
34
33
|
"./locales/*.json": "./locales/*.json"
|
|
35
34
|
},
|
|
36
35
|
"files": [
|
|
37
|
-
"dist/
|
|
38
|
-
"dist/esm",
|
|
36
|
+
"dist/es",
|
|
39
37
|
"dist/types",
|
|
40
38
|
"locales",
|
|
41
39
|
"docs"
|
package/dist/cjs/index.cjs
DELETED
|
@@ -1,201 +0,0 @@
|
|
|
1
|
-
'use strict';
|
|
2
|
-
|
|
3
|
-
var dataCore = require('@twin.org/data-core');
|
|
4
|
-
var core = require('@twin.org/core');
|
|
5
|
-
|
|
6
|
-
// Copyright 2024 IOTA Stiftung.
|
|
7
|
-
// SPDX-License-Identifier: Apache-2.0.
|
|
8
|
-
/**
|
|
9
|
-
* The contexts of blob storage data.
|
|
10
|
-
*/
|
|
11
|
-
// eslint-disable-next-line @typescript-eslint/naming-convention
|
|
12
|
-
const BlobStorageContexts = {
|
|
13
|
-
/**
|
|
14
|
-
* The context root for the blob storage types.
|
|
15
|
-
*/
|
|
16
|
-
ContextRoot: "https://schema.twindev.org/blob-storage/",
|
|
17
|
-
/**
|
|
18
|
-
* The context root for the common types.
|
|
19
|
-
*/
|
|
20
|
-
ContextRootCommon: "https://schema.twindev.org/common/"
|
|
21
|
-
};
|
|
22
|
-
|
|
23
|
-
// Copyright 2024 IOTA Stiftung.
|
|
24
|
-
// SPDX-License-Identifier: Apache-2.0.
|
|
25
|
-
/**
|
|
26
|
-
* The types of blob storage data.
|
|
27
|
-
*/
|
|
28
|
-
// eslint-disable-next-line @typescript-eslint/naming-convention
|
|
29
|
-
const BlobStorageTypes = {
|
|
30
|
-
/**
|
|
31
|
-
* Represents blob storage entry.
|
|
32
|
-
*/
|
|
33
|
-
Entry: "BlobStorageEntry",
|
|
34
|
-
/**
|
|
35
|
-
* Represents blob storage entry compression.
|
|
36
|
-
*/
|
|
37
|
-
CompressionType: "BlobStorageCompressionType"
|
|
38
|
-
};
|
|
39
|
-
|
|
40
|
-
var $schema$1 = "https://json-schema.org/draft/2020-12/schema";
|
|
41
|
-
var $id$1 = "https://schema.twindev.org/blob-storage/BlobStorageCompressionType";
|
|
42
|
-
var description$1 = "The types of compression for blob storage data.";
|
|
43
|
-
var type$1 = "string";
|
|
44
|
-
var BlobStorageCompressionTypeSchema = {
|
|
45
|
-
$schema: $schema$1,
|
|
46
|
-
$id: $id$1,
|
|
47
|
-
description: description$1,
|
|
48
|
-
type: type$1,
|
|
49
|
-
"enum": [
|
|
50
|
-
"gzip",
|
|
51
|
-
"deflate"
|
|
52
|
-
]
|
|
53
|
-
};
|
|
54
|
-
|
|
55
|
-
var $schema = "https://json-schema.org/draft/2020-12/schema";
|
|
56
|
-
var $id = "https://schema.twindev.org/blob-storage/BlobStorageEntry";
|
|
57
|
-
var description = "Interface describing a blob storage entry.";
|
|
58
|
-
var type = "object";
|
|
59
|
-
var properties = {
|
|
60
|
-
"@context": {
|
|
61
|
-
type: "array",
|
|
62
|
-
minItems: 2,
|
|
63
|
-
items: {
|
|
64
|
-
$ref: "https://schema.twindev.org/json-ld/JsonLdContextDefinitionElement"
|
|
65
|
-
},
|
|
66
|
-
description: "JSON-LD Context.",
|
|
67
|
-
prefixItems: [
|
|
68
|
-
{
|
|
69
|
-
type: "string",
|
|
70
|
-
"const": "https://schema.twindev.org/blob-storage/"
|
|
71
|
-
},
|
|
72
|
-
{
|
|
73
|
-
type: "string",
|
|
74
|
-
"const": "https://schema.twindev.org/common/"
|
|
75
|
-
}
|
|
76
|
-
]
|
|
77
|
-
},
|
|
78
|
-
type: {
|
|
79
|
-
type: "string",
|
|
80
|
-
"const": "BlobStorageEntry",
|
|
81
|
-
description: "JSON-LD Type."
|
|
82
|
-
},
|
|
83
|
-
id: {
|
|
84
|
-
type: "string",
|
|
85
|
-
description: "The id for the blob."
|
|
86
|
-
},
|
|
87
|
-
dateCreated: {
|
|
88
|
-
type: "string",
|
|
89
|
-
description: "The date/time when the entry was created."
|
|
90
|
-
},
|
|
91
|
-
dateModified: {
|
|
92
|
-
type: "string",
|
|
93
|
-
description: "The date/time when the entry was modified."
|
|
94
|
-
},
|
|
95
|
-
blobSize: {
|
|
96
|
-
type: "number",
|
|
97
|
-
description: "The size of the data in the blob."
|
|
98
|
-
},
|
|
99
|
-
blobHash: {
|
|
100
|
-
type: "string",
|
|
101
|
-
description: "The hash of the data in the blob."
|
|
102
|
-
},
|
|
103
|
-
encodingFormat: {
|
|
104
|
-
type: "string",
|
|
105
|
-
description: "The mime type for the blob."
|
|
106
|
-
},
|
|
107
|
-
isEncrypted: {
|
|
108
|
-
type: "boolean",
|
|
109
|
-
description: "Indicates if the blob is encrypted."
|
|
110
|
-
},
|
|
111
|
-
compression: {
|
|
112
|
-
$ref: "https://schema.twindev.org/blob-storage/BlobStorageCompressionType",
|
|
113
|
-
description: "The type of compression used for the blob, if not set it is not stored with compression."
|
|
114
|
-
},
|
|
115
|
-
fileExtension: {
|
|
116
|
-
type: "string",
|
|
117
|
-
description: "The extension."
|
|
118
|
-
},
|
|
119
|
-
metadata: {
|
|
120
|
-
$ref: "https://schema.twindev.org/json-ld/JsonLdNodeObject",
|
|
121
|
-
description: "The metadata for the blob as JSON-LD."
|
|
122
|
-
},
|
|
123
|
-
blob: {
|
|
124
|
-
type: "string",
|
|
125
|
-
description: "The blob in base64 format, included if the includeContent flag was set in the request."
|
|
126
|
-
}
|
|
127
|
-
};
|
|
128
|
-
var required = [
|
|
129
|
-
"@context",
|
|
130
|
-
"type",
|
|
131
|
-
"id",
|
|
132
|
-
"dateCreated",
|
|
133
|
-
"blobSize",
|
|
134
|
-
"blobHash"
|
|
135
|
-
];
|
|
136
|
-
var additionalProperties = false;
|
|
137
|
-
var BlobStorageEntrySchema = {
|
|
138
|
-
$schema: $schema,
|
|
139
|
-
$id: $id,
|
|
140
|
-
description: description,
|
|
141
|
-
type: type,
|
|
142
|
-
properties: properties,
|
|
143
|
-
required: required,
|
|
144
|
-
additionalProperties: additionalProperties
|
|
145
|
-
};
|
|
146
|
-
|
|
147
|
-
// Copyright 2024 IOTA Stiftung.
|
|
148
|
-
// SPDX-License-Identifier: Apache-2.0.
|
|
149
|
-
/**
|
|
150
|
-
* Handle all the data types for blob storage.
|
|
151
|
-
*/
|
|
152
|
-
class BlobStorageDataTypes {
|
|
153
|
-
/**
|
|
154
|
-
* Register all the data types.
|
|
155
|
-
*/
|
|
156
|
-
static registerTypes() {
|
|
157
|
-
dataCore.DataTypeHandlerFactory.register(`${BlobStorageContexts.ContextRoot}${BlobStorageTypes.Entry}`, () => ({
|
|
158
|
-
context: BlobStorageContexts.ContextRoot,
|
|
159
|
-
type: BlobStorageTypes.Entry,
|
|
160
|
-
defaultValue: {},
|
|
161
|
-
jsonSchema: async () => BlobStorageEntrySchema
|
|
162
|
-
}));
|
|
163
|
-
dataCore.DataTypeHandlerFactory.register(`${BlobStorageContexts.ContextRoot}${BlobStorageTypes.CompressionType}`, () => ({
|
|
164
|
-
context: BlobStorageContexts.ContextRoot,
|
|
165
|
-
type: BlobStorageTypes.CompressionType,
|
|
166
|
-
defaultValue: {},
|
|
167
|
-
jsonSchema: async () => BlobStorageCompressionTypeSchema
|
|
168
|
-
}));
|
|
169
|
-
}
|
|
170
|
-
}
|
|
171
|
-
|
|
172
|
-
// Copyright 2024 IOTA Stiftung.
|
|
173
|
-
// SPDX-License-Identifier: Apache-2.0.
|
|
174
|
-
/**
|
|
175
|
-
* Factory for creating blob storage connectors.
|
|
176
|
-
*/
|
|
177
|
-
// eslint-disable-next-line @typescript-eslint/naming-convention
|
|
178
|
-
const BlobStorageConnectorFactory = core.Factory.createFactory("blob-storage");
|
|
179
|
-
|
|
180
|
-
// Copyright 2024 IOTA Stiftung.
|
|
181
|
-
// SPDX-License-Identifier: Apache-2.0.
|
|
182
|
-
/**
|
|
183
|
-
* The types of compression for blob storage data.
|
|
184
|
-
*/
|
|
185
|
-
// eslint-disable-next-line @typescript-eslint/naming-convention
|
|
186
|
-
const BlobStorageCompressionType = {
|
|
187
|
-
/**
|
|
188
|
-
* Gzip.
|
|
189
|
-
*/
|
|
190
|
-
Gzip: "gzip",
|
|
191
|
-
/**
|
|
192
|
-
* Deflate.
|
|
193
|
-
*/
|
|
194
|
-
Deflate: "deflate"
|
|
195
|
-
};
|
|
196
|
-
|
|
197
|
-
exports.BlobStorageCompressionType = BlobStorageCompressionType;
|
|
198
|
-
exports.BlobStorageConnectorFactory = BlobStorageConnectorFactory;
|
|
199
|
-
exports.BlobStorageContexts = BlobStorageContexts;
|
|
200
|
-
exports.BlobStorageDataTypes = BlobStorageDataTypes;
|
|
201
|
-
exports.BlobStorageTypes = BlobStorageTypes;
|
package/dist/esm/index.mjs
DELETED
|
@@ -1,195 +0,0 @@
|
|
|
1
|
-
import { DataTypeHandlerFactory } from '@twin.org/data-core';
|
|
2
|
-
import { Factory } from '@twin.org/core';
|
|
3
|
-
|
|
4
|
-
// Copyright 2024 IOTA Stiftung.
|
|
5
|
-
// SPDX-License-Identifier: Apache-2.0.
|
|
6
|
-
/**
|
|
7
|
-
* The contexts of blob storage data.
|
|
8
|
-
*/
|
|
9
|
-
// eslint-disable-next-line @typescript-eslint/naming-convention
|
|
10
|
-
const BlobStorageContexts = {
|
|
11
|
-
/**
|
|
12
|
-
* The context root for the blob storage types.
|
|
13
|
-
*/
|
|
14
|
-
ContextRoot: "https://schema.twindev.org/blob-storage/",
|
|
15
|
-
/**
|
|
16
|
-
* The context root for the common types.
|
|
17
|
-
*/
|
|
18
|
-
ContextRootCommon: "https://schema.twindev.org/common/"
|
|
19
|
-
};
|
|
20
|
-
|
|
21
|
-
// Copyright 2024 IOTA Stiftung.
|
|
22
|
-
// SPDX-License-Identifier: Apache-2.0.
|
|
23
|
-
/**
|
|
24
|
-
* The types of blob storage data.
|
|
25
|
-
*/
|
|
26
|
-
// eslint-disable-next-line @typescript-eslint/naming-convention
|
|
27
|
-
const BlobStorageTypes = {
|
|
28
|
-
/**
|
|
29
|
-
* Represents blob storage entry.
|
|
30
|
-
*/
|
|
31
|
-
Entry: "BlobStorageEntry",
|
|
32
|
-
/**
|
|
33
|
-
* Represents blob storage entry compression.
|
|
34
|
-
*/
|
|
35
|
-
CompressionType: "BlobStorageCompressionType"
|
|
36
|
-
};
|
|
37
|
-
|
|
38
|
-
var $schema$1 = "https://json-schema.org/draft/2020-12/schema";
|
|
39
|
-
var $id$1 = "https://schema.twindev.org/blob-storage/BlobStorageCompressionType";
|
|
40
|
-
var description$1 = "The types of compression for blob storage data.";
|
|
41
|
-
var type$1 = "string";
|
|
42
|
-
var BlobStorageCompressionTypeSchema = {
|
|
43
|
-
$schema: $schema$1,
|
|
44
|
-
$id: $id$1,
|
|
45
|
-
description: description$1,
|
|
46
|
-
type: type$1,
|
|
47
|
-
"enum": [
|
|
48
|
-
"gzip",
|
|
49
|
-
"deflate"
|
|
50
|
-
]
|
|
51
|
-
};
|
|
52
|
-
|
|
53
|
-
var $schema = "https://json-schema.org/draft/2020-12/schema";
|
|
54
|
-
var $id = "https://schema.twindev.org/blob-storage/BlobStorageEntry";
|
|
55
|
-
var description = "Interface describing a blob storage entry.";
|
|
56
|
-
var type = "object";
|
|
57
|
-
var properties = {
|
|
58
|
-
"@context": {
|
|
59
|
-
type: "array",
|
|
60
|
-
minItems: 2,
|
|
61
|
-
items: {
|
|
62
|
-
$ref: "https://schema.twindev.org/json-ld/JsonLdContextDefinitionElement"
|
|
63
|
-
},
|
|
64
|
-
description: "JSON-LD Context.",
|
|
65
|
-
prefixItems: [
|
|
66
|
-
{
|
|
67
|
-
type: "string",
|
|
68
|
-
"const": "https://schema.twindev.org/blob-storage/"
|
|
69
|
-
},
|
|
70
|
-
{
|
|
71
|
-
type: "string",
|
|
72
|
-
"const": "https://schema.twindev.org/common/"
|
|
73
|
-
}
|
|
74
|
-
]
|
|
75
|
-
},
|
|
76
|
-
type: {
|
|
77
|
-
type: "string",
|
|
78
|
-
"const": "BlobStorageEntry",
|
|
79
|
-
description: "JSON-LD Type."
|
|
80
|
-
},
|
|
81
|
-
id: {
|
|
82
|
-
type: "string",
|
|
83
|
-
description: "The id for the blob."
|
|
84
|
-
},
|
|
85
|
-
dateCreated: {
|
|
86
|
-
type: "string",
|
|
87
|
-
description: "The date/time when the entry was created."
|
|
88
|
-
},
|
|
89
|
-
dateModified: {
|
|
90
|
-
type: "string",
|
|
91
|
-
description: "The date/time when the entry was modified."
|
|
92
|
-
},
|
|
93
|
-
blobSize: {
|
|
94
|
-
type: "number",
|
|
95
|
-
description: "The size of the data in the blob."
|
|
96
|
-
},
|
|
97
|
-
blobHash: {
|
|
98
|
-
type: "string",
|
|
99
|
-
description: "The hash of the data in the blob."
|
|
100
|
-
},
|
|
101
|
-
encodingFormat: {
|
|
102
|
-
type: "string",
|
|
103
|
-
description: "The mime type for the blob."
|
|
104
|
-
},
|
|
105
|
-
isEncrypted: {
|
|
106
|
-
type: "boolean",
|
|
107
|
-
description: "Indicates if the blob is encrypted."
|
|
108
|
-
},
|
|
109
|
-
compression: {
|
|
110
|
-
$ref: "https://schema.twindev.org/blob-storage/BlobStorageCompressionType",
|
|
111
|
-
description: "The type of compression used for the blob, if not set it is not stored with compression."
|
|
112
|
-
},
|
|
113
|
-
fileExtension: {
|
|
114
|
-
type: "string",
|
|
115
|
-
description: "The extension."
|
|
116
|
-
},
|
|
117
|
-
metadata: {
|
|
118
|
-
$ref: "https://schema.twindev.org/json-ld/JsonLdNodeObject",
|
|
119
|
-
description: "The metadata for the blob as JSON-LD."
|
|
120
|
-
},
|
|
121
|
-
blob: {
|
|
122
|
-
type: "string",
|
|
123
|
-
description: "The blob in base64 format, included if the includeContent flag was set in the request."
|
|
124
|
-
}
|
|
125
|
-
};
|
|
126
|
-
var required = [
|
|
127
|
-
"@context",
|
|
128
|
-
"type",
|
|
129
|
-
"id",
|
|
130
|
-
"dateCreated",
|
|
131
|
-
"blobSize",
|
|
132
|
-
"blobHash"
|
|
133
|
-
];
|
|
134
|
-
var additionalProperties = false;
|
|
135
|
-
var BlobStorageEntrySchema = {
|
|
136
|
-
$schema: $schema,
|
|
137
|
-
$id: $id,
|
|
138
|
-
description: description,
|
|
139
|
-
type: type,
|
|
140
|
-
properties: properties,
|
|
141
|
-
required: required,
|
|
142
|
-
additionalProperties: additionalProperties
|
|
143
|
-
};
|
|
144
|
-
|
|
145
|
-
// Copyright 2024 IOTA Stiftung.
|
|
146
|
-
// SPDX-License-Identifier: Apache-2.0.
|
|
147
|
-
/**
|
|
148
|
-
* Handle all the data types for blob storage.
|
|
149
|
-
*/
|
|
150
|
-
class BlobStorageDataTypes {
|
|
151
|
-
/**
|
|
152
|
-
* Register all the data types.
|
|
153
|
-
*/
|
|
154
|
-
static registerTypes() {
|
|
155
|
-
DataTypeHandlerFactory.register(`${BlobStorageContexts.ContextRoot}${BlobStorageTypes.Entry}`, () => ({
|
|
156
|
-
context: BlobStorageContexts.ContextRoot,
|
|
157
|
-
type: BlobStorageTypes.Entry,
|
|
158
|
-
defaultValue: {},
|
|
159
|
-
jsonSchema: async () => BlobStorageEntrySchema
|
|
160
|
-
}));
|
|
161
|
-
DataTypeHandlerFactory.register(`${BlobStorageContexts.ContextRoot}${BlobStorageTypes.CompressionType}`, () => ({
|
|
162
|
-
context: BlobStorageContexts.ContextRoot,
|
|
163
|
-
type: BlobStorageTypes.CompressionType,
|
|
164
|
-
defaultValue: {},
|
|
165
|
-
jsonSchema: async () => BlobStorageCompressionTypeSchema
|
|
166
|
-
}));
|
|
167
|
-
}
|
|
168
|
-
}
|
|
169
|
-
|
|
170
|
-
// Copyright 2024 IOTA Stiftung.
|
|
171
|
-
// SPDX-License-Identifier: Apache-2.0.
|
|
172
|
-
/**
|
|
173
|
-
* Factory for creating blob storage connectors.
|
|
174
|
-
*/
|
|
175
|
-
// eslint-disable-next-line @typescript-eslint/naming-convention
|
|
176
|
-
const BlobStorageConnectorFactory = Factory.createFactory("blob-storage");
|
|
177
|
-
|
|
178
|
-
// Copyright 2024 IOTA Stiftung.
|
|
179
|
-
// SPDX-License-Identifier: Apache-2.0.
|
|
180
|
-
/**
|
|
181
|
-
* The types of compression for blob storage data.
|
|
182
|
-
*/
|
|
183
|
-
// eslint-disable-next-line @typescript-eslint/naming-convention
|
|
184
|
-
const BlobStorageCompressionType = {
|
|
185
|
-
/**
|
|
186
|
-
* Gzip.
|
|
187
|
-
*/
|
|
188
|
-
Gzip: "gzip",
|
|
189
|
-
/**
|
|
190
|
-
* Deflate.
|
|
191
|
-
*/
|
|
192
|
-
Deflate: "deflate"
|
|
193
|
-
};
|
|
194
|
-
|
|
195
|
-
export { BlobStorageCompressionType, BlobStorageConnectorFactory, BlobStorageContexts, BlobStorageDataTypes, BlobStorageTypes };
|